﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2601	attributes get lost for optimization models	Lennart Ochel	Lennart Ochel	"Some variable attributes get lost for the following model
{{{
setCommandLineOptions(""+g=Optimica"");
getErrorString();

loadString(""
model BatchReactor
  Real x2;
  Real x1;
  Real y2(start =0, fixed=true, min=-0.1, max=1e4, nominal = 3);
  Real y1(start =1, fixed=true, min=-0.1, max=1e6, nominal = 2);

  input Real u(min=-0.1, max = 2.0, nominal = 1.0,start = 1.0);
equation
  x2 = a*y2;
  x1 = b*y1;
  b*der(y1) = -(u+u^2/2)*x1;
  a*der(y2) = u*x1;
end BatchReactor;

optimization nmpcBatchReactor(objective = cost)
  parameter Real a = 10;
  parameter Real b = 20;

  Real cost = -a*y2;
  extends BatchReactor(y1(start =1/b, fixed=true, min=0, max=1/b, nominal = 1/b),
                       y2(start =0, fixed=true, min=0, max=1/a, nominal = 1/a),
                                           u(min=0, max = 5.0, nominal = 1.0,start = 1.0));
end nmpcBatchReactor;
"");
getErrorString();

optimize(nmpcBatchReactor, numberOfIntervals=20, tolerance = 1e-8,simflags=""-lv LOG_IPOPT"");
getErrorString();
}}}

If you run that mos-script, you will get the following output
{{{
true
""""
true
""""
record SimulationResult
    resultFile = ""/home/lochel/Documents/tests/Opt/nmpcBatchReactor_res.mat"",
    simulationOptions = ""startTime = 0.0, stopTime = 1.0, numberOfIntervals = 20, tolerance = 1e-08, method = 'optimization', fileNamePrefix = 'nmpcBatchReactor', options = '', outputFormat = 'mat', variableFi
lter = '.*', measureTime = false, cflags = '', simflags = '-lv LOG_IPOPT'"",
    messages = ""Optimizer Variables
========================================================
State[0]:y1(start = 0.05, nominal = 0.05, min = -Inf, max = 0.05, init = 0.05)
State[1]:y2(start = 0, nominal = 0.1, min = -Inf, max = 0.1, init = 0)
Input[2]:u(start = 1, nominal = 1, min = 0, max = 5)
--------------------------------------------------------
========================================================
[…]
}}}

As you can see, the min-Attributes are wrong (should be 0.0).

The min attributes get readout from the *_init.xml file, and some attributes are missing:
{{{#!xml
  <ScalarVariable
  name = ""y1""
  valueReference = ""1000""
  variability = ""continuous"" isDiscrete = ""false""
  causality = ""internal"" isValueChangeable = ""true""
  alias = ""noAlias""
  classIndex = ""0"" classType = ""rSta""
  fileName = ""&lt;interactive&gt;"" startLine = ""6"" startColumn = ""3"" endLine = ""6"" endColumn = ""64"" fileWritable = ""true"">
  <Real useStart=""false"" start=""0.0"" fixed=""true"" useNominal=""true"" />
  </ScalarVariable>
}}}"	defect	closed	high	1.9.1	Backend	trunk	fixed		Willi Braun Bernhard Bachmann
