Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hello,
I tried to make everything super safe regarding unit handover in programms but the error remains. has anybody an idea what this red colouring woulde mean? The Mathcad error meassge is definitely wrong.
It appears both in Mathcad 14 and 15.
many thanks
Gerfried
Solved! Go to Solution.
Looks like mathcad is complaining that one of the assignments in this block has the units of m^4*kg^2/s^5 or W^2*s or W*J (all are equivalent) but it should have the units of J (energy).
Difficult to tell where the error is within the block, I would guess that it is on the lowest level as it would probably flag a smaller section if the error was in a higher one.
My usual method is to copy the whole program block including the assignment (:=) to a safe place (page to the right) ,right click on the copy & select the disable evaluation option. Now that there is a safe copy, delete the whole block in the 'working copy' & line by line copy the offending code back in until the error re-appears.
hope this helps
Andy
My German is very poor, but your error message says (I'm sure you know) that MathCad believes the units are not consistent. Start by checking the units for all parameters in your program--often I find that a built-in value (N is newtons force, for example) is the culprit.
Mathcad error messages are very confusing and often not correct. Good luck.
Fred
Looks like mathcad is complaining that one of the assignments in this block has the units of m^4*kg^2/s^5 or W^2*s or W*J (all are equivalent) but it should have the units of J (energy).
Difficult to tell where the error is within the block, I would guess that it is on the lowest level as it would probably flag a smaller section if the error was in a higher one.
My usual method is to copy the whole program block including the assignment (:=) to a safe place (page to the right) ,right click on the copy & select the disable evaluation option. Now that there is a safe copy, delete the whole block in the 'working copy' & line by line copy the offending code back in until the error re-appears.
hope this helps
Andy
Thanks
I was told that the error must lay in the returning of variables with units, but I have removed them all, now.
Either there is a very sophisticated bug of mine or..... I hav eto change the software I work with.
After deleting the nasty red parts I got a very interesting new error message which will bring me forward or backwark depending where the error is with me or with Mathcad.
Diese Funktion ist unvereinbar selbstreferenziell
whis could mean
This function is referring to istself in an non consistant way...
keep on hoping...
I had to do ist the hard way - building the programm from scratch again copying in line per line as you recommended.
There were two errors- one was explainable to me since index in a subprogramm call was not integer, but the other error remains totally unclear- I had to recode replacing a combined "max" and "abs" construct by "if" "otherwise" and single assignements. If determinat is used instead of abs normally this is indicated directly as error.
Summarising:
The error was not caused by erroneous unit handover from and to the programm, it remains however doubtful why Mathcad does not complain when handing over different units to the programm but only when returning - well thats because they reside in a vector...
There was no error in the usage of variables having wrong units.
The error originated from odd code and misleading error message were thrown at totally difefrent places.
Thanks again for tyring to help me, next time I will not use Mathcad to do such complex programms- may be python, scilab...
The error was not caused by erroneous unit handover from and to the programm, it remains however doubtful why Mathcad does not complain when handing over different units to the programm but only when returning - well thats because they reside in a vector... There was no error in the usage of variables having wrong units.
The issue arises because of the nits that are in the program, not the ones passed to it (except to the extent that they may conflict with the ones in it). You posted an example in which there are no units inside the program, and stated that it works.
Ok.
What are the units of P.nEA_m ?
what are the units of the function eff.BB ?
what are the units of Dt ?
At the top you define P.antr_m as 1 W, then have an If block that executes if it's negative. Is the assignment to 1W an attempt to troubleshoot? If it is, then this block would never execute; what happens if you leave the assignment in and cut out the whole If block?
Thanks a lot. indeed the logic is odd- it was alterered avoiding error messages 😉
The inconsistent issue pertains I think the error may lay in some function handover...
keep on
Hi Gerfried,
There are possibly two issues here -
The first is that MathCad doesn't allow you to assign different units to different parts of the same array (matrix , vector etc)
So although some functions (eg find) can return systems that contain mixed units, it will not allow you to save them to a single variable it has to be referenced as the example.
By the comments in this forum MathCad Prime will allow this - so could be an improvement.
The second is the inconsistent reference & the only time I have seen this error message is when I have had a recursive function.
Usually I am trying to create a time repetative function as in the 2nd example.
I had created the function & after a lot of thought added a 2nd parameter to give me more flexibility on the use.
Unfortunately I didn't update all the internal calls to the function name & MathCad (quite correctly) complained.
Regards
Andy
Is this the same program as before?
Richard Jackson wrote:
Is this the same program as before?
I think so. Computer programmers do it again, hoping for a different result 😉