cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Error in while loop

Johnruehlz
7-Bedrock

Error in while loop

I'm currently trying to write a while loop that will loop and add 1 cm to (D.section1) until the loop is able to reduce the total Incident Energy to under 1.1 but currently I'm getting a statement saying "This function refers to itself inconsistently"

1 ACCEPTED SOLUTION

Accepted Solutions

Looking further up in your sheet, I assume you mean Incident Energy should be cal/cm^2 - not cal/J.

Here is the corrected program per my previous three notes:

Capture.PNG

Yellow highlights indicate my additions.  Red arrows indicate removal of the unnecessary unit conversions.  You were essensially multiplying by 1 (that's what Valery was showing).

View solution in original post

8 REPLIES 8

Sorry

What is it

Jcal.png

Good catch, Valery. I just saw the unit inconsisency. It looks like OP is trying to manage their own units. Let Mathcad do that work!

Im sorry what are you asking about?

The error message is not very helpful, but here are some findings:

  • IE.Temp is not defined before the while loop.  It must be defined in order for Mathcad to know if it should enter the loop or not.
  • IE.Temp has units, but you are comparing it to a unitless quantity (1.1).  Your comparison must be unit consistent.  Is it 1.1*kg/s^2 ?
  • AFB.1 is initially defined with unit length.  Within the while loop you add 1 to AFB.1.  Should this be AFB.1 + 1cm?

The goal is to be able to find the working distance from where the Incident Energy which is measured in (cal/J) is lower than or equal 1.1 this defines a boundary in which I need. IE.Temp1 calculates the initial incident energy while IE.Temp2 determines the backfeed incident energy.

Looking further up in your sheet, I assume you mean Incident Energy should be cal/cm^2 - not cal/J.

Here is the corrected program per my previous three notes:

Capture.PNG

Yellow highlights indicate my additions.  Red arrows indicate removal of the unnecessary unit conversions.  You were essensially multiplying by 1 (that's what Valery was showing).

Johnruehlz
7-Bedrock
(To:MJG)

Wow thank you so much! You guys are great!

-MFra-
21-Topaz II
(To:Johnruehlz)

loop corretto.jpg

Top Tags