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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Translate the entire conversation x

ODE solve electronics time function with condition

ESAB
7-Bedrock

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

2 REPLIES 2
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
7-Bedrock
(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

Announcements

Top Tags