#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 , 10 years ago
comment:3 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:5 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The duplicate modification issue has been fixed in 96a1c78.
The same error shows up in MSL.
See https://test.openmodelica.org/libraries/MSL_3.2.1/BuildModelRecursive.html (r24619):