## Change causality during simulation

Moderators: Frank, paul, Hiwot, Chris, peter

Andres_Vazquez
Posts: 2
Joined: Tue Jul 24, 2007 9:00 pm
Location: Argentina

### Change causality during simulation

I have an electric nolinear model where the causality over a resistor must change in a moment as a result of a diode conduction stop. I am using a completely ideal model of a diode because of the complexity of the model. Can I modify the R causality using a controlled equation model for the R?

paul
Posts: 152
Joined: Mon Sep 19, 2005 2:00 pm
Location: Controllab Products B.V.

### Re: Change causality during simulation

Andres_Vazquez wrote:Can I modify the R causality using a controlled equation model for the R?
The pure hybrid form of a diode corresponds to an equation like

Code: Select all

``````0 = if condition then p.u else p.i end;
``````
However, in the current version the causality is determined before the simulation starts and this equation is not allowed.

What you can do is
• 1. make a diode model that has different equations depending on the causality (using the effortcausality and flowcausality statements)
2. use a switching junction to switch dynamic behavior based on a condition
3. use the constraint function to let other causal forms be solved numerically
Although I never tried this, you might try using 2. and 3. to create the desired dynamic switching behavior.

Normally constraint functions are used in the mechanical domain, for instance to solve closed kinematic chains etc.
In this situation a constraint function like

Code: Select all

``````u = constraint (i);
``````
calculates the electrical voltage u such that the electrical current i becomes zero.

One tip is that it must be possible to solve the constraint function during the whole simulation, it might be necessary to implement a continuous transfer behavior on the switching moments to let it work.

Another tip is that if you get it to work, this also involves additional numerical load. It is not certain that the non-hybrid form (like spice) behaves a lot slower than this approach

I'm anxious to see your efforts on this,
Hope this helps,

Paul
member 20-sim development team

Andres_Vazquez
Posts: 2
Joined: Tue Jul 24, 2007 9:00 pm
Location: Argentina

### Changing causality during simulation

I have solved the problem of changing causallity in the R by adding another R whith the inverse causality and making them play in turn by means of a switching power junction (SPJ). I have solved the same problem in a L but, in this case, I need to pass the state of one L (flow out) to the other L (effort out) when the switching action take place to go on. How can I program this?
Thanks

paul
Posts: 152
Joined: Mon Sep 19, 2005 2:00 pm
Location: Controllab Products B.V.

### Re: Changing causality during simulation

Andres_Vazquez wrote:I have solved the problem of changing causallity in the R by adding another R whith the inverse causality and making them play in turn by means of a switching power junction (SPJ). I have solved the same problem in a L but, in this case, I need to pass the state of one L (flow out) to the other L (effort out) when the switching action take place to go on. How can I program this?
You can program this using a resettable integrator, that allows the state to be set directly from within the model when a condition becomes true.