Opened 11 years ago
Closed 11 years ago
#2789 closed defect (fixed)
Multiple modifiers error for stateSelect property
| Reported by: | Owned by: | Per Östlund | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: |
Description
When validating the following model
model BouncingBall "Simple model of a bouncing ball"
Ball ball1;
model Ball
Modelica.Mechanics.Translational.Components.SpringDamper springDamper1(c=250, d=0.6);
Modelica.Mechanics.Translational.Components.Mass mass1(m=m, s.start=startpos, s.stateSelect=StateSelect.always);
Modelica.Mechanics.Translational.Sources.Force force1;
Modelica.Blocks.Sources.Constant const(k=-m*g);
parameter Modelica.SIunits.Mass m=0.05 "Mass of the ball";
parameter Modelica.SIunits.Acceleration g=Modelica.Constants.g_n "Acceleration constant";
Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a1;
parameter Modelica.SIunits.Position startpos=2.5 "Start position for the ball";
parameter Modelica.SIunits.Diameter d=0.067 "Ball diameter";
equation
connect(springDamper1.flange_a,flange_a1);
connect(springDamper1.flange_b,mass1.flange_a);
connect(force1.flange,mass1.flange_a);
connect(const.y,force1.f);
end Ball;
Modelica.Mechanics.Translational.Components.Fixed fixed1;
Modelica.Mechanics.Translational.Components.ElastoGap elastoGap1(c=30000000000.0, d=100);
equation
connect(elastoGap1.flange_a,fixed1.flange);
connect(ball1.flange_a1,elastoGap1.flange_b);
end BouncingBall;
you get the following error message
Multiple modifiers in same scope for element ball1.mass1.s.stateSelect: stateSelect = stateSelect, from calling scope: ball1.mass1, duplicates are: ball1.mass1.s.stateSelect: stateSelect = StateSelect.always.
even though the modifiers are not in the same scope scope.
Change History (2)
comment:1 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
The issue seems to have been that submodifiers weren't merged correctly, since the issue boiled down to this:
model A Real x; end A; model B extends A(x(start = 0, nominal = 0)); end B; model C B b(x(start = 0), x(nominal = 0)); end C;
I adapted some modifier handling functionality from NFInst and replaced the old code with it to provide better error messages, which also resolved this issue. The fix is in r21996.
Note:
See TracTickets
for help on using tickets.

What is perhaps more surprising is that the elementName of this component is
L(which matches the line numbers in the error-message). I wonder if this is simply the two modifications onsnot being merged intos(start=..., stateSelect=...)and somehow break things.