CDP Forum Forum Index CDP Forum
NOTE: The forum is being replaced by support.icd.no
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

What's the purpose of state variables

 
Post new topic   Reply to topic    CDP Forum Forum Index -> CDPSim
View previous topic :: View next topic  
Author Message
Svein



Joined: 14 Mar 2007
Posts: 94
Location: Ålesund, Norway

PostPosted: Thu 5 Jul 11:06:14 2007    Post subject: What's the purpose of state variables Reply with quote

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:
Code:
v_ddt = F/m;


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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CDP Forum Forum Index -> CDPSim All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group