#3467 closed defect (fixed)
Problems with type redeclaration in complex numbers
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.4 |
Component: | Frontend | Version: | |
Keywords: | Cc: | andrea.bartolini@… |
Description
Please consider the following code fragment
package TestComplex package Types operator record ComplexVoltage = Complex(redeclare Modelica.SIunits.Voltage re, redeclare Modelica.SIunits.Voltage im); operator record ComplexCurrent = Complex(redeclare Modelica.SIunits.Current re, redeclare Modelica.SIunits.Current im); operator record Impedance = Complex(redeclare Modelica.SIunits.Resistance re, redeclare Modelica.SIunits.Resistance im); end Types; package Test model A import SI = Modelica.SIunits; parameter SI.Resistance R = 1; parameter SI.Reactance X = 1; parameter Types.Impedance Z = Complex(R, X); Types.ComplexCurrent I = Complex(1, 0); Types.ComplexVoltage V = Z * I; end A; end Test; annotation(uses(Complex(version = "3.2.1"), Modelica(version = "3.2.1"))); end TestComplex;
When compiling this, the current nightly complains that:
[1] 02:36:24 Translation Error [TestComplex: 21:7-21:45]: Variable I: Duplicate modification of element (redeclare .Modelica.SIunits.Current re) and = (typed)1.0 DAE.PROP(Real, C_CONST), value: 1.0 on component re. [2] 02:36:24 Translation Error [TestComplex: 21:7-21:45]: Variable I: Duplicate modification of element (redeclare .Modelica.SIunits.Current im) and = (typed)0.0 DAE.PROP(Real, C_CONST), value: 0.0 on component im.
plus other similar errors, but then it happily proceeds and produces correct results.
- What do these error messages mean?
- Why is correct simulation code produced after an error (not a warning)?
Change History (5)
comment:1 by , 9 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 9 years ago
Owner: | changed from | to
---|
Note:
See TracTickets
for help on using tickets.
I can take a look at this, I think I know what the issue is.