Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreeSpecies_Quiescent: set initial_population parameter as start value of population #471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fubari
Copy link

@fubari fubari commented Oct 28, 2024

The ThreeSpecies_Quiescent example seems to be broken using OpenModelica v1.24.0-dev-164-g537f41ed82, probably due to the changes to the Protected section of models in Modelica, see #453. This PR suggests a solution by adjusting the start value.

The population variable is protected and setting the start value only works when using the FixedPopulation initialization, then it is set using:

if init==InitializationOptions.FixedPopulation then
population = initial_population;

When using InitializationOptions.SteadyState, the start value is not adjusted and the trivial solution is found instead of the non-zero solution.

Only the derivative is adjusted:

elseif init==InitializationOptions.SteadyState then
der(population) = 0;

And for the start guess, the following line is still used:

Real population(start=10) = species.population "Population in this region";

With the following change, all examples seem to work correctly for me:

Real population(start=initial_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.
@fubari fubari changed the title Add initial_population variable to start value of population ThreeSpecies_Quiescent Add initial_population variable to start value of population Oct 28, 2024
@fubari fubari changed the title ThreeSpecies_Quiescent Add initial_population variable to start value of population ThreeSpecies_Quiescent Set initial_population parameter as start value of population Oct 28, 2024
@fubari fubari changed the title ThreeSpecies_Quiescent Set initial_population parameter as start value of population ThreeSpecies_Quiescent: set initial_population parameter as start value of population Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant