Robotran C Documentation
mbs_euler_implicit.h
Go to the documentation of this file.
1 
16  #ifndef MBS_EULERIM_H_INCLUDED
17 #define MBS_EULERIM_H_INCLUDED
18 
19 #include "mbs_data.h"
20 #include "integrator.h"
21 #include "mbs_dirdyn.h"
22 #include "useful_functions.h"
23 #include "mbs_dirdyn_struct.h"
24 #include "mbs_project_interface.h"
25 #include "MBSfun.h"
26 #include "nrfct.h"
27 
31 typedef struct MbsDirdynEulerIm
32 {
33  double **dfdy; // matrix of derivatives of f by y [nxn]
34  double *dfdx; // vector of derivatives of f by x [1xn]
35  double *ysav; // vector save y from previous step [1xn]
36  double *dysav; // vector save dy from previous step [1xn]
37 
38  double *delta_p; // to store delta p [1xnqu]
39  double *delta_v; // to store delta v [1xnqu]
40 
41  double **A; // left side of the equation [nquxnqu]
42  double *B; // right side of the equation [1xnqu]
43  double *jpxv; // useful vector to store Jnp * xv [1xnqu]
44 
45  int *indx; // index for LU decomp and system resolution
46 
47  // To freeze jacobian
50 
52 
58 void initialize_euler_implicit(MbsData *mbs_data, MbsDirdyn *mbs_dd);
59 
69 int loop_euler_implicit(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
70 
76 void finish_euler_implicit(MbsData *mbs_data, MbsDirdyn *mbs_dd);
77 
85 void error_euler_implicit(MbsData *mbs_data, MbsDirdyn *dd, int err);
86 
87 #endif // MBS_EULERIM_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
mbs_euler_implicit.h
This header defines global functions for Euler Implicit integrator in C.
initialize_euler_implicit
void initialize_euler_implicit(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Euler Implicit integrator.
Definition: mbs_euler_implicit.c:21
useful_functions.h
MbsDirdynEulerIm::Freeze_dfdy
double ** Freeze_dfdy
Definition: mbs_euler_implicit.h:48
MbsDirdynEulerIm::jpxv
double * jpxv
Definition: mbs_euler_implicit.h:43
finish_euler_implicit
void finish_euler_implicit(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Euler Implicit integrator.
Definition: mbs_euler_implicit.c:128
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
MbsDirdynEulerIm::B
double * B
Definition: mbs_euler_implicit.h:42
mbs_data.h
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:152
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
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:160
mbs_project_interface.h
free_ivec_0
void free_ivec_0(int *vec)
release memory for a vector of integers, starting with index 0
Definition: mbs_1D_array.c:415
MbsDirdynEulerIm::delta_v
double * delta_v
Definition: mbs_euler_implicit.h:39
free_dmat_0
void free_dmat_0(double **mat)
release memory for a matrix of doubles, starting at index 0
Definition: mbs_matrix.c:293
initialize_euler_implicit
void initialize_euler_implicit(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Euler Implicit integrator.
Definition: mbs_euler_implicit.c:21
MbsDirdyn::yout
double * yout
Allocation of a vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:155
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
error_euler_implicit
void error_euler_implicit(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_implicit.c:165
error_euler_implicit
void error_euler_implicit(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_implicit.c:165
MBSfun.h
loop_euler_implicit
int loop_euler_implicit(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_euler_implicit.c:56
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:183
get_dmat_0
double ** get_dmat_0(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 0
Definition: mbs_matrix.c:238
finish_euler_implicit
void finish_euler_implicit(MbsData *mbs_data, MbsDirdyn *dd)
Finalize and clear memory allocated for Euler Implicit integrator.
Definition: mbs_euler_implicit.c:128
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
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsDirdynEulerIm::A
double ** A
Definition: mbs_euler_implicit.h:41
MbsDirdynEulerIm::Freeze_jacobian_index
int Freeze_jacobian_index
Definition: mbs_euler_implicit.h:49
MbsDirdynEulerIm::delta_p
double * delta_p
Definition: mbs_euler_implicit.h:38
MbsDirdynEulerIm::ysav
double * ysav
Definition: mbs_euler_implicit.h:35
loop_euler_implicit
int loop_euler_implicit(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_euler_implicit.c:56
MbsDirdynEulerIm::Freeze_dfdx
double * Freeze_dfdx
Definition: mbs_euler_implicit.h:48
MbsDirdynEulerIm::dfdx
double * dfdx
Definition: mbs_euler_implicit.h:34
nrfct.h
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
MbsDirdynEulerIm::dysav
double * dysav
Definition: mbs_euler_implicit.h:36
get_ivec_0
int * get_ivec_0(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 0
Definition: mbs_1D_array.c:399
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
MbsDirdynEulerIm::indx
int * indx
Definition: mbs_euler_implicit.h:45
MbsDirdynEulerIm::Freeze_dydx
double * Freeze_dydx
Definition: mbs_euler_implicit.h:48
integrator.h
This header defines specific integrators functions in C.
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
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
euler_implicit
int euler_implicit(double y[], double dydx[], int n, double *x, double h, double yout[], int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *mbs_dd)
Euler Implicit integrator implementation.
Definition: euler_implicit.c:27
MbsDirdynEulerIm
Euler Implicit structure for dirdyn.
Definition: mbs_euler_implicit.h:31
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:146
MbsDirdynEulerIm::dfdy
double ** dfdy
Definition: mbs_euler_implicit.h:33
mbs_warning_msg
void mbs_warning_msg(char *msg,...)
Send a warning message.
Definition: mbs_message.c:89