#2588 closed defect (fixed)
+modelicaOutput does not work properly.
| Reported by: | Lennart Ochel | Owned by: | Federico Bergero |
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.4 |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: |
Description (last modified by )
The configuration flag + modelicaOutput does not work properly as the following script illustrates:
loadString("
package foo
connector bInput = input Boolean \"'input Boolean' as connector\";
connector bOutput = output Boolean \"'output Boolean' as connector\";
model M1
bOutput signal(start=true, fixed=false);
equation
signal = time > 0.5;
end M1;
model M2
bInput signal;
Real x(start=1, fixed=true);
discrete Real t0(start=0, fixed=true);
equation
when edge(signal) then
t0 = time;
end when;
der(x) = if signal then 1 else 0;
end M2;
model M1_M2
M1 control;
M2 machine;
equation
connect(control.signal, machine.signal);
end M1_M2;
end foo;
"); getErrorString();
setCommandLineOptions("+modelicaOutput"); getErrorString();
instantiateModel(foo.M1_M2); getErrorString();
The generated output is the following:
class foo.M1_M2 output Boolean control__signal(start = true, fixed = false); input Boolean machine__signal; Real machine__x(start = 1.0, fixed = true); discrete Real machine__t0(start = 0.0, fixed = true); equation control.signal = time > 0.5; when edge(machine.signal) then machine.t0 = time; end when; der(machine.x) = if machine.signal then 1.0 else 0.0; control__signal = machine__signal; end foo.M1_M2;
Change History (9)
comment:1 by , 12 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 11 years ago
| Milestone: | 1.9.1 → 1.9.2 |
|---|
comment:3 by , 11 years ago
| Milestone: | 1.9.2 → 1.9.3 |
|---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:5 by , 10 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → accepted |
comment:6 by , 10 years ago
I have a fix for this bug and for generating valid modelica output when dumping the DAE in general. I checked the dot operator in variable names, expressions and funcion names. Also the names of (multi-dimensional) arrays variables were fixed since before an array
Real a[10];
would generate
Real a[1]; Real a[2]; ... Real a[10];
Can anybody think of any other language structure that would generate invalid Modelica when dumped?
comment:7 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
This is fixed with changes introduced in pull request
https://github.com/OpenModelica/OMCompiler/pull/303

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).