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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Variables in premade document stop being defined after several pages. How to deal with it?

Garr
3-Visitor

Variables in premade document stop being defined after several pages. How to deal with it?

I have received a file to plug my variables in and use. But after 14 pages (the file is 34 pages long) variables stop being defined. Literally for no reason: they're defined on the page before that, they're even defined in a similar formula to the side, but after a certain point, the whole thing just stops computing.

 

I tried recalculating the whole thing several times and copy-pasting the whole thing into a newly made document, but that had no effect.

It is most likely NOT a fault in writing of the document, since the same document worked for my buddy (he lent me this document).

 

Can anyone advice me how to stop this irregular behaviour?

 

Временно.png

 

(all other variables there are defined earlier)

1 ACCEPTED SOLUTION

Accepted Solutions

The very sheet you finally attached sure did never run OK on any computer with any version of Prime.

Either it did not run for your buddy, too, or it was modified.

 

Luc is right that the labelling is not the cause for your issues, but the errors you experience do not stem from the problems in the function definitions, which Luc is mentioning, either. 😉

Nevertheless  you should define your functions more clearly, though. The way you (or your buddy) did it is kind of sloppy as two conditions are true if the angle is exactly pi, 2pi or 3pi. But this is no problem for Prime - the second condition wins. There is no error thrown because of this. Its also sloppy that you did not define a return value for angles larger than 4 pi as Luc also had noticed. But this, too does not throw an error, because, as far as I see, you never feed your functions with angles larger than 720 degree.

Nonetheless you should correct your functions the way Luc has suggested.

 

The real cause for the errors your sheet is throwing are:

1) Two times you follow a function definition with an equal sign (numerical evaluation). Luc was the first to point this out to you in his first reply and I had additionally attached a picture to make it clearer.

2) Later you use functions M.npF3H and M.npF4H but these function are not defined anywhere in your sheet.

Instead we just see the definitions of M.npF1H and M.npF2H .

3) Later you use a variable N which is never defined (4 pi /N and a range i:=0,1..N). N is interpreted as the unit Newton by Prime and thats the reason for the unit mismatch error in the range definition

 

I gave it a try and corrected all those errors and your worksheet performs well.

I used already defined functions for the missing ones, which is sure not what you had in mind and used N:=12.

I also deleted the regions which write Excel-files as I don't like worksheets which create files on my computer without any warning. You should disable that kind of commands when you post worksheets.

 

I attach the modified sheet in version P5

I stopped the calculation for the last three plots as I did not want to wait for these time consuming calculations to finish. Thats the reason you still see red errors there but hey should go away if you recalculate the sheet.

You have still to provide the correct missing functions and the correct value for N!

 

 

 

 

View solution in original post

6 REPLIES 6
LucMeekes
23-Emerald III
(To:Garr)

Not without you posting the worksheet.

It's is hard, usually impossible, to debug a picture.

Post the worksheet!

There's only one thing I can guess from the picture that might cause your problem:

In the definition of function M<something> where the first problem occurs, you have an evaluation at the end (there's an '=' just before the question mark).

Remove that '='. (the question mark will also disappear), and it just might be that the function is revived....

If that's the case, you're lucky. Otherwise, read my first sentence above, and act upon the third sentence.

 

Success!

Luc

Garr
3-Visitor
(To:LucMeekes)

I have posted the worksheet.

 

... I have no idea why I haven't done so in the first place... 

LucMeekes
23-Emerald III
(To:Garr)

Your problem does not appear to be a labelling issue (as Werner suggested to check). But:

Your definitions of F1 through F1, P1 through P4, F1H through F4H and P1H thorugh P4H all have the same two problems:

1. You have several if statements in there, all using <= (less than or equal).

What should the function result be if PhiM happens to be exactly pi? Should it be the result of the first if-statement, or of the second if-statement? (and so: How should Prime know what to do, other than throwing an error.)

2. What should the function result be if PhiM is larger than 4*pi?

Remedy:

1. The first if statement is OK, the second should be      if (pi < PhiM <= 2pi)...       etc. Or the first should be modified to       if (PhiM < 2pi),       then the second becomes      if (pi <= PhiM < 2pi)...  etc.

2. You should either add an otherwise-statement, or leave the upper border of the last if-statement open.

 

Now all this does not explain exactly why your problem occurs, especially not if the same sheet runs OK on another computer. But Mathcad and Prime were never renowned for exactly pinpointing the cause of an error.

I suggest you start by correcting as indicated above and see what happens.

 

Success!
Luc

 

The very sheet you finally attached sure did never run OK on any computer with any version of Prime.

Either it did not run for your buddy, too, or it was modified.

 

Luc is right that the labelling is not the cause for your issues, but the errors you experience do not stem from the problems in the function definitions, which Luc is mentioning, either. 😉

Nevertheless  you should define your functions more clearly, though. The way you (or your buddy) did it is kind of sloppy as two conditions are true if the angle is exactly pi, 2pi or 3pi. But this is no problem for Prime - the second condition wins. There is no error thrown because of this. Its also sloppy that you did not define a return value for angles larger than 4 pi as Luc also had noticed. But this, too does not throw an error, because, as far as I see, you never feed your functions with angles larger than 720 degree.

Nonetheless you should correct your functions the way Luc has suggested.

 

The real cause for the errors your sheet is throwing are:

1) Two times you follow a function definition with an equal sign (numerical evaluation). Luc was the first to point this out to you in his first reply and I had additionally attached a picture to make it clearer.

2) Later you use functions M.npF3H and M.npF4H but these function are not defined anywhere in your sheet.

Instead we just see the definitions of M.npF1H and M.npF2H .

3) Later you use a variable N which is never defined (4 pi /N and a range i:=0,1..N). N is interpreted as the unit Newton by Prime and thats the reason for the unit mismatch error in the range definition

 

I gave it a try and corrected all those errors and your worksheet performs well.

I used already defined functions for the missing ones, which is sure not what you had in mind and used N:=12.

I also deleted the regions which write Excel-files as I don't like worksheets which create files on my computer without any warning. You should disable that kind of commands when you post worksheets.

 

I attach the modified sheet in version P5

I stopped the calculation for the last three plots as I did not want to wait for these time consuming calculations to finish. Thats the reason you still see red errors there but hey should go away if you recalculate the sheet.

You have still to provide the correct missing functions and the correct value for N!

 

 

 

 

Garr
3-Visitor
(To:Werner_E)

Thank you very much for assisting little old me, but... I am using Prime 4, therefore, I cannot open the file. 

 

Nonetheless, your input was invaluable. Indexes with F3 and F4 are remnants of the file's origins, since original assignment had 4 engines, but we had ours cut down to 2.

Werner_E
24-Ruby V
(To:Garr)

Its hard to guess what the cause for the problem could be without seeing the worksheet.

The equal sign after the function definition sure is wrong - delete it!

Furthermore make sure that Primes infamous autolabelling hasn't strucked again.

Check, if the two marked instances of phi.M are labelled the same. Either both "Variable" or both "-" (meaning "auto").

B.png

Top Tags