Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

parameter passing for records does not work

parameter passing for records does not work

hello again current/smile,
seems that the record issue is not going to stop. here another problem:

the parameter passing for records does not work: if you have a model which contains records or an array of records as parameters and you want to set
them to other values while creating an instance in another model, the new values are not passed!

Code:


package testOM

record GenericData
  parameter Integer dataOne = 1;
  parameter Integer dataTwo = 1;
end GenericData;

record DataSetOne = GenericData(dataOne = 5, dataTwo = 10);

record DataSetTwo = GenericData(dataOne = 15, dataTwo = 20);

model HasRecordAsParameter
  parameter GenericData data;
  Integer variable;
equation
  variable = data.dataOne;
end HasRecordAsParameter;

model PassesRecordAsParameter
  parameter DataSetOne data;
  HasRecordAsParameter parameterReceiver(data = data);
  Integer variable;
equation
  variable = parameterReceiver.variable;
end PassesRecordAsParameter;

model PassesRecordArrayAsParameter
  parameter DataSetOne data1;
  parameter DataSetTwo data2;
  parameter GenericData data[2]={data1,data2};
  HasRecordAsParameter parameterReceiver[2](data = data);
  Integer variable;
equation
  variable = parameterReceiver[1].variable;
end PassesRecordArrayAsParameter;

end testOM;

in the cases above, the "variable" value after simulating is always "1" , although it should be "5".
Is this bug related to one that has already been reported? I will have a look into codeBeamer...hope I will find that...

There are 0 guests and 0 other users also viewing this topic
You are here: