﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2631	"""Duplicate modification"" errors with a Complex matrix"	tom short	probably noone	"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;
}}}"	defect	closed	high	1.9.4	Backend	trunk	fixed		
