I am a newby in Modelica and Dymola. I try to develop a wall heat transfer block for an internal combustion engine.
For this heat transfer I want to store the temperature, the volume and the pressure at the time, the intake valve closes (IVC). Realizing this by the following expression leads to an error message:
CODE
if (Einlass) and mdot_integer==0 then
Einlass = false;
ES = true;
elseif (Einlass==false) and mdot_integer <> 0 then
Einlass = true;
else
ES = false;
end if;
if ES then
T_ES = gas.T;
p_ES = gas.P;
V_ES = V;
end if;
---------error message:-----------------
QUOTE
Check of heattransfer:
Error: Unable to expand if-statement:
equation
if (Einlass and mdot_integer == 0) then
Einlass = false;
ES = true;
elseif (Einlass == false and mdot_integer <> 0) then
Einlass = true;
else
ES = false;
end if;
Since it was not possible to expand all equations into scalar ones.
the current version can only handle if-statements where
1. The conditions are parameter expressions that can be evaluated
2. The same variable occurs as left-hand-side variable in all branches
3. The equations can be expanded into scalar real equations
4. Combinations of the above.
5. When-statements are only supported if controlled by parameter expresssions that can be evaluated.
Errors or failure to expand the equation:
if (Einlass and mdot_integer == 0) then
Einlass = false;
ES = true;
elseif (Einlass == false and mdot_integer <> 0) then
Einlass = true;
else
ES = false;
end if;
Found in class heattransfer, declaration window at line 52.
Error: Unable to expand if-statement:
if (ES) then
T_ES = gas.T;
p_ES = gas.P;
V_ES = V;
end if;
Since it does not end with an else-clause.
if-statements must end with an else-clause even if they logically exhaust all possibilites.
unless: the conditions are parameters that can be evaluated
or the "equations" are assert or similar constructs.
Errors or failure to expand the equation:
if (ES) then
T_ES = gas.T;
p_ES = gas.P;
V_ES = V;
end if;
Found in class heattransfer, declaration window at line 61.
Errors or failure to expand vector or matrix expressions.
Check aborted.
ERROR: 2 errors were found
---------------------------------------------
Does someone know how to manage this?
Thanks for your help in advance.
Regards,
Jan