Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

#2631 closed defect (fixed)

"Duplicate modification" errors with a Complex matrix

Reported by: tshort@… Owned by: probably noone
Priority: high Milestone: 1.9.4
Component: Backend Version: trunk
Keywords: Cc:

Description

The following model uses a matrix of Complex numbers. It simulates correctly, despite many error messages. In a larger model, I get lots of similar error messages (plus many "internal errors"), but the model will not simulate.

This is with SVN r19645.

This model checks out without errors in Dymola.

model testcomplex
  function zmat
    input Modelica.SIunits.Resistance R1 "Positive-sequence resistance";
    input Modelica.SIunits.Resistance X1 "Positive-sequence reactance";
    input Modelica.SIunits.Resistance R0 "Zero-sequence resistance";
    input Modelica.SIunits.Resistance X0 "Zero-sequence reactance";
    output Modelica.SIunits.ComplexImpedance Z[3,3] "Impedance matrix";
  algorithm
    for i in 1:3 loop
      Z[i,i] := (Complex(R0, X0) + 2.0 * Complex(R1, X1)) / 3.0;
      for j in 1:3 loop
        if not i == j then 
          Z[i,j] := (Complex(R0, X0) - Complex(R1, X1)) / 3.0;
        end if;
      end for;
    end for;
  end zmat;
  parameter Modelica.SIunits.ComplexImpedance Z[3,3] = zmat(1.0, 2.0, 3.0, 4.0) "Impedance matrix";
end testcomplex;

Here are the error messages from buildModel as well as the results from the run.

"[/home/tshort/Dropbox/active/tmp/testcomplex.mo:2:3-18:11:writable] Warning: Z.re was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.
[/home/tshort/Dropbox/active/tmp/testcomplex.mo:2:3-18:11:writable] Warning: Z.im was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.
[/home/tshort/Dropbox/active/tmp/testcomplex.mo:2:3-18:11:writable] Warning: Z.re was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.
[/home/tshort/Dropbox/active/tmp/testcomplex.mo:2:3-18:11:writable] Warning: Z.im was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.
[/home/tshort/Dropbox/active/tmp/testcomplex.mo:19:3-19:99:writable] Error: Variable Z: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)1.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 1.666666666666667 on component re.
[/home/tshort/Dropbox/active/tmp/testcomplex.mo:19:3-19:99:writable] Error: Variable Z: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)2.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 2.666666666666667 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)1.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 1.666666666666667 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)2.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 2.666666666666667 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)1.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 1.666666666666667 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)2.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 2.666666666666667 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)1.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 1.666666666666667 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)2.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 2.666666666666667 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)0.6666666666666666 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 0.6666666666666666 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)1.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 1.666666666666667 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)2.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 2.666666666666667 on component im.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Resistance re) and  = (typed)1.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 1.666666666666667 on component re.
Error: Duplicate modification of element (redeclare .Modelica.SIunits.Reactance im) and  = (typed)2.666666666666667 DAE.PROP(Real(quantity = "Resistance", unit = "Ohm"), C_CONST), value: 2.666666666666667 on component im.
"
record SimulationResult
    resultFile = "/home/tshort/Dropbox/active/tmp/testcomplex_res.csv",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testcomplex', options = '', outputFormat = 'csv', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "",
    timeFrontend = 0.609220616,
    timeBackend = 0.012112431,
    timeSimCode = 0.007707682,
    timeTemplates = 0.122331168,
    timeCompile = 1.465207188,
    timeSimulation = 0.033957383,
    timeTotal = 2.252110411
end SimulationResult;

Change History (7)

comment:1 Changed 11 years ago by adrpo

Yeah, the errors are just false positives. The model should work anyway.
Can you send me the bigger model via email? Because I think it has another problem than this.

comment:2 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.1 to 1.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:3 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.2 to 1.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:4 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.3 to 1.9.4

Moved to new milestone 1.9.4

comment:5 Changed 9 years ago by perost

  • Resolution set to fixed
  • Status changed from new to closed

The duplicate modification errors were fixed in 96a1c78, and the model now instantiate and simulates without any errors. If you still have issues with your larger models, please open a new ticket.

comment:6 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.4-1.9.x

Milestone renamed

comment:7 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4-1.9.x to 1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.