Opened 13 years ago

Last modified 10 years ago

#1675 closed defect (fixed)

parameter passing for records does not work

Reported by: Fritz Zaversky Owned by: Fritz Zaversky
Priority: high Milestone:
Component: Frontend Version:
Keywords: Cc: Fritz Zaversky, Mahder Alemseged Gebremedhin

Description (last modified by Mahder Alemseged Gebremedhin)

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!

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".

Change History (2)

comment:1 by Mahder Alemseged Gebremedhin, 10 years ago

Component: Backend
Description: modified (diff)

comment:2 by Mahder Alemseged Gebremedhin, 10 years ago

Component: BackendFrontend
Note: See TracTickets for help on using tickets.