Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
A solve block with "odesolve" might do the job.
Set up a Mathcad sheet and post it here so we have something to work with and see, which variables and functions are defined in which way and which functions you are actually looking for.
Hi Werner,
below is what we are trying to do, I think one error is that I am working currently with units. But I am am not sure at all regarding the setup.
odesolve in MC15 unfortunately does not work with units. Thats one of the very few improvements in Prime.
I also wonder what you mean by
or
"If" is defined as a constant, so its derivative would be zero anyway.
If this is an attempt to prepare the calculation for future changes where "If" is not constant but dependent on time, you would have to define "If" as a function of time, even if its constant
and use "If(t)" instead of just "If" throughout.
You did not define t0. Guess you should just use 0 instead.
You only have to provide initial conditions for the two functions isp1 and isp2. The other functions are already defined!
BTW, I would suggest NOT defining a range for "t" at the top. This range should only be used for plotting later, so you should define it just before the plot, if necessary at all.
I tried to set up your sheet without units (next step would be to add units, just strip them for the solve block, and re-add them to the solved functions) but ran into an error in the solve block.
Maybe you have to look at the correctness of the two equations in the solve block?
MC15 sheet attached
Hi Werner,
thank you very much for your hints, you are right, we set "If" to constant. Later we can add your solution to this.
So I have modified the Script and also discarded t and replaced it by u, also discarded the units.
Of course as you saw "If" is constant so the term is now set to 0.
This still does not work, perhaps the time dependant voltage term u1p, u2p, or the mutual inductance terms M1f, M2f are the problem?
u instead of t should not make any difference but its nicer for me. Reason is that when I open your sheet, all occurences of "t" are replaced by "tonne". Reason is possibly because you use language setting German while I am using English (even though I am German speaking). But this could be easily solve by using "Replace all".
The reason for the "two few initial conditions" error are the two equations for u1p and u2p you have in the solve block.
These functions are uniquely defined anyway, so there is no reason for these two equations.
Furthermore it does not make sense to provide "initial conditions" for the already fully defined functions M1f, M2f and gamma.
You have a system od two ODEs of first order in two unknown functions isp1 and isp2 and so you have to provide IC for these two functions only.
Additionally you demand the impossible when you set M1f(0)=3 because with the function you defined M1f(0)=0.0024!
But deleting these regions does not cure the problem. You now run into the very same strange error as I did in the sheet I posted above.
Mathcad's error messages from a solve block very often are hard to understand and inaccurate or inappropriate. So the error message "This value must be a function, but has the form: any1" must not be taken word by word.
This is the reason why I suggested that you double check your two equations and initial conditions as i could not spot any syntactical error and so suspected, that the system with these two equations and ICs might not be solvable at all and Mathcad is telling this in a rather strange way. Of course I may be wrong and could have overlooked an error in the setup.
BTW, not that it would help in any way, but shouldn't be Lh set to 10^-4 rather than 0.1 ?
Hi Werner,
thank you for your reply and I agree. You are correct with Lh, thank you! But that unfortunatly does not contribute to the solution.
In the meantime I did the same as you and deleted these terms. I also get a red g.
I have a suspicion, that one has to work with a mass matrix here to get the derivatives on the left side.
But I don't know if this works in mathcad. I also reduced the two equations to the minimum, removing the derivatives.
This results in no errors, but adding d/dt terms back in leads to a failure....
My guess is that Mathcad fails in creating a non-singular derivative matrix it needs for its numerical algorithm.
I get the same error with this simple (pathologic) system, which obviously should have the solution f1(x)=f2(x)=e^x