﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5017	Issue with package constants, start attribute sizes and inheritance in the NF	Francesco Casella	Per Östlund	"Please check [https://libraries.openmodelica.org/branches/newInst/ThermoPower/files/ThermoPower_ThermoPower.Test.GasComponents.TestCC.err ThermoPower.Test.GasComponents.TestCC.err]. The following error is reported:
{{{
[ThermoPower 3.1/Gas.mo:2834:12-2834:39:writable] Notification: From here:
[OMCompiler/build/lib/omlibrary/Modelica 3.2.2/Media/package.mo:4478:7-4479:50:writable]
Error: Type mismatch in binding 
start = CombustionChamber1.Xstart[1:5],
expected subtype of Real[4], got type Real[5].
}}}
The offending code in Gas.mo reads
{{{
Exhaust.BaseProperties fluegas(
   p(start=pstart),
   T(start=Tstart),
   Xi(start=Xstart[1:Exhaust.nXi]));
}}}
The {{{Exhaust}}} medium package is defined as
{{{
package FlueGas ""flue gas""
  extends Modelica.Media.IdealGases.Common.MixtureGasNasa(
    mediumName=""FlueGas"",
    data={Modelica.Media.IdealGases.Common.SingleGasesData.O2,
          Modelica.Media.IdealGases.Common.SingleGasesData.Ar,
          Modelica.Media.IdealGases.Common.SingleGasesData.H2O,
          Modelica.Media.IdealGases.Common.SingleGasesData.CO2,
          Modelica.Media.IdealGases.Common.SingleGasesData.N2},
    fluidConstants={
          Modelica.Media.IdealGases.Common.FluidData.O2,
          Modelica.Media.IdealGases.Common.FluidData.Ar,
          Modelica.Media.IdealGases.Common.FluidData.H2O,
          Modelica.Media.IdealGases.Common.FluidData.CO2,
          Modelica.Media.IdealGases.Common.FluidData.N2},
    substanceNames={""Oxygen"",""Argon"",""Water"",""Carbondioxide"",""Nitrogen""},
    reference_X={0.23,0.02,0.01,0.04,0.7},
    referenceChoice=Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.ZeroAt25C);
end FlueGas;
}}}
In turn, {{{MixtureGasNasa}}}
{{{
extends Modelica.Media.Interfaces.PartialMixtureMedium(
     reducedX = false,
     ...
}}}
and {{{PartialMixtureMedium}}} ultimately exends PartialMedium, which contains
{{{
partial package PartialMedium
  constant Boolean reducedX=true;
  constant Integer nXi=if fixedX then 0 
                   else if reducedX then nS - 1 else nS;
  replaceable partial model BaseProperties
    InputMassFraction[nXi] Xi(start=reference_X[1:nXi])
    ...
  end BaseProperties;
  ...
}}}
Summing up, the Exhaust medium package has {{{reducedX = false}}}, hence {{{nXi = nX = 5}}}; hence the dimension of the start attributee of {{{CombustionChamber1.fluegas.Xi[nXi]}}},which instantiates {{{Exhaust.BaseProperties}}} should be 5, not 4."	defect	closed	high	2.0.0	New Instantiation		fixed		
