New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClaRa: Array dimensions not equal #9017
Comments
We are failing in function real_array_copy_data(tmp2, _xi_elements); The Modelica function is
|
An MWE model Example
record BaseRecord
constant Integer nx = 4;
end BaseRecord;
record ExtendRecord
extends BaseRecord(nx=6);
end ExtendRecord;
function initArr
input BaseRecord r = ExtendRecord();
output Real x_1;
protected
Real x[r.nx-1];
algorithm
x := zeros(r.nx - 1);
x_1 := x[1];
end initArr;
BaseRecord r = ExtendRecord();
Real x_1;
equation
x_1 = initArr(r);
end Example; |
It seems that the frontend replaces Flat Modelica: function Example.initArr
input Example.BaseRecord r = Example.ExtendRecord(6);
output Real x_1;
protected Real[5] x;
algorithm
x := fill(0.0, r.nx - 1);
x_1 := x[1];
end Example.initArr; @perost Could you have a look? |
Fixed in #9023 by making sure we don't evaluate dimensions that contain references to function inputs. I guess we might still get issues if someone mixes function inputs and package constants in a dimension expression, so don't do that 😓 |
One issue is solved and I can directly open the next one. But this time a minimal working example could be harder to create. |
Description
For the developer version of ClaRa the model
ClaRa.Components.Furnace.Check.Test_CombustionChamber
fails at simulation during initialization while copying an array, because of unequal dimension sizes.Steps to Reproduce
Load TILMedia and ClaRa dev version and simulate
ClaRa.Components.Furnace.Check.Test_CombustionChamber
Expected Behavior
The dimensions of the arrays should align.
Version and OS
The text was updated successfully, but these errors were encountered: