Opened 8 years ago

Closed 7 years ago

#4276 closed defect (fixed)

Allow assignment to fixed=false parameters

Reported by: schneider@… Owned by: Lennart Ochel
Priority: high Milestone: 1.12.0
Component: Frontend Version:
Keywords: Cc:

Description (last modified by Lennart Ochel)

Hallo,
Das angehängte modell bdm.mue_v_t lässt sich nicht übersetzen. Es erscheint nur die Aufforderung einen Bug Report zu senden.
Könnten sie die Ursache überprüfen?

Die Fehlermeldung:

[bdm/bdm.mo:28:56-28:69:writable] Warning: Non-array modification 'false' for array component, possibly due to missing 'each'.
[bdm/bdm.mo:67:7-67:66:writable] Error: Failed elaborate assignment for some unknown reason: (q_0, sample_data) := bdm.mue_v_t.Model.mue_v_t_set_ini_cond({parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6]}, {inp[1], inp[2]}). File a bug report and we will make sure this error gets a better message in the future.
Error: Error occurred while flattening model bdm.mue_v_t.Model

Change History (17)

comment:1 by Lennart Ochel, 8 years ago

Reporter: changed from schneider@… to schneider@…

Dem Ticket ist kein Modell beigefügt.

comment:2 by Lennart Ochel, 8 years ago

Das Trac-System enthält einen Fehler, der es verhindert einen Anhang hochzuladen, sofern die Sprache "Deutsch" eingestellt ist.

Last edited 8 years ago by Lennart Ochel (previous) (diff)

comment:3 by Lennart Ochel, 8 years ago

It seems that the issue is related to an algorithm section. Is there a good reason for using an algorithm instead of equations as stated below?

file: bdm/bdm.mo
@@ -25,7 +25,7 @@ package bdm
     protected
       final parameter Real parameters[6] = {multiple_instances, data.integrator_t0, data.a, data.b, data.c, data.v_ref};
       parameter Real q_0[1](each fixed = false);
-      Real q[1](each stateSelect = StateSelect.prefer, fixed = false, start = q_0);
+      Real q[1](each stateSelect = StateSelect.prefer, each fixed = false, start = q_0);
       Real f[1];
       Real ma[1];
       Real inp[2];
@@ -63,9 +63,9 @@ package bdm
       
         external "Fortran 77" mue_v_t_set_ini_cond(para, inp, q, samp_out);
       end mue_v_t_set_ini_cond;
-    initial algorithm
-      (q_0, sample_data) := mue_v_t_set_ini_cond(parameters, inp);
-      sample_data_hold := sample_data;
+    initial equation
+      (q_0, sample_data) = mue_v_t_set_ini_cond(parameters, inp);
+      sample_data_hold = sample_data;
     equation
       (ma, f, outp) = mue_v_t_get_ma_f(parameters, inp, sample_data, q);
     algorithm

comment:4 by Lennart Ochel, 8 years ago

Component: *unknown*Frontend
Description: modified (diff)
Summary: modellübersetzÜbersetzung schlägt fehl.Modellübersetzung schlägt fehl

comment:5 by Adrian Pop, 8 years ago

Owner: changed from somebody to Adrian Pop
Status: newaccepted

comment:6 by Francesco Casella, 8 years ago

Since when we have bug reports in German? :)

Last edited 8 years ago by Francesco Casella (previous) (diff)

comment:7 by Adrian Pop, 8 years ago

Fixed the initial algorithm issue (with allowing assign to parameter(fixed=false)) in c4ab68/OMCompiler.
Added tests in 6c47c8/OpenModelica-testsuite.

@lochel: can you take it from here?

in reply to:  6 comment:8 by Francesco Casella, 8 years ago

Replying to casella:

Since when we have bug reports in German? :)

I tried google translate on this page, works quite well

in reply to:  6 comment:9 by Adrian Pop, 8 years ago

Replying to casella:

Since when we have bug reports in German? :)

Well, if people have issues with English we should adapt to whatever language they speak :)
In plus, we have plenty of German speaking developers so is working fine.

comment:10 by Adrian Pop, 8 years ago

Owner: changed from Adrian Pop to Lennart Ochel
Status: acceptedassigned

comment:11 by Lennart Ochel, 8 years ago

The initialization problem is not fully specified. Hence, one additional initial condition is introduced during the symbolic transformations. This is a problem, especially if you want to support various Modelica tools.

Besides that, the simulation code gets now generated and may work fine. I cannot test it, because the external functions are precompiled for a different target. Stefan, can you please have a look? Is your problem already solved or is there more to fix?

comment:12 by Lennart Ochel, 8 years ago

Stefan via mail:

Thanks for your help.
Can you please tell me which additional Initial condition i Need to introduce. So That i Can test the model.
The problem is Not yet fixed. Why do Other modelica tools May behave different? Is there no standard?
Thank you very much.

comment:13 by Lennart Ochel, 8 years ago

OpenModelica reports this information. You should see the following warning:

Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").

And using the flag –d=initialization, the output becomes more verbose:

Warning: Assuming fixed start value for the following 1 variables:
         q[1]:VARIABLE(start = q_0[1] fixed = false stateSelect=StateSelect.prefer protected = true )  type: Real  [1]

The problem is, that there is no standardized way of solving initialization problems with too few initial conditions. Every tool has its own implementation and things may also change with different versions of the same tool. In general, you should always ensure that the initialization problem is fully specified.

comment:14 by Lennart Ochel, 8 years ago

Stefan via mail:

Are you sure that this is an initialization problem?
The error message I get is
Error occurred while flattening model...
I cannot even create connections in the model test.
Thanks for your help.

comment:15 by Lennart Ochel, 8 years ago

The flattening issue should already be fixed (see c4ab684 and comment:7).
We provide every day a new installer for OpenModelica: nightly-builds. Please update to the latest build and try it again.

Last edited 8 years ago by Lennart Ochel (previous) (diff)

comment:16 by Martin Sjölund, 7 years ago

Can this be closed now?

Version 0, edited 7 years ago by Martin Sjölund (next)

comment:17 by Martin Sjölund, 7 years ago

Milestone: Future1.12.0
Resolution: fixed
Status: assignedclosed
Summary: Modellübersetzung schlägt fehlAllow assignment to fixed=false parameters
Note: See TracTickets for help on using tickets.