#4521 closed defect (fixed)
OM does not allow omitting a function output
Reported by: | massimo ceraolo | Owned by: | somebody |
---|---|---|---|
Priority: | normal | Milestone: | 1.12.0 |
Component: | *unknown* | Version: | |
Keywords: | Cc: |
Description
Modelica specifications allow to use function calls in which only part of the function outputs are used (MS 3.3 rev2 sect. 12.4.3).
However in some cases this is not accepted by OM.
Consider the following package:
package TestRealFun model TestMdl parameter Real Z[2] = TestFun(2, {1.0, 2.0}); end TestMdl; function TestFun "returns an array and a scalar" input Integer n; input Real x[n]; output Real z1[n]; output Real z2; algorithm for i in 1:n loop z1[i] := x[i]; end for; z2 := 2 * x[1]; end TestFun; end TestRealFun;
If we run TestMdl we get the following error:
[1] 21:35:17 Translation Error [TestRealFun: 3:5-3:49]: Type mismatch in modifier of component Z, declared type Real[2], got modifier ({1.0, 2.0}, 2.0) of type (Real[2], Real). [2] 21:35:17 Translation Error Error occurred while flattening model TestRealFun.TestMdl
Tested with OM 1.12 beta1 for win 64
Change History (5)
follow-up: 2 comment:1 by , 7 years ago
comment:2 by , 7 years ago
Replying to tbc@…:
See ModelicaCompliance.Functions.Calls.CallMultiResultsWithOmittedOutput2.
Nice.
You've used much better names than mine.
Once this is solved, I will try this pattern also with complex numbers (that is where my names with "z" came from).
comment:5 by , 7 years ago
Milestone: | 1.13.0 → 1.12.0 |
---|
Note:
See TracTickets
for help on using tickets.
See ModelicaCompliance.Functions.Calls.CallMultiResultsWithOmittedOutput2.