Opened 15 years ago
Last modified 15 years ago
#1107 closed defect (fixed)
if returning a constant vector fails
Reported by: | Schubert TUD | Owned by: | Schubert TUD |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Simulation Code Generation | Version: | 1.4.5 |
Keywords: | Cc: | Schubert TUD, |
Description
Hi,
the following model cannot be compiled:
model ifBug
Real[2] t;
equation
t = if (time < 0.5) then {0,0} else {1,1};
end ifBug;
when this model is simulated using OMC, following error message is being issued:
record SimulationResult
resultFile = "Simulation failed.
Internal error code generation of expression CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1}) failed
Internal error code generation of expression CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1})[1] failed
Internal error code generation of expression $t$lB1$rB - CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1})[1] failed
Internal error code generation of expression CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1})[2] failed
Internal error code generation of expression $t$lB2$rB - CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1})[2] failed
Internal error code generation of expression CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1})[2] failed
Internal error code generation of expression 1.0 - CAST(/tp:REAL[2]/, if time < 0.5 then {0,0} else {1,1})[2] failed
Internal error generate_compute_output failed
Internal error Generation of simulation code failed
"
end SimulationResult;
Presumably, the OMC wants to "scalarise" the if equation. Instead of extracting the corresponding elements it tries to use the [index] operator and fails.
Regards,
Christian
This seems to work in trunk now.