Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#3159 closed defect (fixed)

Duplicate modification error

Reported by: Rüdiger Franke Owned by: somebody
Priority: high Milestone: 1.9.4
Component: Frontend Version: trunk
Keywords: Cc:

Description

Currently 25 of 104 models from the PowerSystems library fail to translate (r24582). 20 of them raise translation errors for the parameterization of models with data records. Typically they fail if they use the records in functions that set up internal data, e.g.:

PowerSystems.Examples.Spot.DrivesAC3ph.SM_ctrlAv

Some more examples raise the same translation error but simulate successfully afterwards. e.g.:

PowerSystems.Examples.Spot.DrivesDC.DCmotor_ser

The following example summerizes the used pattern:

package DuplicateModification
  record R1
    Real v = 1;
  end R1;

  record R2
    extends R1(v = 2);
    Real w = 0.2;
  end R2;

  record R3
    extends R2(v = 3, w = 0.3);
  end R3;

  model A
    replaceable parameter R1 r;
  end A;

  model B
    extends A(redeclare replaceable parameter R2 r);
  end B;

  model Test
    parameter R3 r;
    B b(r=r);
  end Test;
end DuplicateModification;

The following error is raised for DuplicateModification.Test:

[1] Translation Error
Duplicate modification of element =(untyped) 2 and = (typed)3.0 DAE.PROP(Real, C_CONST), value: 3.0 on component v.

[2] Translation Error
[/home/user/work/DuplicateModification.mo: 16:5-16:31]: Variable b.r: Duplicate modification of element =(untyped) 2 and = (typed)3.0 DAE.PROP(Real, C_CONST), value: 3.0 on component v.

Note: You might find it strange to first redeclare a record in model B and then modify it in model Test. The advantage of the modification is that it requires less GUI support -- see e.g. PowerSystems.Examples.Spot.DrivesAC3ph.ASMcharacteristic -- the machine parameters asyn400_30k can be edited in the GUI. The more general pattern of replaceable classes used by Fluid and already working with omc should be introduced into the PowerSystems library once OMEdit will support it.

Change History (7)

comment:1 by Rüdiger Franke, 10 years ago

The same error shows up in MSL.

See https://test.openmodelica.org/libraries/MSL_3.2.1/BuildModelRecursive.html (r24619):

Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.AIMS_Start
Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.AIMS_Start_MultiPhase
Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SMR_Inverter
Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SMR_Inverter_MultiPhase

comment:2 by Rüdiger Franke, 10 years ago

The same applies to examples from Modelica.Electrical.Machines.

comment:3 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:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:5 by Per Östlund, 9 years ago

Resolution: fixed
Status: newclosed

The duplicate modification issue has been fixed in 96a1c78.

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

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:7 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.