Svein
Joined: 14 Mar 2007 Posts: 94 Location: Ålesund, Norway
|
Posted: Thu 5 Jul 11:06:14 2007 Post subject: What's the purpose of state variables |
|
|
The state variables are what the simulator calculates during the simulation. In the code, the value of the state variable's derivative must be specified, then the simulator will calculate the state variable's value by numeric integration.
For instance, a state variable for speed, v is added using the Code Generator. Two variables are then added to the model, v which is the speed, and v_ddt, the derivative of v.
In EvaluateDiffEquations(), an expression for v_ddt must be specified, for instance using Newton's second law, F=m*v_ddt:
F and m may be other state variables, normal signal or parameters. For accurate simulations, F should probably be another state variable. _________________ Svein Erling Linge, ICD |
|