Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#2348 closed defect (fixed)

Duplicate modification error treated as warning

Reported by: Henrik Tidefelt Owned by: Adrian Pop
Priority: normal Milestone: 1.9.4
Component: Frontend Version: trunk
Keywords: Cc:

Description

The model below is inspired by problems with the MSL example Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMS_Start:

package DuplicateModification
  record A "Compare Modelica.Electrical.Machines.Losses.CoreParameters"
    parameter Integer x "m";
  end A;
  class B1 "Compare Modelica.Electrical.Machines.Utilities.ParameterRecords.AIM_SlipRingData"
    parameter A a(x = 1) "rotorCoreParameters";
  end B1;
  class B2 "Compare Modelica.Electrical.Machines.BasicMachines.AsynchronousInductionMachines.AIM_SlipRing"
    parameter A a(final x = 1) "rotorCoreParameters";
  end B2;
  class C "Compare Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMS_Start"
    B2 b(a = b0.a) "aims";
    parameter B1 b0 "aimsData";
  end C;
end DuplicateModification;

Checking the class C both gives an error and succeeds at the same time:

Check of DuplicateModification.C completed successfully.

[C:/Documents and Settings/henrikt/My Documents/Models/Bugs/DuplicateModification.mo:9:5-9:53:writable] Error: Variable b.a: Flera modifikationer av element final = (typed)1 DAE.PROP(Integer, C_CONST), value: 1 and = (typed)1 DAE.PROP(Integer, C_CONST), value: 1 i komponent x.

Class DuplicateModification.C has 0 equation(s) and 0 variable(s).
0 of these are trivial equation(s).

It is even possible to simulate the model, so the presence of the error message is very confusing.

Some additional details:

  1. Changing the class restriction of A to model removes the error message.
  2. As far as I can see, the error message is correct according to the language specification (3.3), page 71, 7.2.3 'Merging of Modifications':

Merging of modifiers means that outer modifiers override inner modifiers. The merging is hierarchical, and a value for an entire non-simple overrides value modifiers for all components, and it is an error if this overrides a final prefix for a component.

Change History (11)

comment:1 by Henrik Tidefelt, 11 years ago

See also: #2349

comment:2 by Adrian Pop, 11 years ago

This is a problem with mostly with record bindings.
Inst.makeRecordBinding is a bit wrong and tries to use modifications from all sources which generates this error (that is ignored). Should not be hard to be fix.

comment:3 by Peter Aronsson, 11 years ago

It would also be nice with a pretty printed error message for modifiers, without things like DAE.PROP(...). Something like, x = <value> of type <type>

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

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:5 by Adrian Pop, 11 years ago

Owner: changed from somebody to Adrian Pop
Status: newaccepted

I looked a bit into this but will take some time to fix it.

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

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

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

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:8 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:9 by Per Östlund, 9 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in 96a1c78.

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

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

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

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.