This page contains the Jmi Module documentation.
Module containing the JMI interface Python wrappers.
Bases: object
A JMI Model loaded from a binary file.
Evaluates the DAE residual.
Parameters:
res --
DAE residual vector. (Return variable)
Evaluate the DAE event indicators.
Parameters:
res --
DAE residual vector. (Return variable)
Evaluate the Jacobian of the DAE residual function.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Get the number of columns and non-zero elements in the Jacobian of the DAE residual.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full DAE residual Jacobian.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero Jacobian entries.
Get the row and column indices of the non-zero elements in the DAE residual Jacobian.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the DAE residual Jacobian.
(Return variable)
col --
Column indices of the non-zeros in the DAE residual Jacobian.
(Return variable)
Compare the evaluated CAD derivative with the FD evaluation
Compare the result with different jacobian formats: JMI_DER_SPARSE, JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars –
Indicates which columns of the full Jacobian should be evaluated (for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns or:ed (|) together. Using a list is prefered as it is more Pythonesque.
Evaluate the directional derivative of the DAE residual function.
The directional derivative is defined as
dF = dF/dz * dz
where dF/dz is the Jacobian of the residual function F, dF is the directional derivative and dz is the seed vector.
- eval_alg –
- JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD. JMI_DER_CAD to evaluate the Jacobian using CAD JMI_DER_FD to evaluate using finite differences
Get the number of equations of the DAE.
Returns:
The number of equations of the DAE.
Get the boolean dependent constants vector.
Returns:
A reference to the boolean dependent constants vector.
Get the boolean independent constants vector.
Returns:
A reference to the boolean independent constants vector.
Get the boolean variable vector.
Returns:
A reference to the boolean variables vector.
Get the boolean dependent parameters vector.
Returns:
A reference to the boolean dependent parameters vector.
Get the boolean independent parameters vector.
Returns:
A reference to the boolean independent parameters vector.
Get the boolean input vector.
Returns:
A reference to the boolean input variables vector.
Get the integer dependent constants vector.
Returns:
A reference to the integer dependent constants vector.
Get the integer independent constants vector.
Returns:
A reference to the integer independent constants vector.
Get the integer variable vector.
Returns:
A reference to the integer variables vector.
Get the integer dependent parameters vector.
Returns:
A reference to the integer dependent parameters vector.
Get the integer independent parameters vector.
Returns:
A reference to the integer independent parameters vector.
Get the integer input vector.
Returns:
A reference to the integer input variables vector.
Get the number of time points in the model.
Parameters:
n_tp --
The number of time points (return variable).
Get the offsets for the variable types in the z vector.
Parameters:
The offsets for all varibles in the z vector (return variables).
Get the value references of the outputs.
Parameters:
output_vrefs --
A list of value references for the outputs (Output variable).
Get the real dependent constants vector.
Returns:
A reference to the real dependent constants vector.
Get the real independent constants vector.
Returns:
A reference to the real independent constants vector.
Get the real discrete variable vector.
Returns:
A reference to the real discrete variables vector.
Get the real derivatives vector.
Returns:
A reference to the real derivatives vector.
Get the real derivatives variables vector corresponding to the i:th time point.
Parameters:
i --
The time point.
Returns:
A reference to the real derivatives variables vector for time point
i.
Get the real dependent parameters vector.
Returns:
A reference to the real dependent parameters vector.
Get the real independent parameters vector.
Returns:
A reference to the real independent parameters vector.
Get the real inputs vector.
Returns:
A reference to the real inputs variables vector.
Get the real inputs vector corresponding to the i:th time point.
Parameters:
i --
The time point.
Returns:
A reference to the real inputs variables vector for time point i.
Get the real algebraic variables vector.
Returns:
A reference to the real algebraic variables vector.
Get the real algebraic variables vector corresponding to the i:th time point.
Parameters:
i --
The time point.
Returns:
A reference to the real algebraic variables vector for time point i.
Get the real differentiated variables vector.
Returns:
A reference to the real differentiated variables vector.
Get the real differentiated variables vector corresponding to the i:th time point.
Parameters:
i --
The time point.
Returns:
A reference to the real differentiated variables vector for time
point i.
Get the scaling method. Valid values are JMI_SCALING_NONE and JMI_SCALING_VARIABLES.
Returns:
The scaling method currently used.
Get the sizes of the variable vectors.
Parameters:
The sizes of the variable vectors (return variables).
Get the switching function vector of the DAE. A switch value of 1 corresponds to true and 0 corresponds to false.
Returns:
A reference to the switch function vector of the DAE.
Get the switching function vector of the DAE initialization system. A switch value of 1 corresponds to true and 0 corresponds to false.
Returns:
A reference to the switch function vector of the DAE initialization.
Get the vector of time points.
Parameters:
The vector of time points (return variable).
Get the variable scaling factor vector.
Returns:
A reference to the variable scaling factor vector.
Get the vector containing all parameters, variables and point-wise evalutated variables vector.
Returns:
A reference to the z-vector.
Evaluate the F0 residual function of the initialization system.
Parameters:
res --
The residual of F0. (Return variable)
Evaluate the F1 residual function of the initialization system.
Parameters:
res --
The residual of F1. (Return variable)
Evaluate the Fp residual function of the initialization system.
Parameters:
res --
The residual of Fp. (Return variable)
Evaluate the DAE initialization event indicators.
Parameters:
res --
DAE residual vector. (Return variable)
Evaluate the Jacobian of the DAE initialization residual function F0.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Get the number of columns and non-zero elements in the Jacobian of the DAE initialization residual function F0.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the DAE initialization residual function F0.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero Jacobian entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the DAE initialization residual function F0.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return
variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the Jacobian of the DAE initialization residual function F1.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Get the number of columns and non-zero elements in the Jacobian of the DAE initialization residual function F1.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the DAE initialization residual function F1.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero Jacobian entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the DAE initialization residual function F1.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the Jacobian of the DAE initialization residual function F1.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Get the number of columns and non-zero elements in the Jacobian of the DAE initialization residual function Fp.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the DAE initialization residual function Fp.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero Jacobian entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the DAE initialization residual function Fp.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Get the number of equations in the DAE initialization functions.
Returns:
The number of equations in F0, F1 and Fp resp.
Compute the directional derivative of the ODE.
Parameters:
dv --
The seed vector
Evaluate the Jacobian of the right hand side of the ODE.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Get the number of columns and non-zero elements in the Jacobian of the right hand side of the ODE.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the Jacobian of the right hand side of the ODE.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero Jacobian entries.
Get the row and column indices of the non-zero elements in the Jacobian of the right hand side of the ODE.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evalutate the right hand side of the ODE.
The results is saved to the internal states and can be accessed by accessing ‘my_model.real_x’.
Evaluate the residual of the equality path constraint Ceq.
Parameters:
res --
The residual. (Return variable)
Evaluate the residual of the inequality path constraint Cineq.
Parameters:
res --
The residual. (Return variable)
Evaluate the residual of the free dependent parameter residuals Ffdp.
Parameters:
res --
The residual. (Return variable)
Evaluate the residual of the equality point constraint Heq.
Parameters:
res --
The residual. (Return variable)
Evaluate the residual of the inequality point constraint Hineq.
Parameters:
res --
The residual. (Return variable)
Evaluate the Jacobian of the equality path constraint Ceq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Compute the number of columns and non-zero elements in the Jacobian of the equality path constraint residual function Ceq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the equality path constraint Ceq.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the equality path constraint residual Ceq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the Jacobian of the inequality path constraint Cineq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Compute the number of columns and non-zero elements in the Jacobian of the inequality path constraint residual function Cineq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the inequality path constraint Cineq.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the inequality path constraint residual Cineq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(JMI_DER_DX or JMI_DER_X).
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the Jacobian of the free dependent parameter residual Ffdp.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Compute the number of columns and non-zero elements in the Jacobian of the free dependent parameter residual Ffdp.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the free dependent parameter residual Ffdp.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the free dependent parameter residual Ffdp.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the Jacobian of the equality point constraint Heq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Compute the number of columns and non-zero elements in the Jacobian of the equality point constraint residual function Heq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the equality point constraint Heq.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the equality point constraint residual Heq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the Jacobian of the inequality point constraint Hineq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The Jacobian. (Return variable)
Compute the number of columns and non-zero elements in the Jacobian of the inequality point constraint residual function Hineq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the full Jacobian of the inequality point constraint Hineq.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero entries in the full Jacobian.
Get the row and column indices of the non-zero elements in the Jacobian of the inequality point constraint residual Hineq.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the Jacobian. (Return variable)
col --
Column indices of the non-zeros in the Jacobian. (Return
variable)
Evaluate the gradient of the cost function.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
jac --
The gradient. (Return variable)
Compute the number of columns and non-zero elements in the gradient of the cost function.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
sparsity --
Output format of the Jacobian. Use JMI_DER_SPARSE,
JMI_DER_DENSE_COL_MAJOR, or JMI_DER_DENS_ROW_MAJOR.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
Returns:
Tuple with number of columns and non-zeros resp. of the resulting
Jacobian.
Get the number of non-zeros in the gradient of the cost function J.
Parameters:
eval_alg --
For which Jacobian the number of non-zero elements should be
returned: Symbolic (JMI_DER_SYMBOLIC) or CppAD (JMI_DER_CPPAD).
Returns:
The number of non-zero entries in the full gradient.
Get the row and column indices of the non-zero elements in the gradient of the cost function J.
Parameters:
eval_alg --
JMI_DER_SYMBOLIC to evaluate a symbolic Jacobian or
JMI_DER_CPPAD to evaluate the Jacobian by means of CppAD.
independent_vars --
Indicates which columns of the full Jacobian should be evaluated
(for example JMI_DER_DX or JMI_DER_X).
Can either be a list of columns or a bitmask of the columns
or:ed (|) together. Using a list is prefered as it is more
Pythonesque.
mask --
Vector containing ones for the Jacobian columns that should be
included in the Jacobian and zeros for those which should not.
row --
Row indices of the non-zeros in the gradient. (Return variable)
col --
Column indices of the non-zeros in the gradient. (Return
variable)
Get the number of optimization parameters.
Returns:
The number of optimization parameters.
Get the optimization interval.
Returns:
Tuple with start time of optimization interval, 0 if start time is
fixed and 1 if free, final time of optimization interval, 0 if final
time is fixed and 1 if free, respectively.
Get the optimization parameter indices.
Parameters:
p_opt_indices --
Indices of parameters to be optimized. (Return variable)
Get the sizes of the optimization functions.
Returns:
Tuple with number of equations in the J, L, Ffdp, Ceq, Cineq, Heq
and Hineq residual respectively.
Set the optimization interval.
Parameters:
start_time --
Start time of optimization interval.
start_time_free --
0 if start time should be fixed or 1 if free.
final_time --
Final time of optimization interval.
final_time_free --
0 if final time should be fixed or 1 if free.
Specify optimization parameters for the model.
Parameters:
n_p_opt --
Number of parameters to be optimized.
p_opt_indices --
Indices of parameters to be optimized in pi vector.
Check if there is support for CAD derivatives or not.
Returns:
1 if there is CAD support, 0 otherwise.
Evaluate derivatives w.r.t. all variables in $p$.
Evaluate derivatives w.r.t. all variables in $v$.
No scaling.
Evaluate derivatives w.r.t. all variables in $q$.
Use finite differentiation (FD) to evaluate derivatives.
Evaluate derivatives w.r.t. independent parameters, $p_i$.
Flags for evaluation of Jacobians w.r.t. parameters in the p vector
Interrupt when evaluation error is found
Evaluate derivatives w.r.t. dependent constants, $c_d$.
Use automatic differentiation (CAD) to evaluate derivatives.
Dense evaluation (row major) of derivatives.
Print evaluation errors on screen
Evaluate derivatives w.r.t. differentiated variables, $x$.
Evaluate derivatives w.r.t. differentiated variables at time points, $x_p$.
Sparse evaluation of derivatives.
Flags for evaluation of Jacobians w.r.t. variables in the v vector
Evaluate derivatives w.r.t. dependent constants, $p_d$.
Evaluate derivatives w.r.t. derivatives, $dot x$.
Dense evaluation (column major) of derivatives
Use automatic differentiation (CppAD) to evaluate derivatives.
Flags for evaluation of Jacobians w.r.t. variables in the q vector.
Evaluate derivatives w.r.t. algebraic variables, $w$.
Evaluate derivatives w.r.t. algebraic variables at time points, $w_p$.
Evaluate derivatives w.r.t. time, $t$.
Evaluate derivatives w.r.t. all variables, $z$.
Evaluate derivatives w.r.t. inputs, $u$.
Evaluate derivatives w.r.t. inputs at time points, $u_p$.
Scale real variables by multiplying incoming variables in residual functions by the scaling factors in jmi_t->variable_scaling_factors
Bases: jmodelica.core.BaseModel
High-level interface to a JMIModel.
Property for accessing the dependent boolean constants vector.
Property for accessing the integer independent constants vector.
Property for accessing the boolean discrete variables vector.
Property for accessing the boolean dependent parameters vector.
Property for accessing the boolean independent parameters vector.
Property for accessing the boolean input variables vector.
Evaluate an ODE.
The input variables to f are expected to be set BEFORE calling this function. The calculated dx can be accessed in two ways:
- By accessing is through the member Model.dx; or
- By using return value of this function which is the same.
Returns:
Model.dx on success.
Raises:
JMIException evaluation failed.
Get a list of all alias variables belonging to the aliased variable passed as argument to the function along with a list of booleans indicating whether the alias variable should be negated or not.
Parameters:
variable --
The aliased variable.
Returns:
Tuple of lists, the first containing the names of the alias
variables, the second containing booleans for each alias
variable indicating whether the variable is a negated variable
or not.
Tuple of empty lists if the variable has no alias variables.
None if variable cannot be found in model.
Get the names of the derivatives in the model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
names of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value reference and name respectively.
Raises:
XMLException if variable is not found in XML document.
Get all offsets for the variable types in the z vector.
Returns:
A list of the offsets for the variable types in the z vector.
Get the names of the optimized parameters in the model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
names of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value reference and name respectively.
Raises:
XMLException if variable is not found in XML document.
Get the real derivatives variables vector corresponding to the i:th time point.
Parameters:
i --
Point in time.
Returns:
A reference to the real derivatives variables vector for time point
i.
Get the real inputs vector corresponding to the i:th time point.
Parameters:
i --
Point in time.
Returns:
A reference to the real inputs variables vector for time point i.
Get the real algebraic variables vector corresponding to the i:th time point.
Parameters:
i --
Point in time.
Returns:
A reference to the real algebraic variables vector for time point i.
Get the real differentiated variables vector corresponding to the i:th time point.
Parameters:
i --
Point in time.
Returns:
A reference to the real differentiated variables vector for time
point i.
Get the scaling_method. Valid values are JMI_SCALING_NONE and JMI_SCALING_VARIABLES.
Returns:
The scaling method currently used.
Get the sizes of all variable vectors.
Returns:
A list of the sizes of the variable vectors.
Get the names of the inputs in the model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
names of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value reference and name respectively.
Raises:
XMLException if variable is not found in XML document.
Get the value reference of the variable given the variable name.
Parameters:
variablename --
The name of the variable for which the value reference should be
found.
Returns:
Value reference of the specific variable.
Raises:
XMLException if variable was not found.
Get variability of variable.
Parameters:
variablename --
The name of the variable.
Returns:
The variability of the variable, CONTINUOUS(0), CONSTANT(1),
PARAMETER(2) or DISCRETE(3).
Raises:
XMLException if variable was not found.
Extract the descriptions of the variables in a model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
descriptions of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value reference and description
respectively.
Raises:
XMLException if variable is not found in XML document.
Get the names of all variables in the model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
names of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value references and names respectively.
Get the names of the algebraic variables in the model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
names of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value reference and name respectively.
Raises:
XMLException if variable is not found in XML document.
Get the names of the differentiated_variables in the model.
Parameters:
include_alias --
If True then include all alias variables if False then only the
names of the non-alias variables will be returned.
Default: True
Returns:
List of tuples containing value reference and name respectively.
Raises:
XMLException if variable is not found in XML document.
Check if there is support for CAD derivatives.
Returns:
True if there is support for CAD derivatives, otherwise False.
Check if there is support for CppAD derivatives.
Returns:
True if there is support for CppAD derivatives, otherwise False.
Compact function for model initialization.
The initialization method depends on which algorithm is used, this can be set with the function argument ‘algorithm’. Options for the algorithm are passed as option classes or as pure dicts. See JMUModel.initialize_options for more details.
The default algorithm for this function is IpoptInitializationAlg.
Parameters:
algorithm --
The algorithm which will be used for the initialization is
specified by passing the algorithm class as string or class
object in this argument. 'algorithm' can be any class which
implements the abstract class AlgorithmBase (found in
algorithm_drivers.py). In this way it is possible to write own
algorithms and use them with this function.
Default: 'IpoptInitializationAlg'
options --
The options that should be used in the algorithm. For details on
the options do:
>> myModel = JMUModel(...)
>> opts = myModel.initialize_options()
>> opts?
Valid values are:
- A dict which gives IpoptInitializationAlgOptions with
default values on all options except the ones listed in
the dict. Empty dict will thus give all options with
default values.
- An options object.
Default: Empty dict
Returns:
Result object, subclass of algorithm_drivers.ResultBase.
Initialize the JMUModel from a result data object. All variables, but not the parametes, in the model are initialized with variable values extracted from the data at a time instant specified by the argument time. Linear interpolation is used to compute the variable values from the trajectory data.
Property for accessing the dependent integer constants vector.
Property for accessing the integer independent constants vector.
Property for accessing the integer discrete variables vector.
Property for accessing the integer dependent parameters vector.
Property for accessing the integer independent parameters vector.
Property for accessing the integer input variables vector.
Find out if variable is a negated alias or not.
Parameters:
variablename --
The name of the variable.
Returns:
True if the variable is a negated alias, otherwise False.
Raises:
XMLException if variable is not found in XML document.
Reset the pi vector with values from the XML file created when the model was compiled. If an XML file other than this should be used instead, set the filename of the file to load.
Parameters:
filename --
The name of XML file that should be loaded.
Default: Empty string.
Raises:
IOError if file could not be found.
Get the evaluted optimization cost function, J.
All values (such as u, u_p, x_p etc.) are expected to be set before calling this function.
Returns:
The optimization cost function J.
Evaluate the jacobian of the cost function.
Parameters:
independent_variables --
The variables witch the jacobian will be based on.
mask --
If only some independent variables should be
(re)evaluated.
Default: None
Please refer to the JMI documentation for more info.
Evaluate if the optimization final time is fixed.
Returns:
True if the optimization final time is fixed, False otherwise.
Evaluate if the optimization final time is free.
Returns:
True if the optimization final time is free, False otherwise.
Get the final time of the optimization interval.
Returns:
The final time of the optimization interval.
Get the start time of the optimization interval.
Returns:
The start time of the optimization interval.
Evaluate if the optimization start time is fixed.
Returns:
True if the optimization start time is fixed, False otherwise.
Evaluate if the optimization start time is free.
Returns:
True if optimization start time is free, False otherwise.
Solve an optimization problem.
Parameters:
algorithm --
The algorithm which will be used for the optimization is
specified by passing the algorithm class name as string or class
object in this argument. 'algorithm' can be any class which
implements the abstract class AlgorithmBase (found in
algorithm_drivers.py). In this way it is possible to write
custom algorithms and to use them with this function.
The following algorithms are available:
- 'CollocationLagrangePolynomialsAlg'. This algorithm is based
on direct collocation on finite elements and the algorithm
IPOPT is used to obtain a numerical solution to the problem.
Default: 'CollocationLagrangePolynomialsAlg'
options --
The options that should be used in the algorithm. The options
documentation can be retrieved from an options object:
>>> myModel = JMUModel(...)
>>> opts = myModel.optimize_options()
>>> opts?
Valid values are:
- A dict that overrides some or all of the default values
provided by CollocationLagrangePolynomialsAlgOptions. An empty
dict will thus give all options with default values.
- A CollocationLagrangePolynomialsAlgOptions object.
Default: Empty dict
Returns:
A result object, subclass of algorithm_drivers.ResultBase.
Property for accessing the dependent real constants vector.
Property for accessing the real independent constants vector.
Property for accessing the real discrete variables vector.
Property for accessing the real derivatives vector.
Property for accessing the real dependent parameters vector.
Property for accessing the real independent parameters vector.
Property for accessing the real inputs vector.
Property for accessing the real algebraic variables vector.
Property for accessing the real differentiated variables vector.
Reset the internal states of the DLL.
Calling this function is equivalent to reopening the model.
Set the derivatives variables vector corresponding to the i:th time point.
Parameters:
real_dx_p --
The new real derivatives variables vector for time point i.
i --
Point in time.
Set the real inputs vector corresponding to the i:th time point.
Parameters:
real_u_p --
The new real inputs variables vector for time point i.
i --
Point in time.
Set the real algebraic variables vector corresponding to the i:th time point.
Parameters:
real_w_p --
The new real algebraic variables vector for time point i.
i --
Point in time.
Set the real differentiated variables vector corresponding to the i:th time point.
Parameters:
real_x_p --
The new real differentiated variables vector for time point i.
i --
Point in time.
Simulation of a model.
The simulation method depends on which algorithm is used, which can be set by the function argument ‘algorithm’. Options for the simulation algorithm are passed as option classes or as pure dicts. See JMUModel.simulate_options for more details.
The default algorithm for this function is AssimuloAlg.
Parameters:
start_time --
Start time for the simulation.
Default: 0.0
final_time --
Final time for the simulation.
Default: 1.0
input --
Input signal for the simulation. The input should be a 2-tuple
consisting of first the names of the input variable(s) and then
the data matrix.
Default: Empty tuple.
algorithm --
The algorithm that will be used for the simulation is specified
by passing the algorithm class as string or class object in this
argument. 'algorithm' can be any class which implements the
abstract class AlgorithmBase which is found in the module
jmodelica.algorithm_drivers. In this way it is possible to write
custom algorithms and use them with this function.
Default: 'AssimuloAlg'
options --
The options to be used in the algorithm. For details on
available options do:
>> myModel = JMUModel(...)
>> opts = myModel.simulate_options()
>> opts?
Valid values are:
- A dict that overrides some or all of the default values
provided by AssimuloAlgOptions. An empty dict will thus give
all options with default values.
- A AssimuloAlgOptions object.
Default: Empty dict
Returns:
A result object, subclass of algorithm_drivers.ResultBase.
Property for accessing the switch function vector of the DAE. A switch value of 1 corresponds to true and 0 corresponds to false.
Property for accessing the switch function vector of the DAE initialization system. A switch value of 1 corresponds to true and 0 corresponds to false.
Property for accessing the time value.
Property for accessing the variable scaling vector of the DAE initialization system. The scaling variable vector has the same size as the z vector: scaling factors for booleans, integers and switches are ignored.
Write parameter values (real, integer, boolean supported) in the pi vector to XML. The default behaviour is to overwrite the XML file created when model was compiled. To write to a new file, set the file name of the new file to write to.
Parameters:
filename --
The filename of the XML file that the parameter vector should be
written to.
Default: Empty string.
Property for accessing the z vector. (The vector containing all parameters, variables and point-wise evalutated variables vector.
Compile a Modelica or Optimica model to a JMU.
A model class name must be passed, all other arguments have default values. The different scenarios are:
Library directories can be added to MODELICAPATH by listing them in a special compiler option ‘extra_lib_dirs’, for example:
- compiler_options =
- {‘extra_lib_dirs’:[‘c:MyLibsMyLib1’,’c:MyLibsMyLib2’]}
Other options for the compiler should also be listed in the compiler_options dict.
The compiler target is ‘ipopt’ by default which means that libraries for AD and optimization/initialization algortihms will be available as well as the JMI. The other targets are:
- ‘model’ –
- AD and JMI is included.
- ‘algorithm’ –
- AD and algorithm but no Ipopt linking.
- ‘model_noad’ –
- Only JMI, that is no AD interface. (Must currently be used when model includes external functions.)
Parameters:
class_name --
The name of the model class.
file_name --
Model file (string) or files (list of strings), can be both .mo or
.mop files.
Default: Empty list.
compiler --
'auto' if a compiler should be selected automatically depending on
file ending, 'modelica' if a ModelicaCompiler should be used or
'optimica' if a OptimicaCompiler should be used.
Default: 'auto' (i.e. depends on argument file_name)
target --
Compiler target. 'model', 'algorithm', 'ipopt' or 'model_noad'.
Default: 'ipopt'
compiler_options --
Options for the compiler.
Default: Empty dict.
compile_to --
Specify location of the compiled JMU. Directory will be created if
it does not exist.
Default: Current directory.
compiler_log_level --
Set the log level for the compiler. Valid options are 'warning'/'w',
'error'/'e' or 'info'/'i'.
Default: 'warning'
Returns:
Name of the JMU which has been created.
Computes the JMU name from a class name.
Parameters:
class_name --
The name of the model.
Returns:
The JMU name (replaced dots with underscores).
Loads a model from a DLL file and returns it.
The filepath can be be both with or without file suffixes (as long as standard file suffixes are used, that is).
. All of the above should work on the JModelica supported platforms. However, the first one is recommended as it is the most platform independent syntax.
Parameters:
libname --
Name of the library without prefix.
path --
The relative or absolute path to the library.