Robotran C Documentation
mbs_statespace.h
Go to the documentation of this file.
1 //---------------------------
2 // UCL-CEREM-MBS
3 //
4 //
5 //
6 // Creation : 2018
7 // Last update : see git
8 //---------------------------
9 
10 #ifndef mbs_statespace_h
11 #define mbs_statespace_h
12 /*--------------------*/
13 
14 #include "mbs_statespace_struct.h"
15 #include "mbs_data.h"
16 #include "mbs_aux.h"
17 #include "useful_functions.h"
18 #include "MBSfun.h"
19 #include "mbs_linearipk.h"
20 
36 MbsSS* mbs_new_statespace(MbsData *s, int nu, int ny, int compute_uxd, int compute_JS);
37 
56 MbsSS* blank_new_statespace(int nx, int nu, int ny);
57 
58 
67 int mbs_compute_statespace(MbsSS *ss, MbsData *mbs_data);
68 
79 int mbs_compute_linearMatrices(MbsSS *ss, MbsData *mbs_data, MbsLpk *lpk, MbsAux *aux);
80 
87 
93 void mbs_print_statespace(MbsSS *ss);
94 
95 /*--------------------*/
96 #endif
MbsSS::Lr
double ** Lr
Linearized stiff state matrix : d Rr / d ux.
Definition: mbs_statespace_struct.h:28
mbs_compute_statespace
int mbs_compute_statespace(MbsSS *ss, MbsData *mbs_data)
Compute the matrices (A,B,C,D) for a mbs configuration (q,qd,qdd).
Definition: mbs_statespace.c:402
mbs_linearipk.h
mbs_print_statespace
void mbs_print_statespace(MbsSS *ss)
Print the state-space structure.
Definition: mbs_statespace.c:585
MbsData::Ncons
int Ncons
Number of algebraic constraints.
Definition: mbs_data.h:218
MbsData::qd
double * qd
Array with the current values of the generalized velocities.
Definition: mbs_data.h:188
useful_functions.h
lubksb_0
void lubksb_0(double **a, int n, int *indx, double b[])
Definition: lubksb.c:31
MbsData::nqv
int nqv
Number of dependent articulations.
Definition: mbs_data.h:170
mbs_data.h
MbsData::qc
int * qc
Array with the indices of driven (locked and driven) articulations.
Definition: mbs_data.h:175
mbs_compute_statespace
int mbs_compute_statespace(MbsSS *ss, MbsData *mbs_data)
Compute the matrices (A,B,C,D) for a mbs configuration (q,qd,qdd).
Definition: mbs_statespace.c:402
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:165
MbsLpk
Definition: mbs_linearipk_struct.h:19
MbsSS::Mr
double ** Mr
unused for the moment
Definition: mbs_statespace_struct.h:25
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
MbsData::njoint
int njoint
Number of joints in the system.
Definition: mbs_data.h:162
mbs_delete_statespace
void mbs_delete_statespace(MbsSS *ss)
Free memory of the state-space structure.
Definition: mbs_statespace.c:542
copy_dmat_0
void copy_dmat_0(double **tab_src, double **tab_dest, int nb_r, int nb_c)
Copy the content of a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0.
Definition: mbs_matrix.c:363
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
mbs_Mred
int mbs_Mred(MbsAux *mbs_aux, MbsData *s)
compute Mr, the reduced mass matrix [nqu x nqu] obtained after the 2 consecutive reductions (Robotran...
Definition: mbs_Mred.c:19
print_dmat_0
void print_dmat_0(double **mat, int nb_r, int nb_c)
print a [nb_r times nb_c] matrix of doubles in console, starting with index 0
Definition: mbs_matrix.c:467
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
MbsSS::Mr_copy
double ** Mr_copy
Definition: mbs_statespace_struct.h:48
mbs_statespace_struct.h
MbsData::Nux
int Nux
Number of user variable.
Definition: mbs_data.h:288
MbsSS::Nux
int Nux
Definition: mbs_statespace_struct.h:44
_MBS_ERR_MOD_SPEC_13
#define _MBS_ERR_MOD_SPEC_13
Generic error number Module specific errors range from -10 to -19 please read the error message a...
Definition: mbs_errors_names.h:174
mbs_print_statespace
void mbs_print_statespace(MbsSS *ss)
Print the state-space structure.
Definition: mbs_statespace.c:585
MbsLpk::x_ptr
double ** x_ptr
vector of pointers pointing to the linearized variables
Definition: mbs_linearipk_struct.h:34
MBSfun.h
MbsSS::B
double ** B
input matrix [nx nu]
Definition: mbs_statespace_struct.h:20
ludcmp_0
int ludcmp_0(double **a, int n, int *indx, double *d)
LU decomposition of a matrix with index starting at 0.
Definition: ludcmp.c:82
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
MbsSS::iy
int * iy
index of the state space representation output in the space space vector x. The vector is re-ordered ...
Definition: mbs_statespace_struct.h:13
mbs_linearipk
int mbs_linearipk(double **GK, MbsLpk *lpk, MbsAux *aux, MbsData *s, int EqChoice)
compute the linearized damping matrix Gr or stiffness matrix Kr for a given configuration (q,...
Definition: mbs_linearipk.c:20
get_ivec_1
int * get_ivec_1(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 1
Definition: mbs_1D_array.c:404
MbsSS
The State-space representation starts at index 0.
Definition: mbs_statespace_struct.h:10
MbsSS::compute_JS
int compute_JS
simple flag indicating whether the Jr,Jx and Sr matrices are computed to obtain the A matrix.
Definition: mbs_statespace_struct.h:40
MbsSS::iLU
int * iLU
Definition: mbs_statespace_struct.h:49
blank_new_statespace
MbsSS * blank_new_statespace(int nx, int nu, int ny)
Allocate and intialize a statespace with almost fields to NULL.
Definition: mbs_statespace.c:146
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsSS::A
double ** A
state space matrix [nx nx]
Definition: mbs_statespace_struct.h:19
MbsData::qu
int * qu
Array with the indices of the independent articulations (free)
Definition: mbs_data.h:174
blank_new_statespace
MbsSS * blank_new_statespace(int nx, int nu, int ny)
Allocate and intialize a statespace with almost fields to NULL.
Definition: mbs_statespace.c:146
MbsData::qv
int * qv
Array with the indices of the dependent articulations .
Definition: mbs_data.h:182
MbsSS::columnKr
double * columnKr
Definition: mbs_statespace_struct.h:45
MbsSS::Jr
double ** Jr
Linearized Inertia matrix : d Rr / d qddu (including inerter terms)
Definition: mbs_statespace_struct.h:36
MbsData::q
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:187
MbsSS::Lx
double ** Lx
Linearized ODE stiff state matrix : d uxd / d ux.
Definition: mbs_statespace_struct.h:34
MbsSS::Kx
double ** Kx
Linearized ODE stiffness matrix : d uxd / d qu.
Definition: mbs_statespace_struct.h:33
MbsSS::ny
int ny
number of output (limited to 2*nqu)
Definition: mbs_statespace_struct.h:17
MbsSS::Kr
double ** Kr
Linearized stiffness matrix : d Rr / d qu.
Definition: mbs_statespace_struct.h:27
MbsSS::columnLr
double * columnLr
Definition: mbs_statespace_struct.h:47
nrfct.h
MbsData::nqc
int nqc
Number of driven articulations, it includes qlocked and qdriven.
Definition: mbs_data.h:166
mbs_message.h
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
mbs_new_statespace
MbsSS * mbs_new_statespace(MbsData *s, int nu, int ny, int compute_uxd, int compute_JS)
Create a new structure state-space that contains the matrices (A,B,C,D).
Definition: mbs_statespace.c:18
zeros_dvec_0
void zeros_dvec_0(double *vec, int l_v)
set all the element of a [l_v sized] vector of doubles to zero, starting with index 0
Definition: mbs_1D_array.c:1343
MbsSS::Sr
double ** Sr
Linearized State derivativ matrix : d Rr / d uxd.
Definition: mbs_statespace_struct.h:38
MbsData
Definition: mbs_data.h:149
MbsSS::Jx
double ** Jx
Linearized ODE Inertia matrix : d uxd / d qddu.
Definition: mbs_statespace_struct.h:37
mbs_new_statespace
MbsSS * mbs_new_statespace(MbsData *s, int nu, int ny, int compute_uxd, int compute_JS)
Create a new structure state-space that contains the matrices (A,B,C,D).
Definition: mbs_statespace.c:18
MbsLpk::verbose
int verbose
Definition: mbs_linearipk_struct.h:47
MbsSS::C
double ** C
output matrix [ny nx]
Definition: mbs_statespace_struct.h:21
MbsSS::nqu
int nqu
Definition: mbs_statespace_struct.h:43
MbsSS::iu
int * iu
index of the state space representation input in the Qq vector. The vector is re-ordered in the proce...
Definition: mbs_statespace_struct.h:12
free_ivec_1
void free_ivec_1(int *vec)
release memory for a vector of integers, starting with index 1
Definition: mbs_1D_array.c:420
MbsSS::N
double * N
Definition: mbs_statespace_struct.h:50
MbsSS::Gx
double ** Gx
Linearized ODE damping matrix : d uxd / d qdu.
Definition: mbs_statespace_struct.h:32
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
MbsSS::D
double ** D
Definition: mbs_statespace_struct.h:22
find_ivec_1
int find_ivec_1(int *vec, int l_v, int f)
return the index of the value f in the (x sized) vector vec of integers, starting with index 1....
Definition: mbs_1D_array.c:832
MbsData::uxd
double * uxd
Array with the values of the time derivatives of the user variables.
Definition: mbs_data.h:286
mbs_compute_linearMatrices
int mbs_compute_linearMatrices(MbsSS *ss, MbsData *mbs_data, MbsLpk *lpk, MbsAux *aux)
Compute the linearized matrices necessary to obtain the (A,B,C) state-space representation.
Definition: mbs_statespace.c:207
MbsSS::columnGr
double * columnGr
Definition: mbs_statespace_struct.h:46
MbsData::qdd
double * qdd
Array with the current values of the generalized acceleration.
Definition: mbs_data.h:189
MbsSS::Gr
double ** Gr
Linearized damping matrix : d Rr / d qdu.
Definition: mbs_statespace_struct.h:26
MbsSS::Bvuc_0
double ** Bvuc_0
copy of the Bvuc matrix (with index 0 !)
Definition: mbs_statespace_struct.h:30
mbs_compute_linearMatrices
int mbs_compute_linearMatrices(MbsSS *ss, MbsData *mbs_data, MbsLpk *lpk, MbsAux *aux)
Compute the linearized matrices necessary to obtain the (A,B,C) state-space representation.
Definition: mbs_statespace.c:207
MbsLpk::nF
int nF
nF=nqu or nF=nqu+nux (working variable)
Definition: mbs_linearipk_struct.h:32
MbsData::ux
double * ux
Array with the values of the user variables.
Definition: mbs_data.h:285
mbs_aux.h
mbs_delete_statespace
void mbs_delete_statespace(MbsSS *ss)
Free memory of the state-space structure.
Definition: mbs_statespace.c:542
MbsLpk::nx
int nx
nx=nqu or nux (working variable)
Definition: mbs_linearipk_struct.h:31
mbs_statespace.h
mbs_errors_names.h
MbsSS::nu
int nu
number of input (limited to njoint for the moment as only joint forces are considered as input)
Definition: mbs_statespace_struct.h:16
MbsSS::nx
int nx
number of state, (normally nx=2*nqu)
Definition: mbs_statespace_struct.h:15