Parsing input system
StructuralIdentifiability.@ODEmodel
— Macromacro ODEmodel
Macro for creating an ODE from a list of equations. It also injects all variables into the global scope.
Example
Creating a simple ODE
:
using StructuralIdentifiability
ode = @ODEmodel(
x1'(t) = a * x1(t) + u(t),
x2'(t) = b * x2(t) + c*x1(t)*x2(t),
y(t) = x1(t)
)
Here,
x1
,x2
are state variablesy
is an output variableu
is an input variablea
,b
,c
are time-independent parameters
StructuralIdentifiability.ODE
— TypeThe main structure that represents input ODE system.
Stores information about states (x_vars
), outputs (y_vars
), inputs (u_vars
), parameters (parameters
) and the equations.
This structure is constructed via @ODEmodel
macro.
StructuralIdentifiability.set_parameter_values
— Functionset_parameter_values(ode, param_values)
Input:
ode
- an ODE as aboveparam_values
- values for (possibly, some of) the parameters as dictionaryparameter
=>value
Output:
- new ode with the parameters in param_values plugged with the given numbers
Create Compartmental Model
StructuralIdentifiability.linear_compartment_model
— Functionlinear_compartment_model(graph; inputs = [], outputs = [], leaks = [])
Input: defines a linear compartment model with nodes numbered from 1 to n
by
graph
- and array of integer arrays representing the adjacency lists of the graphinputs
- array of input nodesoutputs
- array of output nodesleaks
- array of sink nodes
Output:
- the corresponding ODE system in a standard notation (as, e.g., in this paper)
Example: Consider a bidirected cycle with four nodes. Its adjacency list can be written as follows:
[ [2, 4], [1, 3], [2, 4], [1, 3] ]
In the list above, the i
-th element is a list of vertices to which there exists an edge from the vertex i
. Now we can create a linear compartment model over this graph with the output at vertex 1, input at vertex 2, and leaks at vertices 3 and 4 as follows:
julia> ode = linear_compartment_model([[2, 4], [1, 3], [2, 4], [1, 3]], outputs = [1], inputs = [2], leaks = [2, 3])
x1' = -x1*a_2_1 - x1*a_4_1 + x2*a_1_2 + x4*a_1_4
x3' = x2*a_3_2 - x3*a_2_3 - x3*a_4_3 - x3*a_0_3 + x4*a_3_4
x2' = x1*a_2_1 - x2*a_1_2 - x2*a_3_2 - x2*a_0_2 + x3*a_2_3 + u2
x4' = x1*a_4_1 + x3*a_4_3 - x4*a_1_4 - x4*a_3_4
y1 = x1
Discrete-time systems
StructuralIdentifiability.@DDSmodel
— Macromacro DDSmodel
Macro for creating a DDS (discrete dynamical system) from a list of equations. It also injects all variables into the global scope.
Example
Creating a simple DDS
:
using StructuralIdentifiability
dds = @DDSmodel(
x1(t + 1) = a * x1(t) + u(t),
x2(t + 1) = b * x2(t) + c*x1(t)*x2(t),
y(t) = x1(t)
)
Here,
x1
,x2
are state variablesy
is an output variableu
is an input variablea
,b
,c
are time-independent parameters