#2483 closed defect (fixed)
function call with multiple output
Reported by: | Owned by: | Martin Sjölund | |
---|---|---|---|
Priority: | high | Milestone: | 1.9.4 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
function add input Integer a; input Integer b; output Integer sum; output Integer subtract; output Integer multiply; algorithm sum:= a+b; if (a>b) then subtract:= a-b; else subtract:= b-a; multiply:= a*b; end if; end add;
if i want to get just the multiplication part of the result then i did
(,,mult) := add (3,4);
Also, (add,sub):= add (3,4) works fine
but when i want only subtraction part then it doesnt work
(,sub):= add (3.4);
Change History (16)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Component: | OMEdit → Frontend |
---|
comment:3 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:4 by , 11 years ago
comment:5 by , 11 years ago
Even after installing the latest nightly build, i still get the same error "Type mismatch in assignment in (_, sub) := add(3, 4) of (#ANYTYPE#, Integer) := (Integer, Integer, Integer) "
comment:6 by , 11 years ago
Could you show a more complete example? Because the following does work for me:
function add input Integer a; input Integer b; output Integer sum; output Integer subtract; output Integer multiply; algorithm sum:= a+b; if (a>b) then subtract:= a-b; else subtract:= b-a; multiply:= a*b; end if; end add; model M Real x; algorithm (,x) := add(1,2); end M;
comment:7 by , 11 years ago
function add
input Integer a;
input Integer b;
output Integer sum;
output Integer subtract;
output Integer multiply;
algorithm
sum:= a+b;
if (a>b) then
subtract:= a-b;
else
subtract:= b-a;
end if;
multiply:= a*b;
end add;
model call
Integer sub;
algorithm
(,sub):= add(3,4);
end call;
It looks the same but its not working for me.. i dont know why
follow-up: 9 comment:8 by , 11 years ago
Do omc ++v
or getVersion()
to check the exact revision of omc you are using. Your code is working for me.
comment:9 by , 11 years ago
Replying to sjoelund.se:
Do
omc ++v
orgetVersion()
to check the exact revision of omc you are using. Your code is working for me.
I tried installing r18160 but now the same code is not simulating...i deleted the files in folder in Temp/OpenModelica/OMEdit....i also tried changing the name of the function :(
ERROR:
"Process crashed
Simulation process exited with code -1073741819"
"Scripting 16:11:19 0:0-0:0 Failed to open simulation result C:/Users/SHRES_~1/AppData/Local/Temp/OpenModelica/OMEdit/funcall_res.mat: Too few rows in data_2 matrix"
comment:11 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:12 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:14 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
r18159 fixes this for algorithms, but not equations.