- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » algorithm statement or equation?

## algorithm statement or equation?

### algorithm statement or equation?

#### Code:

model Model_A

...

algorithm

if timer_dyn.y > t_dyn then

condition1 := true;

else

condition1 := false;

end if;

if isOV or isUV or condition1 then

isON := false;

else

isON := true;

end if;

y := i;

end Model_A;

model Model_B

...

equation

if timer_dyn.y > t_dyn then

condition1 = true;

else

condition1 = false;

end if;

if isOV or isUV or condition1 then

isON = false;

else

isON = true;

end if;

y = i;

end Model_B;

Hi Everyone,

I have some question about the difference between algorithm statment and equation and how it handled in Modelica. Both Model_A and Model_B have the same functions. Both work identically as far as some test that i run in OM (i.e isON change its state when ever the conditions are met). The only difference that i notice is when i export the model as FMU. In the description file of Model_A the following c-flies are included:

./simulation/solver/nonlinearSystem.c

./simulation/solver/nonlinearValuesList.c

./simulation/solver/nonlinearSolverHybrd.c

./simulation/solver/nonlinearSolverHomotopy.c

./external_solvers/enorm_.c

./external_solvers/hybrj_.c

./external_solvers/dpmpar_.c

./external_solvers/qrfac_.c

./external_solvers/qform_.c

./external_solvers/dogleg_.c

./external_solvers/r1updt_.c"

./external_solvers/r1mpyq_.c

that weren't included in the modelDescription of Model_B. So i was wondering, how/when was it preferable to assign somting as an algorithm statment and how/when it is better to do with a normal equation? One thing i notice is, with algorithm statment, you can, for example, write two or three differrent when-statment and assign the same variable with different value and still count as one equation, but the same process as equation will count as two or three.

#### Code:

when a then

Variable := a

end when;

when b then

Variable := b

end when;

cheers

A

- Arinomo23
- 120 Posts

- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » algorithm statement or equation?