From b367aa61666455bff6c211cea01fdcfee456bcde Mon Sep 17 00:00:00 2001 From: fubari Date: Fri, 25 Oct 2024 17:19:59 +0200 Subject: [PATCH] Add initial_population variable to start value of population The population variable is protected and setting the start value only works when using the FixedPopulation initialization. When using InitializationOptions.SteadyState, the start value is not adjusted (as in the ThreeSpecies_Quiescent example, which does not find the correct solution for me using OpenModelica). With this change, all examples work for me. --- .../Components/LotkaVolterra/Components/RegionalPopulation.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ModelicaByExample/Components/LotkaVolterra/Components/RegionalPopulation.mo b/ModelicaByExample/Components/LotkaVolterra/Components/RegionalPopulation.mo index f85411bb..6f7be167 100644 --- a/ModelicaByExample/Components/LotkaVolterra/Components/RegionalPopulation.mo +++ b/ModelicaByExample/Components/LotkaVolterra/Components/RegionalPopulation.mo @@ -13,7 +13,7 @@ model RegionalPopulation "Population of animals in a specific region" annotation (Placement(transformation(extent={{-10,90},{10,110}}), iconTransformation(extent={{-10,90},{10,110}}))); protected - Real population(start=10) = species.population "Population in this region"; + Real population(start=initial_population) = species.population "Population in this region"; initial equation if init==InitializationOptions.FixedPopulation then population = initial_population;