HydroSDL/hydro_source/compute_state_dot.cpp

Go to the documentation of this file.
00001 
00012 #include "math.h"
00013 #include "mex.h"   //--This one is required
00014 #include "string.h"
00015 
00016 #include "hydro_includes.h"
00017 
00018 
00019 
00020 #ifndef PI_DEF 
00021 #define pi 3.141592653589793 
00022 #define PI 3.141592653589793 
00023 #endif 
00024 
00025 
00026 
00028 
00037 void compute_state_dot(struct datas *d, struct parameters *P, double *state)
00038 {
00039         int k;
00040 
00041 //      data_init(d);
00042 //      data_update_param(d, P);
00043         data_update_state(d, state);
00044 
00045         //d->tanCal_yaw = d->tanCal_yaw0;
00046 
00047         EE_flat_compute(d);
00048         
00049 
00050 
00051         d->EE_left = d->EE_left_flat;
00052         d->EE_right = d->EE_right_flat;
00053         d->EE_yaw = d->EE_yaw_flat;
00054 
00055         
00056         d->Fac_update = 1.0;
00057 
00058         for (k=0; k<2; k++)
00059         {
00060 
00061                 equ_compute(d);
00062            
00063                 d->EE_left = d->EE_left - d->Fac_update*d->Equ_left/d->dEqu_left;
00064                 d->EE_right = d->EE_right - d->Fac_update*d->Equ_right/d->dEqu_right;
00065                 d->EE_yaw = d->EE_yaw - d->Fac_update*d->Equ_yaw/d->dEqu_yaw;
00066         }
00067 
00068 
00069         if (d->EE_left+d->epsilon < 0) d->EE_left = d->epsilon;
00070         if (d->EE_right+d->epsilon < 0) d->EE_right = d->epsilon;
00071         if (d->EE_left > d->E_foils-d->epsilon) d->EE_left = d->E_foils-d->epsilon;
00072         if (d->EE_right > d->E_foils-d->epsilon) d->EE_right = d->E_foils-d->epsilon;
00073         if (d->EE_yaw > d->E_yaw-d->epsilon) d->EE_yaw = d->E_yaw-d->epsilon;
00074         if (d->EE_yaw+d->epsilon < 0) d->EE_yaw = d->epsilon;
00075 
00076 
00077         angles_compute(d);
00078 
00079         
00080 //      if (d->Tan_AoA_sail < 0)  d->Tan_AoA_sail = 0;
00081 
00082 
00083         aero_coeff_control(d);
00084 
00085         forces_compute(d);
00086 
00087         acceleration_compute(d);
00088 
00089 
00090 /*      //% System definition //unused camera stuff
00091 
00092         if (d->x+P->x_rel < P->x0)
00093         {
00094                 d->dd_cam[0] = 0.0;
00095                 d->dd_cam[1] = 0.0; 
00096                 d->dd_cam[2] = 0.0;
00097                 
00098                 d->d_cam[0] = 0.0;
00099                 d->d_cam[1] = 0.0; 
00100                 d->d_cam[2] = 0.0;
00101         }
00102         else
00103         {
00104                 if (d->t < P->time_stop)
00105                 {
00106                 d->dd_cam[0] = P->Gain * (P->alpha_cam*(d->x_cam - (d->x + P->x_rel)) + P->beta_cam*(d->dx_cam - d->dx));
00107                 d->dd_cam[1] = P->Gain * (P->alpha_cam*(d->y_cam - (d->y + P->y_rel)) + P->beta_cam*(d->dy_cam - d->dy));
00108                 d->dd_cam[2] = P->Gain * (P->alpha_cam*(d->z_cam - (d->z + P->z_rel)) + P->beta_cam*(d->dz_cam - d->dz));
00109                 }
00110                 else
00111                 {
00112     
00113                 d->dd_cam[0] = P->Gain * (P->beta_cam*d->dx_cam/3.0);
00114         d->dd_cam[1] = P->Gain * (P->beta_cam*d->dy_cam/3.0);
00115         d->dd_cam[2] = P->Gain * (P->beta_cam*d->dz_cam/3.0 + 1.0);
00116                 }
00117         }
00118 
00119 */
00120 
00121         
00122 
00123         return;
00124 }
00125 
00126 

Generated on Wed Sep 20 14:30:04 2006 for hydroSDL by  doxygen 1.4.7