Advanced process monitor (APMonitor), is a modeling language for differential algebraic (DAE) equations.^{[1]} It is a free webservice for solving representations of physical systems in the form of implicit DAE models. APMonitor is suited for largescale problems and allows solutions of linear programming, integer programming, nonlinear programming, nonlinear mixed integer programming, dynamic simulation,^{[2]} moving horizon estimation,^{[3]} and nonlinear control.^{[4]} APMonitor does not solve the problems directly, but calls nonlinear programming solvers such as APOPT, BPOPT, IPOPT, MINOS, and SNOPT. The APMonitor API provides exact first and second derivatives of continuous functions to the solvers through automatic differentiation and in sparse matrix form.
Contents

High Index DAEs 1

Pendulum motion (index3 DAE form) 1.1

Interfaces to scripting languages 2

Applications in APMonitor Modeling Language 3

Direct current (DC) motor 3.1

Blood glucose response of an insulin dependent patient 3.2

See also 4

References 5

External links 6
High Index DAEs
The highest order of a derivative that is necessary to return a DAE to ODE form is called the differentiation index. A standard way for dealing with highindex DAEs is to differentiate the equations to put them in index1 DAE or ODE form (see Pantelides algorithm). However, this approach can cause a number of undesirable numerical issues such as instability. While the syntax is similar to other modeling languages such as gProms, APMonitor solves DAEs of any index without rearrangement or differentiation.^{[5]} As an example, an index3 DAE is shown below for the pendulum motion equations and lower index rearrangements can return this system of equations to ODE form (see Index 0 to 3 Pendulum example).
Pendulum motion (index3 DAE form)
Model pendulum
Parameters
m = 1
g = 9.81
s = 1
End Parameters
Variables
x = 0
y = s
v = 1
w = 0
lam = m*(1+s*g)/2*s^2
End Variables
Equations
x^2 + y^2 = s^2
$x = v
$y = w
m*$v = 2*x*lam
m*$w = m*g  2*y*lam
End Equations
End Model
Interfaces to scripting languages
Python and MATLAB are two mathematical programming languages that have APMonitor integration. Using integration with scripting and programming languages as a webservice has a number of advantages and disadvantages. The advantages include an alternative to the builtin optimization toolboxes, processing of optimization solutions is simplified, serverside upgrades are transparent to the user, and improved crossplatform availability. Some of the disadvantages are that users are generally reluctant to use a webservice with proprietary models or data, a persistent internet connection is required, and the calculation techniques are not open to inspection as with opensource packages.
Applications in APMonitor Modeling Language
Many physical systems are naturally expressed by differential algebraic equation. Some of these include:
Models for a direct current (DC) motor and blood glucose response of an insulin dependent patient are listed below.
Direct current (DC) motor
Model motor
Parameters
! motor parameters (dc motor)
v = 36 ! input voltage to the motor (volts)
rm = 0.1 ! motor resistance (ohms)
lm = 0.01 ! motor inductance (henrys)
kb = 6.5e4 ! back emf constant (volt·s/rad)
kt = 0.1 ! torque constant (N·m/a)
jm = 1.0e4 ! rotor inertia (kg m²)
bm = 1.0e5 ! mechanical damping (linear model of friction: bm * dth)
! load parameters
jl = 1000*jm ! load inertia (1000 times the rotor)
bl = 1.0e3 ! load damping (friction)
k = 1.0e2 ! spring constant for motor shaft to load
b = 0.1 ! spring damping for motor shaft to load
End Parameters
Variables
i = 0 ! motor electric current (amperes)
dth_m = 0 ! rotor angular velocity sometimes called omega (radians/sec)
th_m = 0 ! rotor angle, theta (radians)
dth_l = 0 ! wheel angular velocity (rad/s)
th_l = 0 ! wheel angle (radians)
End Variables
Equations
lm*$i  v = rm*i  kb *$th_m
jm*$dth_m = kt*i  (bm+b)*$th_m  k*th_m + b *$th_l + k*th_l
jl*$dth_l = b *$th_m + k*th_m  (b+bl)*$th_l  k*th_l
dth_m = $th_m
dth_l = $th_l
End Equations
End Model
Blood glucose response of an insulin dependent patient
! Model source:
! A. Roy and R.S. Parker. “Dynamic Modeling of Free Fatty
! Acids, Glucose, and Insulin: An Extended Minimal Model,”
! Diabetes Technology and Therapeutics 8(6), 617626, 2006.
Model human
Parameters
p1 = 0.068 ! 1/min
p2 = 0.037 ! 1/min
p3 = 0.000012 ! 1/min
p4 = 1.3 ! mL/(min·µU)
p5 = 0.000568 ! 1/mL
p6 = 0.00006 ! 1/(min·µmol)
p7 = 0.03 ! 1/min
p8 = 4.5 ! mL/(min·µU)
k1 = 0.02 ! 1/min
k2 = 0.03 ! 1/min
pF2 = 0.17 ! 1/min
pF3 = 0.00001 ! 1/min
n = 0.142 ! 1/min
VolG = 117 ! dL
VolF = 11.7 ! L
! basal parameters for TypeI diabetic
Ib = 0 ! Insulin (µU/mL)
Xb = 0 ! Remote insulin (µU/mL)
Gb = 98 ! Blood Glucose (mg/dL)
Yb = 0 ! Insulin for Lipogenesis (µU/mL)
Fb = 380 ! Plasma Free Fatty Acid (µmol/L)
Zb = 380 ! Remote Free Fatty Acid (µmol/L)
! insulin infusion rate
u1 = 3 ! µU/min
! glucose uptake rate
u2 = 300 ! mg/min
! external lipid infusion
u3 = 0 ! mg/min
End parameters
Intermediates
p9 = 0.00021 * exp(0.0055*G) ! dL/(min*mg)
End Intermediates
Variables
I = Ib
X = Xb
G = Gb
Y = Yb
F = Fb
Z = Zb
End variables
Equations
! Insulin dynamics
$I = n*I + p5*u1
! Remote insulin compartment dynamics
$X = p2*X + p3*I
! Glucose dynamics
$G = p1*G  p4*X*G + p6*G*Z + p1*Gb  p6*Gb*Zb + u2/VolG
! Insulin dynamics for lipogenesis
$Y = pF2*Y + pF3*I
! Plasmafree fatty acid (FFA) dynamics
$F = p7*(FFb)  p8*Y*F + p9 * (F*GFb*Gb) + u3/VolF
! Remote FFA dynamics
$Z = k2*(ZZb) + k1*(FFb)
End Equations
End Model
See also
References
External links

APMonitor home page

Dynamic optimization course with APMonitor

APMonitor documentation

Online solution engine with IPOPT

Comparison of popular modeling language syntax

Download MATLAB Interface to APMonitor

Download Python Interface to APMonitor
This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.