trick/trick_models/test/sched/include/sched_integ.d

35 lines
1.2 KiB
D
Raw Normal View History

2015-02-26 15:02:31 +00:00
/********************************* TRICK HEADER *******************************
PURPOSE:
(Ball model state integrator default initialization data.)
REFERENCE:
(((Bailey, R.W, and Paddock, E.J.)
(Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((2 dimensional space))
PROGRAMMERS:
(((Your Name) (Company Name) (Date) (Trick tutorial)))
*******************************************************************************/
#define NUM_STEP 12 /* use up to 12 intermediate steps:
8th order RK Fehlberg */
#define NUM_VARIABLES 4 /* x,y position state and x,y velocity state */
INTEGRATOR.state = alloc(NUM_VARIABLES) ;
INTEGRATOR.deriv = alloc(NUM_STEP) ;
INTEGRATOR.state_ws = alloc(NUM_STEP) ;
for (int kk = 0 ; kk < NUM_STEP ; kk++ ) {
INTEGRATOR.deriv[kk] = alloc(NUM_VARIABLES) ;
INTEGRATOR.state_ws[kk] = alloc(NUM_VARIABLES) ;
}
INTEGRATOR.num_state = NUM_VARIABLES ;
INTEGRATOR.option = Runge_Kutta_4 ; /* 4rth order Runge Kutta */
INTEGRATOR.init = True ;
INTEGRATOR.first_step_deriv = Yes ;
#undef NUM_STEP
#undef NUM_VARIABLES