Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#3092 closed defect (fixed)

BackendDAECreate.mergeWhenCluases fails for more than one elsewhen

Reported by: Willi Braun Owned by: Lennart Ochel
Priority: normal Milestone: 1.9.4
Component: Backend Version: trunk
Keywords: Cc:

Description

See following example:

package TestModel
  package QueueOperations
    function AddIn
      input Real qin[:, :];
      input Integer qinlength;
      input Real qinfo[size(qin, 1)];
      output Real qout[size(qin, 1), size(qin, 2)];
      output Integer qoutlength;
    algorithm
      qout := qin;
      qoutlength := qinlength + 1;
      for i in 1:qinlength loop
        qout[:, i + 1] := qin[:, i];
      end for;
      qout[:, 1] := qinfo;
    end AddIn;

    function DeleteOut
      input Real qin[:, :];
      input Integer qinlength;
      output Real qout[size(qin, 1), size(qin, 2)];
      output Integer qoutlength;
    algorithm
      qout := qin;
      qoutlength := qinlength - 1;
    end DeleteOut;

    function ReadOut
      input Real qin[:, :];
      input Integer qlength;
      output Real qinfo[size(qin, 1)];
    algorithm
      qinfo := qin[:, qlength];
    end ReadOut;
  end QueueOperations;

  model TestQueueModel
    import TQ = TestModel.QueueOperations;
    Real numberqueue[3, 10](start = zeros(3, 10));
    Integer queuelength(start = 3);
    Real P;
    Real SPC;
    Real DD;
    //Integer counter(start = 0);
  equation
    when time > 1 then
      (numberqueue, queuelength) = TQ.AddIn(pre(numberqueue), pre(queuelength), {2.125, 3, 4});
    elsewhen time > 1.5 then
      (numberqueue, queuelength) = TQ.DeleteOut(pre(numberqueue), pre(queuelength));
    elsewhen time > 2 then
      (numberqueue, queuelength) = TQ.AddIn(pre(numberqueue), pre(queuelength), {2.125, 3, 4});
/*    elsewhen time > 2.5 then
      (numberqueue, queuelength) = TQ.DeleteOut(pre(numberqueue), pre(queuelength));
    elsewhen time > 3 then
      (numberqueue, queuelength) = TQ.AddIn(pre(numberqueue), pre(queuelength), {2.125, 3, 4});
    elsewhen time > 3.5 then
      (numberqueue, queuelength) = TQ.DeleteOut(pre(numberqueue), pre(queuelength));
    elsewhen time > 4 then
      (numberqueue, queuelength) = TQ.AddIn(pre(numberqueue), pre(queuelength), {2.125, 3, 4});
*/
    end when;
    {P, SPC, DD} = TQ.ReadOut(numberqueue, queuelength);
  end TestQueueModel;
end TestModel;

Change History (10)

comment:1 by Willi Braun, 10 years ago

Owner: changed from somebody to Willi Braun
Status: newaccepted

comment:2 by Willi Braun, 10 years ago

fixed in r24134.

comment:3 by Willi Braun, 10 years ago

Resolution: fixed
Status: acceptedclosed

comment:4 by Lennart Ochel, 10 years ago

Resolution: fixed
Status: closedreopened

Initialization fails for this model.

Notification: The given system is mixed-determined.   [index > 0]
Notification: The given system is mixed-determined.   [index > 1]
Notification: The given system is mixed-determined.   [index > 2]
Notification: The given system is mixed-determined.   [index > 3]
Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

Analysis from above is wrong, since the model is just under-determined.

comment:5 by Lennart Ochel, 10 years ago

Owner: changed from Willi Braun to Lennart Ochel
Status: reopenedaccepted

comment:6 by Willi Braun, 10 years ago

Why do you this ticket therefore?
There are some more models where such an issue occurs, so I don't think it really related to the handling of when clauses in BackendDAECreate.

ModelicaTest.Blocks.Logical 

Modelica.Mechanics.MultiBody.Examples.Loops.PlanarLoops_analytic.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

Modelica.Fluid.Examples.PumpingSystem.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

ThermoSysPro.Examples.SimpleExamples.TestWaterHammer.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

ThermoSysPro.Examples.SimpleExamples.TestStaticCondenser.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

ThermoSysPro.Examples.SimpleExamples.TestStodolaTurbine1.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

and even some more perhaps minor testcases in the testsuite.

Last edited 10 years ago by Willi Braun (previous) (diff)

comment:7 by Lennart Ochel, 10 years ago

Resolution: fixed
Status: acceptedclosed

The example from the description is now (r24291) handled correctly.

in reply to:  6 comment:8 by Lennart Ochel, 10 years ago

Replying to wbraun:

Why do you this ticket therefore?
There are some more models where such an issue occurs, so I don't think it really related to the handling of when clauses in BackendDAECreate.

ModelicaTest.Blocks.Logical 

Modelica.Mechanics.MultiBody.Examples.Loops.PlanarLoops_analytic.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

Modelica.Fluid.Examples.PumpingSystem.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

ThermoSysPro.Examples.SimpleExamples.TestWaterHammer.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

ThermoSysPro.Examples.SimpleExamples.TestStaticCondenser.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

ThermoSysPro.Examples.SimpleExamples.TestStodolaTurbine1.mos:// Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.

and even some more perhaps minor testcases in the testsuite.

The same error message is displayed in different situations. The examples you mentioned have nothing to do with the model from this ticket. I opened a new ticket (#3113) for some of the models that are still failing.

comment:9 by Dietmar Winkler, 9 years ago

Milestone: Futurepre1.9.4

It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.

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

Milestone: pre1.9.41.9.4

Removing the pre1.9.4 milestone in favor of 1.9.4.

Note: See TracTickets for help on using tickets.