Parameters, Variables, and Equations
A basic model consists of parameters, variables, and equations. Equations consist of a collection of parameters and variables that are related by operands (+,-,*,/,exp(),d()/dt, etc.). Parameters are fixed values that represent model inputs, fixed constants, or any other value that does not change. Variables, on the other hand, are adjusted to satisfy equation expressions.
The degrees of freedom is defined by the number of variables minus the number of equations.
DOF = nvar - neqn
Square problems (DOF = 0)
When a problem has the same number of variables and equations, it is referred to as a square problem. Square problems are often easier to solve because the solver only has to achieve feasibility to terminate successfully.
Over-specified problems (DOF < 0)
When there are more equations than variables, the problem is termed as an over-specified problem. An error indicates that there are too few degrees of freedom.
Under-specified problems (DOF > 0)
When there are more variables than equations, there is an opportunity to minimize an objective. This is often posed in economic terms to minimize cost or maximize profits. The objective function is composed of specially designated variables known as objective variables.
APMonitor allows empirical or first-principles modeling. In most cases a seamless integration of the two types of modeling approaches is most effective.
Empirical models have a generic and flexible model form that can fit many physical phenomena without a fundamental understanding of the process. This allows a non-process expert to derive a predictive model for simulation, estimation, or control. Empirical models are often numerically less expensive to solve and train. While increasing the number of model parameters leads to a better fit of the data, there is often poor extrapolation outside of the training region.
Fundamental modeling of many physical systems can be described with differential and algebraic equations (DAEs). When used in predictive analytics, these models can have a much wider range of accuracy than empirical models. Although sometimes difficult to construct, parts of a fundamental model can be reused in similar applications. The ability to re-use fundamental models is because the underlying model structure is based on fundamentals that do not change from application to application.
Basic Model Structure
The model is stored in a text file with an extension .apm. Comments characters include exclamation mark (!), percent sign (%), and pound sign (#). Comments can be placed at any location in the file and will be ignored during run time. Model indentation is encouraged to improve readability of the file, but is not required. In this case the model name example is chosen. In the following documentation, anything that begins with a capital letter is a system keyword while lower case words can be modified by the user.
Model example Parameters ! include parameters here End Parameters Variables ! include variables here End Variables Equations ! include equations here End Equations End Model