﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1107	if returning a constant vector fails	Schubert TUD	Schubert TUD	"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"	defect	closed	high		Simulation Code Generation	1.4.5	fixed		Schubert TUD
