Advertisement
Guest User

abc

a guest
Apr 28th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 5.41 KB | None | 0 0
  1. with ada.Text_IO,
  2.      p_simu_atelier,
  3.      P_SEMAPHORE;
  4. use ada.Text_IO,
  5.     p_simu_atelier,
  6.     P_SEMAPHORE;
  7.  
  8.  
  9. procedure Main is
  10.    B:array (1..3) of Boolean:=(others=>false); -- déclaration du tableau des bool qui sert à la gestion
  11.  
  12.    task T_stock_amont is  --déclaration des specfs de la tache amont
  13.       entry prendre ;
  14.       entry fin_prendre ; --je pense qu'elle ne sert à rien dans le process
  15.    end T_stock_amont;
  16.  
  17.    task T_stock_avale is --déclaration des specfs de la tache avale
  18.       entry poser ;
  19.       entry fin_poser; -- je pense qu'elle ne sert à rien dans le process
  20.    end T_stock_avale ;
  21.  
  22.    task robot_charge is -- déclaration des specfs de la tache robot de chargement
  23.       entry chercher (num_tours:T_LIEU);
  24.       entry fin_chercher;
  25.    end robot_charge ;
  26.  
  27.    task robot_decharge is
  28.       entry chercher_d (num_tours:T_LIEU;num_biss:T_NUM_TOUR);
  29.       entry fin_chercher_d;
  30.    end robot_decharge ;
  31.  
  32.    task type t_tours is --déclaration de la tache des tours , specfs la tours et l'ident de pieces
  33.       entry init (num_tours:T_LIEU;pieces:T_piece;num:T_NUM_TOUR;num_bis:Natural);
  34.    end t_tours ;
  35.  
  36.    task body T_stock_amont is --déclaration du body d'amont
  37.    begin
  38.       loop
  39.          accept prendre ;
  40.          accept fin_prendre;
  41.       end loop ;
  42.    end T_stock_amont;
  43.  
  44.    task body T_stock_avale is --déclaration du body d'avale
  45.    begin
  46.       loop
  47.          accept poser ;
  48.          accept fin_poser ;
  49.       end loop ;
  50.    end T_stock_avale ;
  51.  
  52.    task body robot_charge is
  53.       numero_tours:T_LIEU;
  54.    begin
  55.       loop
  56.          accept chercher (num_tours : in T_lieu) do
  57.             numero_tours:=num_tours;
  58.             T_stock_amont.prendre;
  59.             DEPLACER_ROBOT(NUM_CELLULE => 1,
  60.                         NUM_ROBOT   => 1,
  61.                         ORIGINE     => REPOS,
  62.                         DESTINATION => STOCK_AMONT);
  63.             fermer_pince(1,1);
  64.             T_stock_amont.fin_prendre;
  65.             DEPLACER_ROBOT(NUM_CELLULE => 1,
  66.                            NUM_ROBOT   =>1 ,
  67.                            ORIGINE     => STOCK_AMONT,
  68.                            DESTINATION =>REPOS );
  69.             DEPLACER_ROBOT(NUM_CELLULE => 1,
  70.                            NUM_ROBOT   =>1 ,
  71.                            ORIGINE     => REPOS,
  72.                            DESTINATION => numero_tours);
  73.             end chercher;
  74.  
  75.          accept fin_chercher;
  76.       end loop ;
  77.    end robot_charge;
  78.    TT:T_SEMAPHORE;
  79.    task body t_tours is
  80.       numero_tours: T_LIEU ;
  81.       para_pience : T_piece;
  82.       num_c:T_NUM_TOUR;
  83.       num_b:Natural;
  84.    begin
  85.       loop
  86.  
  87.          accept init (num_tours : in T_LIEU; pieces : in T_piece;num:T_NUM_TOUR;num_bis:Natural) do
  88.             numero_tours:=num_tours ;
  89.             para_pience:=pieces ;
  90.             num_c:=num;
  91.             num_b:=num_bis;
  92.          end init;
  93.          --TT.init(1);
  94.          B(num_b):=True; -- mettre à jours le tableau de bool - pièce en place donc true
  95.          --TT.Lock;
  96.          robot_charge.chercher(numero_tours);
  97.          robot_charge.fin_chercher;
  98.          engager_robot(1,1,num_c);
  99.          ouvrir_pince(1,1);
  100.          DESENGAGER_ROBOT(1,1,num_c);
  101.          --ouvrir_pince(1,1);
  102.          deplacer_robot(1,1,numero_tours,repos);
  103.                   --TT.unlock;
  104.  
  105.          B(num_b):=True;
  106.          B(num_b+1):=False;
  107.  
  108.          SERRER_MANDRIN(NUM_CELLULE => 1,
  109.                         NUM_TOUR    => num_c);
  110.          usiner(1,num_c,para_pience);
  111.                     -- il y a erreur que j'arrive pas à résoudre , le robot est déplacer vers le tour 2 alors qu'il est en 1 double demande
  112.  
  113.          desserer_mandrin(1,num_c);
  114.          robot_decharge.chercher_d(numero_tours,num_c);
  115.          robot_decharge.fin_chercher_d;
  116.          B(num_b):=false; -- :mettre à jour le tableau de bool - pièce usiner donc false
  117.       end loop ;
  118.       end t_tours; --il me dit qu'il y a erreur sur ce begin mais je sais pas .... c'est pas nrml
  119.    T:array(1..3) of t_tours ;
  120.  
  121.  
  122.    task body robot_decharge is
  123.       numeros_tours:T_LIEU;
  124.       num_nice:T_NUM_TOUR;
  125.    begin
  126.       loop
  127.          accept chercher_d(num_tours : in T_lieu;num_biss:T_NUM_TOUR) do
  128.             numeros_tours:=num_tours;
  129.             num_nice:=num_biss;
  130.          end chercher_d;
  131.          deplacer_robot(1,2,repos,numeros_tours);
  132.          engager_robot(1,2,num_nice);
  133.          fermer_pince(1,2);
  134.          desengager_robot(1,2,num_nice);
  135.          accept fin_chercher_d;
  136.          deplacer_robot(1,2,numeros_tours,stock_aval);
  137.          T_stock_avale.poser;
  138.          ouvrir_pince(1,2);
  139.          T_stock_avale.fin_poser;
  140.          deplacer_robot(1,2,stock_aval,repos);
  141.       end loop ;
  142.    end robot_decharge;
  143.    pp_piece:T_PIECE;
  144.    num:T_NUM_TOUR;
  145.    n_t:T_LIEU;
  146.    --num_bis:Natural;
  147. begin
  148.       B(1):=false;
  149.  
  150.                                pp_piece.num_piece:=10;
  151.      loop                           pp_piece.num_gamme:=10;
  152.      for i in 1..3 loop
  153.       if not B(i) then
  154.          if i=1 then
  155.             n_t:=TOUR_1;
  156.             num:=1;
  157.          elsif i=2 then
  158.             n_t:=TOUR_2;
  159.             num:=2;
  160.          elsif i=3 then
  161.             n_t:=TOUR_3;
  162.             num:=3;
  163.          end if ;
  164.  
  165.  
  166.  
  167.  
  168.          T(i).init(num_tours =>n_t ,
  169.                   pieces    => pp_piece,
  170.                   num       => num,
  171.                    num_bis   => i) ;
  172.             end if ;
  173.       end loop;
  174.       end loop ;
  175.  
  176. end Main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement