Dynamic modelling: Difference between revisions
No edit summary |
|||
| Line 45: | Line 45: | ||
* [[Initial-value modelling]]. | * [[Initial-value modelling]]. | ||
* [[Improved DAE syntax]] | * [[Improved DAE syntax]] | ||
* [[Integrator API]] (how ASCEND interfaces with solvers for dynamic modelling) | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Syntax]] | [[Category:Syntax]] | ||
Revision as of 00:56, 3 February 2011
| NLA |
|---|
| QRSlv |
| CMSlv |
| IPSlv |
| NLP |
| CONOPT |
| IPOPT |
| TRON |
| MINOS |
| Opt |
| NGSlv |
| DAE/ODE |
| IDA |
| LSODE |
| DOPRI5 |
| RADAU5 |
| LA |
| Linsolqr |
| Linsol |
| LP |
| MakeMPS |
| Logic |
| LRSlv |
Dynamic modelling in ASCEND is where you solve a system of ordinary differential equations (ODEs) or differential/algebraic equations for the time-varying values of variables in the model over a certain interval, given the initial conditions of the model. We also refer to this as integration. Dynamic modelling can be done within the ASCEND language providing the relationship between variables and their derivatives can be established.
The current method for specifying derivatives is by including the ivpsystem.a4l library:
REQUIRE "ivpsystem.a4l";
at the start of your model, then creating a special method
METHOD ode_init; dx_dt.ode_id := 1; x.ode_id := 1; (* ie these variables are related with ID '1' *) dx_dt.ode_type := 2; (* ie 'this is a derivative variable' *) x.ode_type := 1; (* ie 'this is a differential variable *) t.ode_type:= -1; (* 'tag' the independent variable *) END ode_init;
which must be run before sending your model to either IDA or LSODE (or a future solver...) for integration.
New syntax
Dante Stroe recently added support for LINK semantics that allows this fairly painful syntax to be improved. Based on the LINK structure the following syntax can now be used to define derivative chains, for example:
INDEPENDENT t; DER(dx_dt,x)
This syntax can be used in either the declarative part of the model, either in the Methods section.
- The INDEPENDENT keyword adds an independent variable to the solver. While it is possible to store multiple independent variables in the solver data structures, the user is currently limited to only one independent variable, since there is no implementation of partial derivatives. (Implementation-wise, a LINK entry with the 'indepenendent' key and the independent variable itself is created)
- The DER keyword is used to declare the derivative chains in terms of the declared independent variable. The parameters of DER are the differential variables in decreasing order (ode_type in the previous syntax). The derivative chains declared in DER can be arbitrarily long, however the solver does not handle more than 2nd order derivatives. (Implementation-wise, a LINK entry with the 'ode' key and the differential variable is created)
The following models using the aforementioned syntax have been added:
- dante:models/test/ida/singlederiv_wLINK.a4c
- dante:models/test/ida/twoderiv_wLINK.a4c
- dante:models/dyn_tank_wLINK.a4c
- dante:models/johnpye/pendulum_wLINK.a4c
- dante:models/test/dopri5/dopri5test_wLINK.a4c
See also
- External Integrators in the development section.
- Initial-value modelling.
- Improved DAE syntax
- Integrator API (how ASCEND interfaces with solvers for dynamic modelling)