Simulation
SetterObject
Base class handling the updating of attributes of parameters and variables.
set_initial_values(initial_values)
Set initial values.
Initial values must be int
or float
instances only.
PARAMETER | DESCRIPTION |
---|---|
initial_values
|
a dictionary of
TYPE:
|
Source code in psymple/simulate/simulation.py
set_parameters(parameter_values={})
Set input parameters.
Parameter values must be constant, or functions of system variable time
and/or existing system
parameters.
PARAMETER | DESCRIPTION |
---|---|
parameter_values
|
a dictionary of
TYPE:
|
RAISES | DESCRIPTION |
---|---|
TypeError
|
if a value which is not of type |
ParsingError
|
if the value expression contains forbidden symbols. |
TypeError
|
if the parameter is fixed and cannot be updated. |
Source code in psymple/simulate/simulation.py
Simulation(system, solver='continuous', initial_values={}, input_parameters={})
Bases: SetterObject
A Simulation is a basic object which produces a simulable system which is passed to a solver.
Information:
The simulation capability of psymple
is fairly rudimentary. These features are currently
designed to exemplify the functionality of the rest of the package.
PARAMETER | DESCRIPTION |
---|---|
system
|
the system to simulate
TYPE:
|
solver
|
solver type
TYPE:
|
initial_values
|
initial values
TYPE:
|
input_parameters
|
input_parameters
TYPE:
|
Source code in psymple/simulate/simulation.py
plot_solution(variables=None, t_range=None)
Produce a simple solution plot of time against a selection of variables.
PARAMETER | DESCRIPTION |
---|---|
variables
|
a
TYPE:
|
t_range
|
a list of the form
TYPE:
|
Source code in psymple/simulate/simulation.py
simulate(t_end, print_solve_time=False, **options)
Simulate a system by calling the instance of Solver
specified by self.solver
. Currently,
this is either a discrete (Euler forward) integrator, or a a continuosu integrator implemented
as a call to scipy.integrate.solve_ivp
.
PARAMETER | DESCRIPTION |
---|---|
t_end
|
when to terminate the simulation. Currently this must be a positive integer.
TYPE:
|
print_solve_time
|
if
TYPE:
|
**options
|
options to pass to the
DEFAULT:
|