Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Can we further optimize on the number of equations in OpenModelica

Can we further optimize on the number of equations in OpenModelica

For a simple RC circuit with an AC source 3 equations should be suffcicient to solve.  But openModelica genrates around 21 equations.  Even after optimization the number of equation is 5.  How to reduce it further?

Re: Can we further optimize on the number of equations in OpenModelica

I tried a serial RC circuit in OMEdit and got only 2 equations...

eq: capacitor1.n.i = sinecurrent1.signalSource.offset + (if time < sinecurrent1.signalSource.startTime then 0.0 else sinecurrent1.signalSource.amplitude * sin(6.28318530717959 * (sinecurrent1.signalSource.freqHz * (time - sinecurrent1.signalSource.startTime)) + sinecurrent1.signalSource.phase));
eq: der(capacitor1.v) = DIVISION(-capacitor1.n.i,capacitor1.C,"(-capacitor1.n.i) / capacitor1.C because capacitor1.C == 0");

Parallel RC gives 4 equations (4th comes from the conditional heat port):
eq: capacitor1.n.i = DIVISION(capacitor1.v,resistor1.R_actual,"capacitor1.v / resistor1.R_actual because resistor1.R_actual == 0");
eq: resistor1.LossPower = capacitor1.v * capacitor1.n.i;
eq: der(capacitor1.v) = DIVISION(-capacitor1.n.i,capacitor1.C,"(-capacitor1.n.i) / capacitor1.C because capacitor1.C == 0");
eq: sinecurrent1.n.i = (-(if time < sinecurrent1.signalSource.startTime then 0.0 else sinecurrent1.signalSource.amplitude * sin(6.28318530717959 * (sinecurrent1.signalSource.freqHz * (time - sinecurrent1.signalSource.startTime)) + sinecurrent1.signalSource.phase))) - sinecurrent1.signalSource.offset;

How did you check how many equations were generated?

Re: Can we further optimize on the number of equations in OpenModelica

I am not meaning equations involved  while defining the circuit or model.  I mean the equations that are generated by Open Modelica after flattening the model and optimizing it.

Re: Can we further optimize on the number of equations in OpenModelica

I listed the number of equations that were generated after optimization. After flattening it will contain as many equations as there are variables (there is no way around that). But after optimization very few are left.

Re: Can we further optimize on the number of equations in OpenModelica

Yes sir,  you are right.  Very few equations are left after optimization, but still is it not more than the number of equations formed by nodal analysis or Modified Nodal Analysis.  In spite of optimization I feel some redundant equations are formed. Have I communicated what I wanted to?  I don't know please let me know?

There are 0 guests and 0 other users also viewing this topic
You are here: