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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Translate the entire conversation x

ODE solve electronics time function with condition

ESAB
10-Marble

ODE solve electronics time function with condition

Hello,

I'm using Mathcad Prime 11.

I'm trying to solve a differential equation with conditional logic (if) due to the presence of a diode in the circuit.

200-250V V2-IN.drawio.png

The input values are defined, and in the worksheet, some graphs are already plotted (e.g., I_TEST, VL1N).

 

Condition_Mathcad.png

I'm using Odesolve to compute the solution.

 

ODE_solve.png

Is this the correct approach?

It doesn't work with the following error "Plot failed"

Cou you help me?

 

Thank you very much

ACCEPTED SOLUTION

Accepted Solutions
ttokoro
21-Topaz I
(To:ESAB)

image.png
Mathcad's odesolve and image.png  are not good for I_TES(t) treatment. It can not solve image.png orimage.png. It try to solve  11.1 ms, the closs point of two functions.
I also assume 6.28 ms is the tangent line's start point. 
If you change the conditions such as d1, you should fix the start and end point of the plot. It shows the charge of Cstab decrease by  I_TES(t) pulse train discharges.

image.png

View solution in original post

8 REPLIES 8
LucMeekes
23-Emerald IV
(To:ESAB)

Some observations:

Your schematic is a bit enigmatic. You put a diamond symbol with a diode symbol inside. The diamond is connected in parallel to the capacitor. Is that to say your diode is in parallel to the capacitor? If yes, is the cathode side up, or down?
(Note: I'd expect the diode to be in series with the resistor.)

 

On the solve block:
The initial condition "VC(0 ms)=0 V" must be with the constraints, not with the initial guesses. (You don't need intial guesses with odesolve.

The little program sets a constraint on VC(t). The IF statement in there will not work. if the condition is true, VC(t) will become VL1N(t), which is also a voltage. But if the condition is false (the 'else' case), then VC(t) will become whatever the boolean construct Cstab*d/dt{VC(t)} = -I_TES(t) will result in, and note; because it's a boolean construct, that result can only be 1 (True) or 0 (False).

You should set up a constraint on d/dt{VC(t)} rather than on VC(t), so you may have to rethink how to incorporate the diode behaviour. Maybe it helps if you first solve the circuit without a diode, then put the diode behaviour in.

The solver expression should not read VC1(t)= odesolve.... but VC1=odesolve.... Check the help  (? in upper right corner of the window) to see how to use odesolve.

 

Success!
Luc

ESAB
10-Marble
(To:LucMeekes)

Hello Luc,

 

I'll take another look at it on Friday.
You're right, the schematic is a bit ambiguous 🙂 This version is definitely clearer.

Redresseur.png

Thx.

Emilien

ttokoro
21-Topaz I
(To:ESAB)

image.pngimage.pngimage.pngimage.png

ESAB
10-Marble
(To:ttokoro)

Hello  ttokoro,

 

Thank you for your help, and sorry for the delay.
I tried the file, but I don't think it's working as expected

 

LTspice with Load.pngLTspice with Load zoom.png

The output voltage decreases when the load increases due to insufficient energy stored in the capacitor to maintain the voltage.

Attached : LTspice simulation

 

Have a nice weekend,

Emilien

 

 

 

ttokoro
21-Topaz I
(To:ESAB)

image.png
Mathcad's odesolve and image.png  are not good for I_TES(t) treatment. It can not solve image.png orimage.png. It try to solve  11.1 ms, the closs point of two functions.
I also assume 6.28 ms is the tangent line's start point. 
If you change the conditions such as d1, you should fix the start and end point of the plot. It shows the charge of Cstab decrease by  I_TES(t) pulse train discharges.

image.png

ESAB
10-Marble
(To:ttokoro)

Hello ttokoro,

 

Thank you very much. You're really skilled with Mathcad

This function is more complicated than expected with Mathcad, ahah

 

Have a nice day !

 

Emilien

 

 

 

 

 

ttokoro
21-Topaz I
(To:ESAB)

Assuming average decrease of capacitor voltage, the start and end points of the effect of pulse train can be solved by using minerr function. Still the integral of narrow pulse wave shows error even increases the TOL to 10^-12.

 

image.pngimage.pngimage.png

ttokoro
21-Topaz I
(To:ttokoro)

Using average value of ITES odesolve can solve all conditions. The result of D1=0.1 also has no error. 

image.pngimage.pngimage.png

Announcements

Top Tags