lbl-srg / modelica-buildings

Modelica Buildings library
251 stars 156 forks source link

Templates • Improve support of heat pump plant template by Modelica tools #3759

Open AntoineGautier opened 6 months ago

AntoineGautier commented 6 months ago

The purpose of this ticket is to investigate issues observed during translation, initialization or simulation with the heat pump plant template Templates.Plants.HeatPumps.AirToWater and its components.

AntoineGautier commented 5 months ago

Templates.Plants.Controls.HeatPumps.Validation.AirToWater with OCT

Simulating the model with OCT gives the following statistics.

 Number of steps                                 : 274844
 Number of function evaluations                  : 759416
****** Number of Jacobian evaluations                  : 168509
 Number of function eval. due to Jacobian eval.  : 0
 Number of error test failures                   : 531
 Number of nonlinear iterations                  : 757470
 Number of nonlinear convergence failures        : 83962
 Number of state function evaluations            : 276151
 Number of state events                          : 124
 Number of time events                           : 365

Solver options:

 Solver                   : CVode
 Linear multistep method  : BDF
 Nonlinear solver         : Newton
 Linear solver type       : DENSE
 Maximal order            : 5
 Tolerances (absolute)    : 1e-08
 Tolerances (relative)    : 1e-08

Simulation interval    : 0.0 - 86400.0 seconds.
****** Elapsed simulation time: 61.745942472000024 seconds.

Simulating the same model with Dymola gives the following statistics.

Integration terminated successfully at T = 86400
******   CPU-time for integration                  : 0.481699 seconds
   CPU-time for initialization               : 0.0383539 seconds
   Number of result points                   : 1437
   Number of grid points                     : 501
   Number of accepted steps                  : 9767
   Number of rejected steps                  : 483
   Number of f-evaluations (dynamics)        : 14418
   Number of non-linear iteration            : 13094
   Number of non-linear convergence failures : 0
******   Number of Jacobian-evaluations            : 381
   Number of crossing function evaluations   : 11225
   Number of model time events               : 379
   Number of state events                    : 91
   Number of step events                     : 0
   Maximum integration order                 : 5

The overhead is due to the Python dependencies.

AntoineGautier commented 4 months ago

Templates.Plants.Controls.HeatPumps.Validation.AirToWater with Dymola

Primary-only configurations exhibit non-linear solver failures. In most configurations, the tool recovers from these failures and the simulation succeeds. Only one configuration results in simulation failing:

pla(
    typDis_select1=Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1Only,
    typArrPumPri=Buildings.Templates.Components.Types.PumpArrangement.Dedicated,
    have_pumChiWatPriDed_select=false,
    linearized=false

The simulation fails with both DASSL and CVODE. Linearizing the flow/∆p equations in the valve components solves the issue. However, since the HP flow resistance is lumped with the isolation valve, there is an impact on the pump head and pump power.