Opened 17 years ago
Last modified 16 years ago
#1086 closed defect (fixed)
Multiple Function Return Arguments
| Reported by: | krsta | Owned by: | krsta |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Version: | ||
| Keywords: | Cc: | krsta, |
Description
"When i run this it just says that OMC has stopped working and then nothing happens?"
function t input Real hh; output Real e1; output Real e2; algorithm e1:=hh; e2:=2*hh; end t; model j Real j1; Real j2; equation (j1,j2)=t(2); end j; simulate(j,stopTime=5)
Another example:
function f
input Real x;
input Real y;
output Real r1;
output Real r2;
output Real r3;
algorithm
r1 := x;
r2 := y;
r3 := x*y;
end f;
model fCall
Real x[3];
Real a, b, c;
equation
(a, b, c) = f(1.0, 2.0);
(x[1], x[2], x[3]) = f(3.0, 4.0);
end fCall;
getVersion();
loadFile("functions.mo");
instantiateModel(fCall);
f(2.5, 3);
simulate(fCall);
incidence_row_exp TUPLE not impl. yet.incidence_row_exp TUPLE not impl. yet.incidence_row_exp TUPLE not impl. yet.incidence_row_exp TUPLE not impl. yet."1.4.4"0
true
"fclass fCall
Real x[1];
Real x[2];
Real x[3];
Real a;
Real b;
Real c;
equation
(a,b,c) = (1.0,2.0,2.0);
(x[1],x[2],x[3]) = (3.0,4.0,12.0);
end fCall;
"
(2.5,3.0,7.5)
record
resultFile = "Simulation failed.
Too few equations, underdetermined system. The model has 6 variables and 2 equations
"
end record
Probably some problem with multiple function return arguments?
Note:
See TracTickets
for help on using tickets.

The problem was that assigning one tuple to another tuple wasn't implemented in OMC (the function call was constant evaluated to a tuple). I fixed this in revision 4828.