Opened 6 years ago
#5521 new defect
Connector with array of records - problem when assigned in algorithm section
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | *unknown* | Version: | v1.14.0-dev-nightly |
Keywords: | Cc: |
Description
Referred to https://trac.openmodelica.org/OpenModelica/ticket/5493#comment:1
In the following package I declare a record called Rec, and two connectors (an input and an output one) with an array of Rec.
When a block tries to modify its output connector in an algorithm section (see block named Sender) the simulation results in a problem.
package connector_algorithm constant Integer BUFFER_SIZE = 5 "size of the array"; record Rec "simple record containing one variable" discrete Real data; end Rec; connector INPort "connector containg an array of records" input Rec buffer[BUFFER_SIZE]; end INPort; connector OUTPort "connector containg an array of records" output Rec buffer[BUFFER_SIZE]; end OUTPort; block Sender "block which updates the array using an algorithm section" OUTPort OUT; algorithm when time > 0.6 then for i in 1:size(OUT.buffer, 1) loop OUT.buffer[i].data := 33.0; end for; end when; end Sender; block Receiver "a block with an input port" INPort IN; end Receiver; model test "aggregate model" Sender S; Receiver R; equation connect(S.OUT, R.IN); end test; end connector_algorithm;
Error:
[1] 15:44:54 Symbolic Error
Model is structurally singular, error found sorting equations
1: algorithm
$whenCondition1 := time > 0.6;
when $whenCondition1 then
for i in 1:5 loop
S.OUT.buffer[i].data := 33.0;
end for;
end when;
;
for variables
$whenCondition1(6), R.IN.buffer[5].data(1), R.IN.buffer[4].data(2), R.IN.buffer[3].data(3), R.IN.buffer[2].data(4), R.IN.buffer[1].data(5)
[2] 15:44:54 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!
This problem disappears with the new frontend (the one ticked with "Enable experimental new instantiation phase" in simulation options).