Home > Applications > Equations solver
EcosimPro as a pure Equations Solver
Non-causal modelling
Non-causal modelling means that when an equation is entered, the order is not predefined. We are not entering assignations but equivalences which must be complied with at all times. For example, if we model Ohm's law with the equation:
V = R * I
we could have written it in other ways, such as:
0 = V - R * I
R = V / I
R - V / I = 0
These are all the same to EcosimPro as the program takes the initiative to isolate any variable whenever necessary. Sometimes it may be interested in the law when it knows "I" and "R", other times when it knows "V" and "R" and other times when it knows "V" and "I". EcosimPro's symbolic algorithms will transform the correct equation in each case.
Order of equations
When components are modelled with several equations, the order in which they are entered is not important, as EcosimPro will sort them optimally at the end of the process.
For instance, when modelling a pendulum using Cartesian coordinates:
CONST REAL g = 9.806 "gravity (m/s**2)"
COMPONENT pendulum
DATA
REAL m = 1 "Mass (Kg)"
REAL L = 1 "Length (m)"
DECLS
REAL x "X axis position (m)"
REAL y "Y axis position (m)"
REAL T "Tension (N)"
CONTINUOUS
m * x'' = - T * x / L
m * y'' = m * g - T * y / L
x**2 + y**2 = L**2
END COMPONENT
the order of the equations (and the format) can be changed. EcosimPro will sort them automatically.
Math wizards
EcosimPro has three types of math wizards to help create the correct and final mathematical model:
- Resolution of high index mathematical problems. EcosimPro automatically detects a high index problem (or problems). It will suggest different variables to reduce the index until an index one problem is reached, which can be then solved. If necessary, EcosimPro will derive symbolically the corresponding equations automatically.
- Selection of boundary variables. It helps the user to select the variables that are considered to be known when there are more unknowns than there are equations.
- Resolution of algebraic non-linear loops. If EcosimPro detects an algebraic non-linear loop, it will suggest an optimum way of resolving it. The user can accept the automatic suggestion, or reject it and provide a different one. In either case EcosimPro will check that it is correct.
Example
Particle movement
Suppose we want to model the exact movement of a mass following Newton's laws. This could be modelled using EL (EcosimPro Language) as follows:
COMPONENT particle
DATA
REAL m = 1 "Particle mass (Kg)"
DECLS
REAL F "External force (N)"
REAL x "Particle position (m)"
CONTINUOUS
-- Newton's law
F = m * x''
END COMPONENT
As can be seen, the modelling is done intuitively. From this point onwards, EcosimPro will help the user to achieve a consistent mathematical model. In this case we could take "F" as a boundary condition, since "m" is a datum and "x" is dynamic. The user could run an experiment to integrate the model by making the force follow the value of "sin(TIME)". For example, the user could integrate between "0" and "15" seconds, with a "0.1" second communication interval. The code would be as follows:
EXPERIMENT exp1 ON particle.model
BOUNDS -- init boundary variables
F = sin(TIME)
BODY
REPORT_TABLE("myReport.rpt","*")
TIME = 0.
TSTOP = 15.
CINT = 0.1
INTEG( )
END EXPERIMENT
The results of the simulation are written to the "myReport.rpt" file. We can also use EcosimPro's simulation and monitoring interface "EcoMonitor" and the following graph would be shown:
This is a trivial example, but just as we have solved one equation, we can just as easily do it for many. EcosimPro always handles the complexities of ordering, isolation of variables, detection of algebraic loops, resolution of high index problems, and calls to numerical solvers.
Going a little further, we get to object-orientated system modelling, which is in fact the main application. In this case the complex models are not modelled with a single component but with many of them. A component can have instances of other objects within itself. This is where the true power of EcosimPro begins. If you visit other applications of the tool, you will be able to see this powerful concept in action.


