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

param symfun

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

param 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)

param xdot

new right hand side of the differential equation

returns

xdot – void

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

updateModelName updates the modelname

param modelname

new modelname

returns

modelname – void

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

updateModelName updates the modelname

param wrap_path

new wrap_path

returns

wrap_path – void

noret::substitute amimodel::parseModel()

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

returns

void

noret::substitute amimodel::generateC()

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

returns

void

noret::substitute amimodel::generateRebuildM()

generateRebuildM generates a Matlab script for recompilation of this model

returns

void

noret::substitute amimodel::compileC()

compileC compiles the mex simulation file

returns

void

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

generateM generates the matlab wrapper for the compiled C files.

param amimodelo2

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

returns

amimodelo2 – void

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

getFun generates symbolic expressions for the requested function.

param HTable

struct with hashes of symbolic definition from the previous compilation

param funstr

function for which symbolic expressions should be computed

returns

funstr – void

noret::substitute amimodel::makeEvents()

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

returns

void

noret::substitute amimodel::makeSyms()

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

returns

void

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

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

param HTable

struct with reference hashes of functions in its fields

param deps

cell array with containing a list of dependencies

returns

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.

returns

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.

returns

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.

returns

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

::bool adjoint   = true

flag indicating whether adjoint sensitivities should be enabled

Note

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

::bool forward   = true

flag indicating whether forward sensitivities should be enabled

Note

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

::double t0   = 0

default initial time

Note

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

::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

::string param   = "lin"

default parametrisation

Note

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

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

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

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().

param modelname

name of the model as specified for amiwrap()

param modelSourceFolder

path to model source directory

param coptim

optimization flags

param debug

enable debugging

param funs

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

param cfun

struct indicating which files should be recompiled

returns

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.

param nx

number of states

param ny

number of observables

param np

number of parameters

param nk

number of fixed parameters

param nz

number of events

param o2flag

o2flag

param amimodelo2

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

param wrapperFilename

output filename

param modelname

name of the model

param pscale

default parameter scaling

param forward

has forward sensitivity equations

param adjoint

has adjoint sensitivity equations

returns

adjoint – void