Opened 13 years ago

Last modified 13 years ago

#1661 closed defect (fixed)

model containing integer step fails with internal error

Reported by: peterjunglas Owned by: peterjunglas
Priority: high Milestone:
Component: Backend Version: trunk
Keywords: Cc: peterjunglas, Frenkel TUD

Description

The attached model schaltint (using GearWithExternalRatioI) fails with an internal error.

After replacing the IntegerStep by a real Step and the IntegerInput in the submodel by a RealInput, the models works.

Attachments (2)

GearWithExternalRatioI.mo (1.6 KB) - added by peterjunglas 13 years ago.
schaltint.mo (1.7 KB) - added by peterjunglas 13 years ago.

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by peterjunglas

comment:1 Changed 13 years ago by sjoelund.se

Adding a complete, working version (previous one was incomplete):

{{{model GearWithExternalRatioI

Modelica.Mechanics.Rotational.Interfaces.Flange_a fla

annotation (Placement(transformation(

extent = {{-110, -10},{-90, 10}},rotation = 0)));

Modelica.Mechanics.Rotational.Interfaces.Flange_a flb

annotation (Placement(transformation(

extent = {{90, -10},{110, 10}},rotation = 0)));

Modelica.Blocks.Interfaces.IntegerInput ratio

annotation (Placement(transformation(
extent = {{-10, 90},{10, 110}},rotation = -90)));

equation

fla.tau = -flb.tau / ratio;
fla.phi = ratio * flb.phi;

end GearWithExternalRatioI;

model schaltint

Modelica.Mechanics.Rotational.Components.Inertia inertia2(J = 0.1) annotation(Placement(visible = true, transformation(origin = {-13.0473,11.5561}, extent = {{-12,-12},{12,12}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Inertia inertia3(J = 100) annotation(Placement(visible = true, transformation(origin = {55.544,12.6745}, extent = {{-12,-12},{12,12}}, rotation = 0)));
annotation(experiment(StartTime = 0.0, StopTime = 10.0, Tolerance = 1e-06));
GearWithExternalRatioI gearwithexternalratioi1 annotation(Placement(visible = true, transformation(origin = {23.4769,11.8871}, extent = {{-12,-12},{12,12}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerStep integerstep1(height = -2, offset = 4, startTime = 5) annotation(Placement(visible = true, transformation(origin = {23.477,49.3314}, extent = {{-12,12},{12,-12}}, rotation = -90)));
Modelica.Mechanics.Rotational.Sources.ConstantTorque constanttorque1(tau_constant = 150) annotation(Placement(visible = true, transformation(origin = {-55.5721,12.4814}, extent = {{-12,-12},{12,12}}, rotation = 0)));

equation

connect(constanttorque1.flange,inertia2.flange_a) annotation(Line(points = {{-43.5721,12.4814},{-24.9629,12.4814},{-24.9629,11.5561},{-25.0473,11.5561}}));
connect(integerstep1.y,gearwithexternalratioi1.ratio) annotation(Line(points = {{23.477,36.1314},{23.7741,36.1314},{23.7741,23.8871},{23.4769,23.8871}}));
connect(gearwithexternalratioi1.flb,inertia3.flange_a) annotation(Line(points = {{35.4769,11.8871},{43.3878,11.8871},{43.3878,12.6745},{43.544,12.6745}}));
connect(inertia2.flange_b,gearwithexternalratioi1.fla) annotation(Line(points = {{-1.0473,11.5561},{10.6984,11.5561},{10.6984,11.8871},{11.4769,11.8871}}));

end schaltint;}}}

Flattening succeeds; but
Error: Internal error BackendDAETransform.selectDummyState: no state to select
And
[/home/marsj/dev/trunk/build/lib/omlibrary/Modelica 3.1/Blocks/Sources.mo:3027:5-3027:58:writable] Error: Model is structurally singular, error found sorting equations 0.0 = 0.0;

comment:2 Changed 13 years ago by Frenkel TUD

using flags +d=bltdump generates the following plot:

High index problem, differentiated equation:
integerstep1.y = integerstep1.offset + (if time < integerstep1.startTime then 0 else integerstep1.height)
to
0.0 = 0.0
High index problem, differentiated equation:
inertia2.phi = Real(integerstep1.y) * inertia3.phi
to
der(inertia2.phi) = Real(integerstep1.y) * der(inertia3.phi)
High index problem, differentiated equation:
0.0 = 0.0
to
0.0 = 0.0

The problem is omc tries to add a derivative of a discrete variable although the derivative of integerstep1.y is not necessary. The matching algorithm fails thereafter because no equation for der(integerstep1.y) is present.

Note: See TracTickets for help on using tickets.