﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3139	equations do not switch based on param value in if statement	arvin84@…	Adrian Pop	"Hello,

i have a simple model as follows:



{{{
model test
  parameter Real b=0;
  Real y;
equation
  if b == 0 then
    y = 1000;
  else
    y = b;
  end if;
end test;
}}}



before simulation, first i instantiate the mode and i see that in the flattened model, only the equation regarding to b==0 is considered. i assume that the code generator also considers only this equation because after compilation and running the simulation, changing the value of b in plot window, does not affect the results.

I tried to remove the default value of b and i saw that this time the complete if statements appears in the flattened code after instantiation and therefore compiled after pushing simulation button.

I think the code generator should compile the if statements completely, no matter if the parameter in the if statement has a default value of not, because when you have a model which its dynamics changes regarding to the value of the parameters, and you want to generate an FMU from that, the FMU should also consists all equations for different values of the parameter.

Thanks,
Arvin
"	enhancement	assigned	high	Future	Frontend	trunk			
