Opened 8 years ago
Closed 6 years ago
#4054 closed defect (fixed)
Binding equation does not accept reduced-outputs function calls
Reported by: | massimo ceraolo | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | Frontend | Version: | |
Keywords: | Cc: |
Description (last modified by )
Consider the following code:
package VectorBinding function AddVector2 input Integer n; input Real x[n], y[n]; output Real z[n]; output Real z2; algorithm z := x + y; z2 := 2; end AddVector2; model TestVector2 parameter Real sum[2] = AddVector2(n = 2, x = {0.2, 0.2}, y = {0.1, 0.2}); Real y; equation y=sum[1]+sum[2]; end TestVector2; annotation(uses(Modelica(version = "3.2.2"))); end VectorBinding;
The binding equation defining sum[] calls a function but exploits only the first output.
It seems to me that, according to MSL (sect. 12.4.3) this should be considered valid Modelica code.
However OM does not accept this. When checking "TestVector2", it issues the following message:
[1] 12:19:04 Translation Error
[VectorBinding: 14:3-14:76]: Type mismatch in modifier of component sum, declared type Real[2], got modifier ({0.3, 0.4}, 2.0) of type (Real[2], Real).
[2] 12:19:04 Translation Error
Error occurred while flattening model VectorBinding.TestVector2
The issue seems to be related to the fact that the first output is an array: it works if it is scalar.
Tested with OpenModelica v1.11.0-dev-79-g5ac7218
Change History (2)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This model works fine with the NF and the latest nightly build.