﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2500	premature optimization when generating simulation code	Bill Janssen	Adrian Pop	"We'd like to be able to build a simulation executable and then run it multiple times, tweaking various parameter values for each run.  However, some parameter overrides have no effect.  Consider the simulation executable for the attached very abstract model of a vehicle, generated with
 
{{{
  omc +s +i=params.drivetrain params.mo Modelica ModelicaServices
  make -f params.drivetrain.makefile
}}}

One can run the model and observe the result:
 
{{{
  % ./params.drivetrain -output=body.s
  time=1,body.s=0.50000000001342925771
  %
}}}

It's possible to override some parameters:

{{{
  % ./params.drivetrain -output=body.s -override=""body.m=2""
  time=1,body.s=0.25000000002465611049
  %
}}}

But not all:

{{{
  % ./params.drivetrain -output=body.s -override=""direction=2""
  time=1,body.s=0.50000000001342925771
  %
}}}

This is because some branches of if-equations controlled by parameter expressions are not being included in the generated C code.  This appears to be an optimization, and a reasonable default optimization.  However, it would be useful to be able to disable it, so that more kinds of parameters could be overridden at simulation time.  Optimizations of this type should be enabled by specific optimization flags, and those flags should be added to the set of default optimizations.

In addition, an attempt to override parameters the effect of which has been optimized away should be reported as an error."	defect	assigned	high	Future	Backend	trunk			
