- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Incorret code generation
Page Start Prev 1 Next End
Incorret code generation
Incorret code generation
Jan-25-12 18:24:28
I have a simple model for which OpenModelica fails to generate compileable code. Flatting and model check, however, succeed without errors.
Code:
package MyPackage
record State
Real a;
end State;
model Properties
State state;
Real b;
equation
b = func_b(state.a);
end Properties;
function func
input State s;
output Real b;
algorithm
b := func_b(s.a);
end func;
function func_b
input Real a;
output Real b;
algorithm
b := 2 * a;
end func_b;
end MyPackage;
model MyModel
replaceable package Medium = MyPackage;
parameter Integer numberOfNodes = 1;
input Medium.State[numberOfNodes] states;
Real[numberOfNodes] b;
equation
b = Medium.func(states);
end MyModel;
model TestModel
package Medium = MyPackage;
MyModel m(states = props.state);
Medium.Properties[1] props;
equation
props.state.a = {1};
end TestModel;
Best regards,
Michael
Edited by: mburisch - Jan-25-12 18:26:00
Re: Incorret code generation
Jan-25-12 18:39:20
- sjoelund.se
- 1700 Posts
Page Start Prev 1 Next End
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Incorret code generation
There are 0 guests and 0 other users also viewing this topic