Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

RunThat

# **Toutes les dimensions sont en mètres**
# Dimensions de la navette
global navette_cyl_h = 27.93
global navette_cyl_r = 3.5
global navette_cone_h = 9.31
global navette_cone_r = navette_cyl_r

global navette_masse_kg = 109 * 1000

# Dimensions du réservoir
global reservoir_cyl_h = 39.1
global reservoir_cyl_r = 4.2
global reservoir_cone_h = 7.8
global reservoir_cone_r = reservoir_cyl_r

global reservoir_cyl_h_hydrogene = (reservoir_cyl_h + reservoir_cone_h)*(2/3)
global reservoir_cyl_h_oxygene = (reservoir_cyl_h - reservoir_cyl_h_hydrogene)

global reservoir_masse_kg_hydrogene = 108 * 1000
global reservoir_masse_kg_oxygene = 631 * 1000

# Dimensions des propulseurs d'appoint
global booster_cyl_h = 39.9
global booster_cyl_r = 1.855
global booster_cone_h = 5.6
global booster_cone_r = booster_cyl_r

global booster_masse_kg = 469 * 1000


function centre_de_masse = CentreDeMasse(AngRot, posNL)
  %Navette
  global navette_cyl_h;
  global navette_cone_h;
  global navette_cyl_r;
  global navette_cone_r;
  global reservoir_cyl_h;
  global reservoir_cone_h;
  global reservoir_cyl_r;
  global reservoir_cone_r;
  global reservoir_cyl_h_hydrogene;
  global reservoir_cyl_h_oxygene;
  global booster_cyl_r;
  global booster_cone_r;
  global booster_cyl_h;
  global booster_cone_h;
  
  global navette_masse_kg;
  global reservoir_masse_kg_hydrogene;
  global reservoir_masse_kg_oxygene;
  global booster_masse_kg;
  
  %Cylindre de la navette
  global navette_cyl_c = [0; 0; navette_cyl_h/2];
  %Cône de la navette
  global navette_cone_c = [0; 0; navette_cyl_h + navette_cone_h/4];
  
  %Cylindre de la réservoir (2/3 en bas)
  global reservoir_cyl_hydrogene_c = [0; navette_cyl_r + reservoir_cyl_r; reservoir_cyl_h_hydrogene * 1/2];
  %Cylindre de la réservoir (1/3 en haut)
  global reservoir_cyl_oxygene_c = [0; navette_cyl_r + reservoir_cyl_r; reservoir_cyl_h - reservoir_cyl_h_oxygene /2];
  %Cône de la réservoir
  global reservoir_cone_c = [0; navette_cone_r +  reservoir_cone_r; reservoir_cyl_h + reservoir_cone_h/4];

  % Propulseur gauche
  global booster_cyl_gauche_c = [
    -(reservoir_cyl_r + booster_cyl_r);
    (navette_cyl_r + reservoir_cyl_r);
    booster_cyl_h/2];

  global booster_cone_gauche_c = [
    -(reservoir_cyl_r + booster_cyl_r);
    (navette_cyl_r + reservoir_cyl_r);
    (booster_cyl_h + booster_cone_h/4)];

  % Propulseur droite
  global booster_cyl_droite_c = [
    -booster_cyl_gauche_c(1);
    booster_cyl_gauche_c(2);
    booster_cyl_gauche_c(3)];

  global booster_cone_droite_c = [
    -booster_cone_gauche_c(1);
    booster_cone_gauche_c(2);
    booster_cone_gauche_c(3)];
    
  % Volume des parties de la navette 
  navette_cyl_volume = navette_cyl_r^2 * pi * navette_cyl_h;
  navette_cone_volume = (navette_cone_r^2 * pi * navette_cone_h) / 3;
  navette_total_volume = navette_cyl_volume + navette_cone_volume;
  
  % Masse des parties de la navette
  global navette_cyl_masse_kg = navette_cyl_volume / navette_total_volume * navette_masse_kg;
  global navette_cone_masse_kg = navette_cone_volume / navette_total_volume * navette_masse_kg;
  
  % Volume des parties des propulseurs
  booster_cyl_volume = (pi*booster_cyl_r^2) * booster_cyl_h;
  booster_cone_volume = (pi*booster_cone_h*booster_cone_r^2) / 3;
  booster_total_volume = booster_cyl_volume + booster_cone_volume;        
  
  % Masse des parties des propulseurs
  global booster_cyl_masse_kg = booster_cyl_volume / booster_total_volume * booster_masse_kg;
  global booster_cone_masse_kg = booster_cone_volume / booster_total_volume * booster_masse_kg;
  
  % Volume des parties du réservoir
  reservoir_cyl_oxygene_volume = (pi*reservoir_cyl_r^2) * reservoir_cyl_h_oxygene;
  reservoir_cone_volume = (pi*reservoir_cone_h*reservoir_cone_r^2) / 3;
  reservoir_oxygene_total_volume = reservoir_cyl_oxygene_volume + reservoir_cone_volume;
  
  % Masse des parties du réservoir
  global reservoir_cyl_oxygene_masse_kg = reservoir_cyl_oxygene_volume / reservoir_oxygene_total_volume * reservoir_masse_kg_oxygene; 
  global reservoir_cone_oxygene_masse_kg = reservoir_cone_volume / reservoir_oxygene_total_volume * reservoir_masse_kg_oxygene;
  
  % Masse totale de la fusée
  global masse_totale = reservoir_masse_kg_hydrogene + reservoir_masse_kg_oxygene + navette_masse_kg + booster_masse_kg * 2;
  
  % Somme pondérée
  global c_de_masse = (navette_cone_c * navette_cone_masse_kg + navette_cyl_c * navette_cyl_masse_kg +
                     reservoir_cone_c * reservoir_cone_oxygene_masse_kg + reservoir_cyl_hydrogene_c * reservoir_masse_kg_hydrogene + 
                     reservoir_cyl_oxygene_c * reservoir_cyl_oxygene_masse_kg +
                     (booster_cone_droite_c + booster_cone_gauche_c)* booster_cone_masse_kg +
                     (booster_cyl_droite_c + booster_cyl_gauche_c) * booster_cyl_masse_kg) / masse_totale;
  
  % Matrice de rotation autour de x
  R_x = [1, 0, 0; 0, cos(AngRot), -sin(AngRot); 0, sin(AngRot), cos(AngRot)];
  % Appliquer la rotation
  %c_rot = R_x * (c_de_masse + posNL);
  
  c_rot = R_x * c_de_masse;
  %Appliquer la translation
  centre_de_masse = c_rot + posNL;  
  
endfunction

function moment_inertie = MomentInertie(AngRot, posNL)
  global navette_cyl_h;
  global navette_cone_h;
  global navette_cyl_r;
  global navette_cone_r;
  global reservoir_cyl_h;
  global reservoir_cone_h;
  global reservoir_cyl_r;
  global reservoir_cone_r;
  global reservoir_cyl_h_hydrogene;
  global reservoir_cyl_h_oxygene;
  global booster_cyl_r;
  global booster_cone_r;
  global booster_cyl_h;
  global booster_cone_h;
  
  global reservoir_cyl_oxygene_masse_kg;
  global reservoir_cone_oxygene_masse_kg;
  global reservoir_masse_kg_hydrogene;
  global navette_cone_masse_kg;
  global navette_cyl_masse_kg;
  global booster_cyl_masse_kg;
  global booster_cone_masse_kg;
  global masse_totale;
  % centre de masses
  global navette_cyl_c;
  global navette_cone_c;
  global reservoir_cyl_hydrogene_c;
  global reservoir_cyl_oxygene_c;
  global reservoir_cone_c;
  global booster_cyl_gauche_c;
  global booster_cyl_droite_c;
  global booster_cone_droite_c;
  global booster_cone_gauche_c;
  global c_de_masse;
  
  % Moment inertie locale
  %reservoir (local)
  reservoir_cone_oxygene_I = MomentInertieCone(reservoir_cone_oxygene_masse_kg , reservoir_cone_r, reservoir_cone_h);
  reservoir_cyl_oxygene_I = MomentInertieCyl(reservoir_cyl_oxygene_masse_kg , reservoir_cyl_r, reservoir_cyl_h_oxygene);
  reservoir_cyl_hydrogene_I = MomentInertieCyl(reservoir_masse_kg_hydrogene , reservoir_cyl_r, reservoir_cyl_h_hydrogene);
  
  %navette(local)
  navette_cone_I = MomentInertieCone(navette_cone_masse_kg , navette_cone_r, navette_cone_h);
  navette_cyl_I = MomentInertieCyl(navette_cyl_masse_kg , navette_cyl_r, navette_cyl_h);
  
  %propulseurs(local)
  booster_cone_I = MomentInertieCone(booster_cone_masse_kg , booster_cone_r, booster_cone_h);
  booster_cyl_I = MomentInertieCyl(booster_cyl_masse_kg , booster_cyl_r, booster_cyl_h);
  
  %distance entre les centres de masses des parties et le centre de masse fusee
  d_reservoir_cone = reservoir_cone_c - c_de_masse;
  d_reservoir_cyl_oxygene = reservoir_cyl_oxygene_c - c_de_masse;
  d_reservoir_cyl_hydrogene = reservoir_cyl_hydrogene_c - c_de_masse;
  d_navette_cone = navette_cone_c - c_de_masse;
  d_navette_cyl = navette_cyl_c - c_de_masse;
  d_booster_cyl_gauche = booster_cyl_gauche_c - c_de_masse;
  d_booster_cyl_droite = booster_cyl_droite_c - c_de_masse;
  d_booster_cone_gauche = booster_cone_droite_c - c_de_masse;
  d_booster_cone_droite = booster_cone_gauche_c - c_de_masse;
  
  % Moment inertie par rapport au centre de masse de la fusee
  % reservoir
  reservoir_cone_I_G = reservoir_cone_oxygene_I +  reservoir_cone_oxygene_masse_kg  * MatriceTranslation(d_reservoir_cone);  
  reservoir_cyl_oxygene_I_G = reservoir_cyl_oxygene_I + reservoir_cyl_oxygene_masse_kg  * MatriceTranslation(d_reservoir_cyl_oxygene);
  reservoir_cyl_hydrogene_I_G = reservoir_cyl_hydrogene_I + reservoir_masse_kg_hydrogene  * MatriceTranslation(d_reservoir_cyl_hydrogene);
  
  %navette
  navette_cone_I_G = navette_cone_I + navette_cone_masse_kg  * MatriceTranslation(d_navette_cone);
  navette_cyl_I_G = navette_cyl_I + navette_cyl_masse_kg  * MatriceTranslation(d_navette_cyl);
  
  %propulseur 
  booster_cone_gauche_I_G = booster_cone_I + booster_cone_masse_kg  * MatriceTranslation(d_booster_cone_gauche);
  booster_cyl_gauche_I_G = booster_cyl_I + booster_cyl_masse_kg  * MatriceTranslation(d_booster_cyl_gauche);
  booster_cone_droite_I_G = booster_cone_I + booster_cone_masse_kg  * MatriceTranslation(d_booster_cone_droite);
  booster_cyl_droite_I_G = booster_cyl_I + booster_cyl_masse_kg  * MatriceTranslation(d_booster_cyl_droite);
  
  % Somme des moments d'inertie
  fusee_I = (reservoir_cone_I_G + reservoir_cyl_oxygene_I_G + reservoir_cyl_hydrogene_I_G + navette_cone_I_G + navette_cyl_I_G + booster_cone_gauche_I_G + booster_cone_droite_I_G + booster_cyl_gauche_I_G + booster_cyl_droite_I_G);

  % Ramener dans le système d'axes du laboratoire en appliquant la rotation du système local
  % Matrice de rotation autour de x
  R_x = [1, 0, 0; 0, cos(AngRot), -sin(AngRot); 0, sin(AngRot), cos(AngRot)];
  R_x_inverse = inv(R_x);

  % Appliquer la rotation
  global moment_inertie = R_x * fusee_I * R_x_inverse;
    
endfunction

function momentinertiecone = MomentInertieCone(m, r, h)
  momentinertiecone = m * [(12*r^2 + 3*h^2)/80, 0, 0; 0, (12*r^2 + 3*h^2)/80, 0; 0, 0, (3*r^2)/10];
endfunction

function momentinertiecyl = MomentInertieCyl(m, r, h)
  momentinertiecyl = m * [(r^2)/4 + (h^2)/12, 0, 0; 0, (r^2)/4 + (h^2)/12, 0; 0, 0, (r^2)/2];
endfunction

function matricetranslation = MatriceTranslation(d)
  matricetranslation = [(d(2)^2 + d(3)^2), -d(1)*d(2), -d(1)*d(3);
                        -d(2)*d(1), (d(1)^2 + d(3)^2), -d(2)*d(3);
                        -d(3)*d(1), -d(3)*d(2), (d(1)^2 + d(2)^2)];
endfunction

function a_ang = AccelerationAngulaire(AngRot, vangulaire, forces)
  global c_de_masse;
  global moment_inertie;
  
  global reservoir_cyl_r;
  global navette_cyl_r;
  global booster_cyl_r;
  
  moment_cinetique = moment_inertie * vangulaire;
  
  d_force_booster_gauche = [-reservoir_cyl_r-booster_cyl_r; navette_cyl_r+reservoir_cyl_r; 0] - c_de_masse;
  d_force_booster_droite = [reservoir_cyl_r+booster_cyl_r; navette_cyl_r+reservoir_cyl_r; 0] - c_de_masse;
  d_force_navette = [0;0;0] - c_de_masse;

  moment_navette = cross(d_force_navette, [0; 0; forces(1)]);
  moment_booster_gauche = cross(d_force_booster_gauche, [0; 0; forces(2)]);
  moment_booster_droite = cross(d_force_booster_droite, [0; 0; forces(3)]);
  
  somme_moments = moment_navette + moment_booster_gauche + moment_booster_droite;
  
  % Matrice de rotation autour de x pour les moments de force
  R_x = [1, 0, 0; 0, cos(AngRot), -sin(AngRot); 0, sin(AngRot), cos(AngRot)];
  moments_rot = R_x * somme_moments;
  
  % alpha = I^-1 * (tau + L x omega)
  a_ang = inverse(moment_inertie)*(moments_rot+cross(moment_cinetique, vangulaire));
  
endfunction

function [pcmNL INL alphaNL]=Devoir1(AngRot, vangulaire, forces, posNL)
  format short g
  % Load les valeurs
  % Centre de masse
  pcmNL = CentreDeMasse(AngRot, posNL);

  % Moment inertie
  INL = MomentInertie(AngRot, posNL);
  
  % Accélération angulaire
  alphaNL = AccelerationAngulaire(AngRot, vangulaire, forces);
endfunction

[pcmNL INL alphaNL] = Devoir1(-pi/3, [-0.54;0;0], [11000000;8750000;0], [0;-19.6075;50])
display(pcmNL)
display(INL)
display(alphaNL)
 


Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.