4

I am receiving the following warning message from Dymola when simulating a fairly complex steady-state model for simulating a multi-circuit refrigerant system.

The following variables are iteration variables of the initialization problem: initChillerCircuit2.InitCycleArray[20]

but they are not given any explicit start values. Zero will be used.

I am looking for assistance in proper syntax to set a start value for this variable because the value is returned from a function (Init_ChillerCircuit) into a parameter array (InitCycleArray).

  final parameter Real InitCycleArray[:]=Init_ChillerCircuit(
  vleInitRecord,
  liquidSelector,
  specifiedLiquidTIn,
  specifiedLiquidTOut,
  specifiedLiquidVdot,
  liquidTInIsSpecified,
  liquidTOutIsSpecified,
  liquidVdotIsSpecified,
  specifiedGasTIn,
  estimatedGasVdot,
  liquidHXEffectiveness,
  gasHXEffectiveness,
  subcoolerEffectiveness,
  suctionPressureLoss,
  suctionSuperheat,
  dischargePressureLoss,
  isentropicEfficiency,
  specifiedCapacity,
  isCooling);

I am unclear of how to set the start value for a single element in the array, if it is possible at all. I am hoping for something like the line below, but the syntax is not correct.

final parameter Real InitCycleArray[:](start[20] = 1) = Init_ChillerCircuit(...);

The best that I can come up with is to assign start values for all output results, but this is problematic in my scenario.

final parameter Real InitCycleArray[:](start = {if i==20 then 1 else 0 for i in 1:33})=Init_ChillerCircuit(...);

The syntax above, which assigns all start values, compiles ok but assigning appropriate start values for each element in the output array is difficult.

Any suggestions are appreciated!

Justin Kauffman
  • 423
  • 3
  • 10
  • if the initial value of InitCycleArray[20] can be fixed without over-constraining your equation system, you can add an "initial equation" section of your code with "InitCycleArray[20] = initial_value" – Rene Just Nielsen Mar 14 '18 at 10:18
  • Unfortunately it cannot be fixed. The value results from an iterative calculation so it is not known directly a priori, and is used as a start value for non-linear solution at time t=0. – Justin Kauffman Mar 14 '18 at 12:37
  • Can't you use `final parameter Real InitCycleArray(start = Init_ChillerCircuit(…));` I guess this should give you the best possible start values as it seems like the function is created for that. Still I am a bit confused, that the start value of a parameter is part of an iteration. – Markus A. Nov 13 '18 at 20:26

1 Answers1

0

I woud add new parameter with start values

final parameter Real InitCycleArray[:](start = InitCycleArray_start) = Init_ChillerCircuit(...);

protected
constant Real[size(InitCycleArray)] InitCycleArray_start(each fixed=false);

initial equation
  for i in 1:19 loop
   InitCycleArray_start[i] = 0.0;
  end for;

   InitCycleArray_start[20] = 1.0;

  for 21:size(InitCycleArray) loop
   InitCycleArray_start[i] = 0.0;
  end for;
Vital
  • 41
  • 3