diff --git a/doc/application/plot_metamodel.py b/doc/application/plot_metamodel.py index 8b91900..809eca8 100644 --- a/doc/application/plot_metamodel.py +++ b/doc/application/plot_metamodel.py @@ -69,7 +69,7 @@ # simulate the FMU. # The simulation inputs and outputs will be used to train the metamodel. -inputLaw = ot.Uniform(0.001, 0.01) +inputLaw = ot.Uniform(1.5, 2.5) inputSample = inputLaw.getSample(30) outputFMUSample = function(inputSample) @@ -205,7 +205,7 @@ def globalMetamodel(sample): ot.Show(graph) # %% -# As the epidemiological model considers a population size of 700, the residual +# As the epidemiological model considers a population size of 763, the residual # mean error on the field is acceptable. # %% diff --git a/doc/example/dynamic/plot_dyn_basics.py b/doc/example/dynamic/plot_dyn_basics.py index e761c6b..8403586 100644 --- a/doc/example/dynamic/plot_dyn_basics.py +++ b/doc/example/dynamic/plot_dyn_basics.py @@ -29,7 +29,7 @@ # Define the time grid for the FMU's output. The last value of the time grid, # here 10., will define the FMU stop time for simulation. -mesh = ot.RegularGrid(0.0, 0.1, 100) +mesh = ot.RegularGrid(0.0, 0.1, 2000) meshSample = mesh.getVertices() print(meshSample) @@ -47,7 +47,7 @@ inputs_fmu=["infection_rate"], outputs_fmu=["infected"], start_time=0.0, - final_time=10.0, + final_time=200.0, ) print(type(function)) @@ -61,7 +61,7 @@ # Simulate the function on an input :py:class:`openturns.Point` yields an output # :py:class:`openturns.Sample`, corresponding to the output evolution over time: -inputPoint = ot.Point([0.007]) +inputPoint = ot.Point([2.0]) outputSample = function(inputPoint) plt.xlabel("FMU simulation time (s)") @@ -73,7 +73,7 @@ # Simulate the function on a input :py:class:`openturns.Sample` yields a set of # fields called :py:class:`openturns.ProcessSample`: -inputSample = ot.Sample([[0.007], [0.005], [0.003]]) +inputSample = ot.Sample([[2.0], [2.25], [2.5]]) outputProcessSample = function(inputSample) print(outputProcessSample) diff --git a/doc/example/dynamic/plot_dyn_init.py b/doc/example/dynamic/plot_dyn_init.py index 515632b..e816988 100644 --- a/doc/example/dynamic/plot_dyn_init.py +++ b/doc/example/dynamic/plot_dyn_init.py @@ -42,7 +42,7 @@ temporary_file = "initialization.mos" with open(temporary_file, "w") as f: f.write("total_pop = 500;\n") - f.write("healing_rate = 0.02;\n") + f.write("healing_rate = 0.5;\n") # %% # If no initial value is provided for an input / parameter, it is set to its @@ -79,8 +79,8 @@ # function input variable ``infection_rate`` to propagate its uncertainty # through the model: -lawInfected = ot.Normal(0.01, 0.003) -inputSample = lawInfected.getSample(10) +law_infection_rate = ot.Normal(2.0, 0.25) +inputSample = law_infection_rate.getSample(10) outputProcessSample = function(inputSample) # %% diff --git a/doc/fmus/epid.rst b/doc/fmus/epid.rst index 27bcb55..825679b 100644 --- a/doc/fmus/epid.rst +++ b/doc/fmus/epid.rst @@ -25,8 +25,8 @@ time writes: .. math:: \begin{aligned} - \frac{\partial S}{\partial t}(t) &= - \beta S(t) I(t) \\ - \frac{\partial I}{\partial t}(t) &= \beta S(t) I(t) - \gamma I(t) \\ + \frac{\partial S}{\partial t}(t) &= - \frac{\beta}{N} S(t) I(t) \\ + \frac{\partial I}{\partial t}(t) &= \frac{\beta}{N} S(t) I(t) - \gamma I(t) \\ \frac{\partial R}{\partial t}(t) &= \gamma I(t) \end{aligned} @@ -36,25 +36,27 @@ This model is implemented in Modelica language. The default simulation time is 5 model epid - parameter Real total_pop = 700; + parameter Real total_pop = 763; + parameter Real infection_rate = 2.0; + parameter Real healing_rate = 0.5; + Real infected; Real susceptible; Real removed; - parameter Real infection_rate = 0.007; - parameter Real healing_rate = 0.02; - + initial equation infected = 1; removed = 0; total_pop = infected + susceptible + removed; - + equation - der(susceptible) = - infection_rate*infected*susceptible; - der(infected) = infection_rate*infected*susceptible - healing_rate*infected; - der(removed) = healing_rate*infected; - + der(susceptible) = - infection_rate * infected * susceptible / total_pop; + der(infected) = infection_rate * infected * susceptible / total_pop - + healing_rate * infected; + der(removed) = healing_rate * infected; + annotation( - experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-6, Interval = 0.1)); + experiment(StartTime = 0.0, StopTime = 200.0, Tolerance = 1e-6, Interval = 0.1)); end epid; We focus on the effect of the ``infection_rate`` and ``healing_rate`` on the evolution of the ``infected`` category. diff --git a/otfmi/example/file/epid.mo b/otfmi/example/file/epid.mo index 270f380..d52ed3d 100644 --- a/otfmi/example/file/epid.mo +++ b/otfmi/example/file/epid.mo @@ -1,24 +1,24 @@ model epid -parameter Real total_pop = 700; +parameter Real total_pop = 763; +parameter Real infection_rate = 2.0; +parameter Real healing_rate = 0.5; Real infected; Real susceptible; Real removed; -parameter Real infection_rate = 0.007; -parameter Real healing_rate = 0.02; - initial equation infected = 1; removed = 0; total_pop = infected + susceptible + removed; equation -der(susceptible) = - infection_rate*infected*susceptible; -der(infected) = infection_rate*infected*susceptible - healing_rate*infected; -der(removed) = healing_rate*infected; +der(susceptible) = - infection_rate * infected * susceptible / total_pop; +der(infected) = infection_rate * infected * susceptible / total_pop - + healing_rate * infected; +der(removed) = healing_rate * infected; annotation( - experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-6, Interval = 0.1)); + experiment(StartTime = 0.0, StopTime = 200.0, Tolerance = 1e-6, Interval = 0.1)); end epid; \ No newline at end of file