Robotran C Documentation
mbs_euler_explicit.h
Go to the documentation of this file.
1 
15 #ifndef MBS_EULEREX_H_INCLUDED
16 #define MBS_EULEREX_H_INCLUDED
17 
18 #include "mbs_data.h"
19 #include "integrator.h"
20 #include "mbs_dirdyn.h"
21 #include "useful_functions.h"
22 #include "mbs_dirdyn_struct.h"
23 #include "mbs_project_interface.h"
24 #include "MBSfun.h"
25 
26 #define P_INF_VALUE 0.143 // value tat was best for haptic piano, see ST
27 
31 typedef void(*euler_integrator_implementation)(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
32 
36 typedef struct MbsDirdynEulerEx
37 {
39  double *a_n;
40  double *a_n_1;
42 
44 
50 void initialize_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd);
51 
61 int loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
62 
68 void finish_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd);
69 
76 void euler_explicit(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
77 
78 
86 void eulaire(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
87 
100 void alpha_method(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
101 
109 void error_eulerEx(MbsData *mbs_data, MbsDirdyn *dd, int err);
110 
111 #endif // MBS_EULEREX_H_INCLUDED
MbsDirdynOptions::flag_precise_dynamics
int flag_precise_dynamics
= 1 to call the direct dynamics at the beginning of each time step of integration.
Definition: mbs_dirdyn_struct.h:112
initialize_eulerEx
void initialize_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:19
alpha_method
void alpha_method(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for a simplified alpha-method We call it AlphaM.
Definition: mbs_euler_explicit.c:167
useful_functions.h
mbs_dirdyn.h
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:208
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:153
mbs_data.h
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:152
euler_explicit
void euler_explicit(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for the Euler Explicit integration.
Definition: mbs_euler_explicit.c:143
mbs_dirdyn_struct.h
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:165
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0
Definition: mbs_1D_array.c:880
MbsDirdynEulerEx::alpha_f
double alpha_f
Definition: mbs_euler_explicit.h:41
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:160
mbs_project_interface.h
error_eulerEx
void error_eulerEx(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_eu...
Definition: mbs_euler_explicit.c:133
mbs_fct_dirdyn
int mbs_fct_dirdyn(double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *dd)
direct dynamics derivative computation
Definition: mbs_dirdyn.c:1067
Eulaire
@ Eulaire
Definition: integrator.h:29
P_INF_VALUE
#define P_INF_VALUE
Definition: mbs_euler_explicit.h:26
eulaire
void eulaire(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for unknown integrator but based partially on euler explicit We call it Eulaire.
Definition: mbs_euler_explicit.c:155
loop_eulerEx
int loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_euler_explicit.c:55
MBSfun.h
MbsDirdynEulerEx::alpha_m
double alpha_m
Definition: mbs_euler_explicit.h:41
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:183
MbsDirdynOptions::dt0
double dt0
initial value of the integration step size, default = 0.001
Definition: mbs_dirdyn_struct.h:45
finish_eulerEx
void finish_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:116
loop_eulerEx
int loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_euler_explicit.c:55
user_dirdyn_loop
void user_dirdyn_loop(MbsData *mbs_data, MbsDirdyn *mbs_dd)
user own loop functions
Definition: user_dirdyn.c:46
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:149
MbsDirdynEulerEx::beta
double beta
Definition: mbs_euler_explicit.h:41
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsDirdynEulerEx
Euler Explicit structure for dirdyn.
Definition: mbs_euler_explicit.h:36
MbsDirdynEulerEx::div_alpha_m
double div_alpha_m
internal parameters of the alpha-method
Definition: mbs_euler_explicit.h:41
euler_explicit
void euler_explicit(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for the Euler Explicit integration.
Definition: mbs_euler_explicit.c:143
MbsDirdynEulerEx::gamma
double gamma
Definition: mbs_euler_explicit.h:41
finish_eulerEx
void finish_eulerEx(MbsData *mbs_data, MbsDirdyn *dd)
Finalize and clear memory allocated for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:116
alpha_method
void alpha_method(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for a simplified alpha-method We call it AlphaM.
Definition: mbs_euler_explicit.c:167
AlphaM
@ AlphaM
Definition: integrator.h:29
save_realtime_update
int save_realtime_update(MbsDirdyn *dd, MbsData *mbs_data)
update the real-time and saving modules if requested
Definition: mbs_dirdyn.c:1146
mbs_message.h
mbs_euler_explicit.h
This header defines global functions for Euler Explicit integrator in C.
MbsDirdynEulerEx::a_n_1
double * a_n_1
vector used for alpha-method to store current internal accelerations
Definition: mbs_euler_explicit.h:40
error_eulerEx
void error_eulerEx(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_eu...
Definition: mbs_euler_explicit.c:133
MbsDirdynEulerEx::choice_of_euler
euler_integrator_implementation choice_of_euler
to choose between Eulaire, Alpah method and Euler explicit
Definition: mbs_euler_explicit.h:38
MbsData
Definition: mbs_data.h:149
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
MbsDirdynOptions
Structure defining the option of a direct dynamic.
Definition: mbs_dirdyn_struct.h:38
integrator.h
This header defines specific integrators functions in C.
MbsDirdynOptions::integrator
int integrator
Set integrator to use, available value: RK4, Dopri5, Rosenbrock, EulerEx, Eulaire,...
Definition: mbs_dirdyn_struct.h:108
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
copy_dvec_0
void copy_dvec_0(double *vec_src, double *vec_dest, int l_v)
Copy the content of a vector (of sizel_v) of doubles to a second vector, starting with index 0.
Definition: mbs_1D_array.c:906
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:896
MbsDirdynOptions::flag_solout_wp
int flag_solout_wp
1 to call solout only at required waypoints (only if flag_waypoint activated), default = 0
Definition: mbs_dirdyn_struct.h:122
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:144
MbsDirdyn::dt
double dt
current integration step size
Definition: mbs_dirdyn_struct.h:150
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:146
MbsDirdynEulerEx::a_n
double * a_n
vector used for alpha-method to store previous internal accelerations
Definition: mbs_euler_explicit.h:39
eulaire
void eulaire(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for unknown integrator but based partially on euler explicit We call it Eulaire.
Definition: mbs_euler_explicit.c:155
initialize_eulerEx
void initialize_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:19
mbs_warning_msg
void mbs_warning_msg(char *msg,...)
Send a warning message.
Definition: mbs_message.c:89
euler_integrator_implementation
void(* euler_integrator_implementation)(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
This pointer is used to choose between the two implementations of euler.
Definition: mbs_euler_explicit.h:31