Opened 12 years ago

Closed 11 years ago

#2243 closed defect (fixed)

reinit() statements do not appear in the xml produced by dumpXMLDAE

Reported by: Matthew Klenk <klenk@…> Owned by: Adrian Pop
Priority: normal Milestone: 1.9.1
Component: Backend Version: 1.9.0Beta
Keywords: Cc: Lennart Ochel

Description (last modified by Martin Sjölund)

In the attached model, a whenEquation tag is generated for the bounce_time, but not for the reinit() statement.

package BB
  model Ball
    Real y;
    Real vy;
    Real ay;
  equation
    der(y) = vy;
    der(vy) = ay;
  end Ball;
  model BouncingBall
    parameter Real e(start = 0.9);
    Ball b1(y.start = 5, vy.start = 0);
    Real bounce_time(start=0);
  equation
    b1.ay = -9.8;
   when b1.y <= 0 and b1.vy <= 0 then
     bounce_time = time;
     reinit(b1.vy, -e * pre(b1.vy));
    end when;
  end BouncingBall;
end BB;

Attachments (1)

bouncing_ball.mo (494 bytes ) - added by Matthew Klenk <klenk@…> 12 years ago.
file containing the package and model used to generate the error.

Download all attachments as: .zip

Change History (7)

by Matthew Klenk <klenk@…>, 12 years ago

Attachment: bouncing_ball.mo added

file containing the package and model used to generate the error.

comment:1 by Martin Sjölund, 12 years ago

Description: modified (diff)

comment:2 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:3 by Lennart Ochel, 11 years ago

Cc: Lennart Ochel added

comment:4 by Adrian Pop, 11 years ago

Owner: changed from probably noone to Adrian Pop
Status: newaccepted

comment:5 by Adrian Pop, 11 years ago

Reinits are saved separately (together with asserts, terminate and no return calls), not in the when equation.
I'll add all these to the xml.

comment:6 by Adrian Pop, 11 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in r18022. We now generate this file, containing reinit in WhenClausesList/WhenClause/WhenOperator/reinit:

<?xml version="1.0" encoding="UTF-8"?>
<dae xmlns:p1="http://www.w3.org/1998/Math/MathML"
                                                xmlns:xlink="http://www.w3.org/1999/xlink"
                                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                                xsi:noNamespaceSchemaLocation="http://home.dei.polimi.it/donida/Projects/AutoEdit/Images/DAE.xsd">
  <variables dimension="5">
    <orderedVariables dimension="3">
      <variablesList>
        <variable id="1" name="bounce_time" variability="discrete" direction="none" type="Real" fixed="false" flow="NonConnector" stream="NonStreamConnector">
          <classesNames>
            <element>
              BB.BouncingBall
            </element>
            <element>
              Real
            </element>
          </classesNames>
          <attributesValues>
            <initialValue string="0.0">
              <MathML>
                <math xmlns="http://www.w3.org/1998/Math/MathML">
                  <cn type="real">
                    0.0
                  </cn>
                </math>
              </MathML>
            </initialValue>
          </attributesValues>
        </variable>
        <variable id="2" name="b1.vy" variability="continuousState" direction="none" type="Real" differentiatedIndex="1" fixed="false" flow="NonConnector" stream="NonStreamConnector">
          <classesNames>
            <element>
              BB.BouncingBall
            </element>
            <element>
              BB.Ball
            </element>
            <element>
              Real
            </element>
          </classesNames>
          <attributesValues>
            <initialValue string="0.0">
              <MathML>
                <math xmlns="http://www.w3.org/1998/Math/MathML">
                  <cn type="real">
                    0.0
                  </cn>
                </math>
              </MathML>
            </initialValue>
          </attributesValues>
        </variable>
        <variable id="3" name="b1.y" variability="continuousState" direction="none" type="Real" differentiatedIndex="1" derivativeName="b1.vy" fixed="false" flow="NonConnector" stream="NonStreamConnector">
          <classesNames>
            <element>
              BB.BouncingBall
            </element>
            <element>
              BB.Ball
            </element>
            <element>
              Real
            </element>
          </classesNames>
          <attributesValues>
            <initialValue string="5.0">
              <MathML>
                <math xmlns="http://www.w3.org/1998/Math/MathML">
                  <cn type="real">
                    5.0
                  </cn>
                </math>
              </MathML>
            </initialValue>
          </attributesValues>
        </variable>
      </variablesList>
    </orderedVariables>
    <knownVariables dimension="2">
      <variablesList>
        <variable id="1" name="e" variability="parameter" direction="none" type="Real" fixed="false" flow="NonConnector" stream="NonStreamConnector">
          <classesNames>
            <element>
              BB.BouncingBall
            </element>
            <element>
              Real
            </element>
          </classesNames>
          <attributesValues>
            <initialValue string="0.9">
              <MathML>
                <math xmlns="http://www.w3.org/1998/Math/MathML">
                  <cn type="real">
                    0.9
                  </cn>
                </math>
              </MathML>
            </initialValue>
          </attributesValues>
        </variable>
        <variable id="2" name="b1.ay" variability="continuous" direction="none" type="Real" fixed="false" flow="NonConnector" stream="NonStreamConnector">
          <bindValueExpression>
            <bindExpression string="-9.8">
              <MathML>
                <math xmlns="http://www.w3.org/1998/Math/MathML">
                  <cn type="real">
                    -9.8
                  </cn>
                </math>
              </MathML>
            </bindExpression>
          </bindValueExpression>
          <classesNames>
            <element>
              BB.BouncingBall
            </element>
            <element>
              BB.Ball
            </element>
            <element>
              Real
            </element>
          </classesNames>
        </variable>
      </variablesList>
    </knownVariables>
  </variables>
  <equations dimension="3">
    <whenEquation id="1">
      bounce_time := time
      <MathML>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <equivalent/>
            <ci>
              bounce_time
            </ci>
            <ci>
              time
            </ci>
          </apply>
        </math>
      </MathML>
      <whenEquationCondition>
        b1.y &lt;= 0.0 and b1.vy &lt;= 0.0
        <MathML>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <and/>
              <apply>
                <leq/>
                <ci>
                  b1.y
                </ci>
                <cn type="real">
                  0.0
                </cn>
              </apply>
              <apply>
                <leq/>
                <ci>
                  b1.vy
                </ci>
                <cn type="real">
                  0.0
                </cn>
              </apply>
            </apply>
          </math>
        </MathML>
      </whenEquationCondition>
    </whenEquation>
    <equation id="2">
      der(b1.vy) = -9.8
      <MathML>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <equivalent/>
            <apply>
              <diff/>
              <ci>
                b1.vy
              </ci>
            </apply>
            <cn type="real">
              -9.8
            </cn>
          </apply>
        </math>
      </MathML>
    </equation>
    <equation id="3">
      der(b1.y) = b1.vy
      <MathML>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <equivalent/>
            <apply>
              <diff/>
              <ci>
                b1.y
              </ci>
            </apply>
            <ci>
              b1.vy
            </ci>
          </apply>
        </math>
      </MathML>
    </equation>
  </equations>
  <WhenClausesList dimension="1">
    <WhenClause index="1">
      <whenEquationCondition>
        b1.y &lt;= 0.0 and b1.vy &lt;= 0.0
        <MathML>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <and/>
              <apply>
                <leq/>
                <ci>
                  b1.y
                </ci>
                <cn type="real">
                  0.0
                </cn>
              </apply>
              <apply>
                <leq/>
                <ci>
                  b1.vy
                </ci>
                <cn type="real">
                  0.0
                </cn>
              </apply>
            </apply>
          </math>
        </MathML>
      </whenEquationCondition>
      <WhenOperatorsList dimension="1">
        <WhenOperator>
          reinit(b1.vy, (-e) * pre(b1.vy))
          <MathML>
            <math xmlns="http://www.w3.org/1998/Math/MathML">
              <apply>
                <reinit/>
                <ci>
                  b1.vy
                </ci>
                <apply>
                  <times/>
                  <apply>
                    <minus/>
                    <ci>
                      e
                    </ci>
                  </apply>
                  <apply>
                    <pre/>
                    <ci>
                      b1.vy
                    </ci>
                  </apply>
                </apply>
              </apply>
            </math>
          </MathML>
        </WhenOperator>
      </WhenOperatorsList>
    </WhenClause>
  </WhenClausesList>
  <zeroCrossingList dimension="3">
    <zeroCrossingElement string="b1.y &lt;= 0.0 and b1.vy &lt;= 0.0">
      <MathML>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <and/>
            <apply>
              <leq/>
              <ci>
                b1.y
              </ci>
              <cn type="real">
                0.0
              </cn>
            </apply>
            <apply>
              <leq/>
              <ci>
                b1.vy
              </ci>
              <cn type="real">
                0.0
              </cn>
            </apply>
          </apply>
        </math>
      </MathML>
      <involvedEquations>
        <equationId>
          1
        </equationId>
      </involvedEquations>
    </zeroCrossingElement>
    <zeroCrossingElement string="b1.y &lt;= 0.0">
      <MathML>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <leq/>
            <ci>
              b1.y
            </ci>
            <cn type="real">
              0.0
            </cn>
          </apply>
        </math>
      </MathML>
      <involvedWhenEquations>
        <whenEquationId>
          1
        </whenEquationId>
      </involvedWhenEquations>
    </zeroCrossingElement>
    <zeroCrossingElement string="b1.vy &lt;= 0.0">
      <MathML>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <leq/>
            <ci>
              b1.vy
            </ci>
            <cn type="real">
              0.0
            </cn>
          </apply>
        </math>
      </MathML>
      <involvedWhenEquations>
        <whenEquationId>
          1
        </whenEquationId>
      </involvedWhenEquations>
    </zeroCrossingElement>
  </zeroCrossingList>
  <functions>
  </functions>
</dae>
Note: See TracTickets for help on using tickets.