Skip to main content
10-Marble
October 7, 2025
Solved

ODE solve electronics time function with condition

  • October 7, 2025
  • 1 reply
  • 981 views

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

Best answer by ttokoro

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

1 reply

23-Emerald IV
October 8, 2025

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

ESAB10-MarbleAuthor
10-Marble
October 8, 2025

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
21-Topaz I
October 22, 2025