Class amimodel

Inheritance Relationships

Base Type

  • public handle

Class Documentation

amimodel : public handle

AMIMODEL carries all model definitions including functions and events.

Public Functions

amimodel::amimodel(::string symfun, ::string modelname)

amimodel initializes the model object based on the provided symfun and modelname

Parameters
  • symfun: this is the string to the function which generates the modelstruct. You can also directly pass the struct here

  • modelname: name of the model

noret::substitute amimodel::updateRHS(matlabtypesubstitute xdot)

updateRHS updates the private fun property .fun.xdot.sym (right hand side of the differential equation)

Parameters
  • xdot: new right hand side of the differential equation

Return Value
  • xdot: void

noret::substitute amimodel::updateModelName(matlabtypesubstitute modelname)

updateModelName updates the modelname

Parameters
  • modelname: new modelname

Return Value
  • modelname: void

noret::substitute amimodel::updateWrapPath(matlabtypesubstitute wrap_path)

updateModelName updates the modelname

Parameters
  • wrap_path: new wrap_path

Return Value
  • wrap_path: void

noret::substitute amimodel::parseModel()

parseModel parses the model definition and computes all necessary symbolic expressions.

Return Value
  • void:

noret::substitute amimodel::generateC()

generateC generates the c files which will be used in the compilation.

Return Value
  • void:

noret::substitute amimodel::compileC()

compileC compiles the mex simulation file

Return Value
  • void:

noret::substitute amimodel::generateM(:: amimodel amimodelo2)

generateM generates the matlab wrapper for the compiled C files.

Parameters
  • amimodelo2: this struct must contain all necessary symbolic definitions for second order sensivities

Return Value
  • amimodelo2: void

noret::substitute amimodel::getFun(::struct HTable, ::string funstr)

getFun generates symbolic expressions for the requested function.

Parameters
  • HTable: struct with hashes of symbolic definition from the previous compilation

  • funstr: function for which symbolic expressions should be computed

Return Value
  • funstr: void

noret::substitute amimodel::makeEvents()

makeEvents extracts discontiniuties from the model right hand side and converts them into events

Return Value
  • void:

noret::substitute amimodel::makeSyms()

makeSyms extracts symbolic definition from the user provided model and checks them for consistency

Return Value
  • void:

mlhsInnerSubst<::bool > amimodel::checkDeps(::struct HTable, ::cell deps)

checkDeps checks the dependencies of functions and populates sym fields if necessary

Parameters
  • HTable: struct with reference hashes of functions in its fields

  • deps: cell array with containing a list of dependencies

Return Value
  • cflag: boolean indicating whether any of the dependencies have changed with respect to the hashes stored in HTable

mlhsInnerSubst<::struct > amimodel::loadOldHashes()

loadOldHashes loads information from a previous compilation of the model.

Return Value
  • HTable: struct with hashes of symbolic definition from the previous compilation

mlhsInnerSubst< matlabtypesubstitute > amimodel::augmento2()

augmento2 augments the system equation to also include equations for sensitivity equation. This will enable us to compute second order sensitivities in a forward-adjoint or forward-forward apporach later on.

Return Value
  • this: augmented system which contains symbolic definition of the original system and its sensitivities

mlhsInnerSubst<::amimodel > amimodel::augmento2vec()

augmento2 augments the system equation to also include equations for sensitivity equation. This will enable us to compute second order sensitivities in a forward-adjoint or forward-forward apporach later on.

Return Value
  • modelo2vec: augmented system which contains symbolic definition of the original system and its sensitivities

Public Members

::struct sym = struct.empty("")

symbolic definition struct

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: struct.empty(“”)

::struct fun = struct.empty("")

struct which stores information for which functions c code needs to be generated

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: struct.empty(“”)

::amievent event = amievent.empty("")

struct which stores information for which functions c code needs to be generated

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: amievent.empty(“”)

::string modelname = char.empty("")

name of the model

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: char.empty(“”)

::struct HTable = struct.empty("")

struct that contains hash values for the symbolic model definitions

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: struct.empty(“”)

::bool debug = false

flag indicating whether debugging symbols should be compiled

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: false

::bool adjoint = true

flag indicating whether adjoint sensitivities should be enabled

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: true

::bool forward = true

flag indicating whether forward sensitivities should be enabled

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: true

::double t0 = 0

default initial time

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: 0

::string wtype = char.empty("")

type of wrapper (cvodes/idas)

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: char.empty(“”)

::int nx = double.empty("")

number of states

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nxtrue = double.empty("")

number of original states for second order sensitivities

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int ny = double.empty("")

number of observables

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nytrue = double.empty("")

number of original observables for second order sensitivities

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int np = double.empty("")

number of parameters

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nk = double.empty("")

number of constants

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int ng = double.empty("")

number of objective functions

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nevent = double.empty("")

number of events

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nz = double.empty("")

number of event outputs

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nztrue = double.empty("")

number of original event outputs for second order sensitivities

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int id = double.empty("")

flag for DAEs

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int ubw = double.empty("")

upper Jacobian bandwidth

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int lbw = double.empty("")

lower Jacobian bandwidth

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::int nnz = double.empty("")

number of nonzero entries in Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int sparseidx = double.empty("")

dataindexes of sparse Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int rowvals = double.empty("")

rowindexes of sparse Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int colptrs = double.empty("")

columnindexes of sparse Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int sparseidxB = double.empty("")

dataindexes of sparse Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int rowvalsB = double.empty("")

rowindexes of sparse Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*int colptrsB = double.empty("")

columnindexes of sparse Jacobian

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: double.empty(“”)

::*cell funs = cell.empty("")

cell array of functions to be compiled

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: cell.empty(“”)

::*cell mfuns = cell.empty("")

cell array of matlab functions to be compiled

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: cell.empty(“”)

::string coptim = "-O3"

optimisation flag for compilation

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: “-O3”

::string param = "lin"

default parametrisation

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: “lin”

matlabtypesubstitute wrap_path = char.empty("")

path to wrapper

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: char.empty(“”)

matlabtypesubstitute recompile = false

flag to enforce recompilation of the model

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: false

matlabtypesubstitute cfun = struct.empty("")

storage for flags determining recompilation of individual functions

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: struct.empty(“”)

matlabtypesubstitute o2flag = 0

flag which identifies augmented models 0 indicates no augmentation 1 indicates augmentation by first order sensitivities (yields second order sensitivities) 2 indicates augmentation by one linear combination of first order sensitivities (yields hessian-vector product)

Note

This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public

Note

Matlab documentation of property attributes. Default: 0

matlabtypesubstitute z2event = double.empty("")

vector that maps outputs to events

Default: double.empty(“”)

matlabtypesubstitute splineflag = false

flag indicating whether the model contains spline functions

Default: false

matlabtypesubstitute minflag = false

flag indicating whether the model contains min functions

Default: false

matlabtypesubstitute maxflag = false

flag indicating whether the model contains max functions

Default: false

::int nw = 0

number of derived variables w, w is used for code optimization to reduce the number of frequently occuring expressions

Default: 0

::int ndwdx = 0

number of derivatives of derived variables w, dwdx

Default: 0

::int ndwdp = 0

number of derivatives of derived variables w, dwdp

Default: 0

Public Static Functions

noret::substitute amimodel::compileAndLinkModel(matlabtypesubstitute modelname, matlabtypesubstitute modelSourceFolder, matlabtypesubstitute coptim, matlabtypesubstitute debug, matlabtypesubstitute funs, matlabtypesubstitute cfun)

compileAndLinkModel compiles the mex simulation file. It does not check if the model files have changed since generating C++ code or whether all files are still present. Use only if you know what you are doing. The safer alternative is rerunning amiwrap().

Parameters
  • modelname: name of the model as specified for amiwrap()

  • modelSourceFolder: path to model source directory

  • coptim: optimization flags

  • debug: enable debugging

  • funs: array with names of the model functions, will be guessed from source files if left empty

  • cfun: struct indicating which files should be recompiled

Return Value
  • cfun: void

noret::substitute amimodel::generateMatlabWrapper(matlabtypesubstitute nx, matlabtypesubstitute ny, matlabtypesubstitute np, matlabtypesubstitute nk, matlabtypesubstitute nz, matlabtypesubstitute o2flag, :: amimodel amimodelo2, matlabtypesubstitute wrapperFilename, matlabtypesubstitute modelname, matlabtypesubstitute pscale, matlabtypesubstitute forward, matlabtypesubstitute adjoint)

generateMatlabWrapper generates the matlab wrapper for the compiled C files.

Parameters
  • nx: number of states

  • ny: number of observables

  • np: number of parameters

  • nk: number of fixed parameters

  • nz: number of events

  • o2flag: o2flag

  • amimodelo2: this struct must contain all necessary symbolic definitions for second order sensivities

  • wrapperFilename: output filename

  • modelname: name of the model

  • pscale: default parameter scaling

  • forward: has forward sensitivity equations

  • adjoint: has adjoint sensitivity equations

Return Value
  • adjoint: void