Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with ada.Text_IO,
- p_simu_atelier,
- P_SEMAPHORE;
- use ada.Text_IO,
- p_simu_atelier,
- P_SEMAPHORE;
- procedure Main is
- B:array (1..3) of Boolean:=(others=>false); -- déclaration du tableau des bool qui sert à la gestion
- task T_stock_amont is --déclaration des specfs de la tache amont
- entry prendre ;
- entry fin_prendre ; --je pense qu'elle ne sert à rien dans le process
- end T_stock_amont;
- task T_stock_avale is --déclaration des specfs de la tache avale
- entry poser ;
- entry fin_poser; -- je pense qu'elle ne sert à rien dans le process
- end T_stock_avale ;
- task robot_charge is -- déclaration des specfs de la tache robot de chargement
- entry chercher (num_tours:T_LIEU);
- entry fin_chercher;
- end robot_charge ;
- task robot_decharge is
- entry chercher_d (num_tours:T_LIEU;num_biss:T_NUM_TOUR);
- entry fin_chercher_d;
- end robot_decharge ;
- task type t_tours is --déclaration de la tache des tours , specfs la tours et l'ident de pieces
- entry init (num_tours:T_LIEU;pieces:T_piece;num:T_NUM_TOUR;num_bis:Natural);
- end t_tours ;
- task body T_stock_amont is --déclaration du body d'amont
- begin
- loop
- accept prendre ;
- accept fin_prendre;
- end loop ;
- end T_stock_amont;
- task body T_stock_avale is --déclaration du body d'avale
- begin
- loop
- accept poser ;
- accept fin_poser ;
- end loop ;
- end T_stock_avale ;
- task body robot_charge is
- numero_tours:T_LIEU;
- begin
- loop
- accept chercher (num_tours : in T_lieu) do
- numero_tours:=num_tours;
- T_stock_amont.prendre;
- DEPLACER_ROBOT(NUM_CELLULE => 1,
- NUM_ROBOT => 1,
- ORIGINE => REPOS,
- DESTINATION => STOCK_AMONT);
- fermer_pince(1,1);
- T_stock_amont.fin_prendre;
- DEPLACER_ROBOT(NUM_CELLULE => 1,
- NUM_ROBOT =>1 ,
- ORIGINE => STOCK_AMONT,
- DESTINATION =>REPOS );
- DEPLACER_ROBOT(NUM_CELLULE => 1,
- NUM_ROBOT =>1 ,
- ORIGINE => REPOS,
- DESTINATION => numero_tours);
- end chercher;
- accept fin_chercher;
- end loop ;
- end robot_charge;
- TT:T_SEMAPHORE;
- task body t_tours is
- numero_tours: T_LIEU ;
- para_pience : T_piece;
- num_c:T_NUM_TOUR;
- num_b:Natural;
- begin
- loop
- accept init (num_tours : in T_LIEU; pieces : in T_piece;num:T_NUM_TOUR;num_bis:Natural) do
- numero_tours:=num_tours ;
- para_pience:=pieces ;
- num_c:=num;
- num_b:=num_bis;
- end init;
- --TT.init(1);
- B(num_b):=True; -- mettre à jours le tableau de bool - pièce en place donc true
- --TT.Lock;
- robot_charge.chercher(numero_tours);
- robot_charge.fin_chercher;
- engager_robot(1,1,num_c);
- ouvrir_pince(1,1);
- DESENGAGER_ROBOT(1,1,num_c);
- --ouvrir_pince(1,1);
- deplacer_robot(1,1,numero_tours,repos);
- --TT.unlock;
- B(num_b):=True;
- B(num_b+1):=False;
- SERRER_MANDRIN(NUM_CELLULE => 1,
- NUM_TOUR => num_c);
- usiner(1,num_c,para_pience);
- -- 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
- desserer_mandrin(1,num_c);
- robot_decharge.chercher_d(numero_tours,num_c);
- robot_decharge.fin_chercher_d;
- B(num_b):=false; -- :mettre à jour le tableau de bool - pièce usiner donc false
- end loop ;
- end t_tours; --il me dit qu'il y a erreur sur ce begin mais je sais pas .... c'est pas nrml
- T:array(1..3) of t_tours ;
- task body robot_decharge is
- numeros_tours:T_LIEU;
- num_nice:T_NUM_TOUR;
- begin
- loop
- accept chercher_d(num_tours : in T_lieu;num_biss:T_NUM_TOUR) do
- numeros_tours:=num_tours;
- num_nice:=num_biss;
- end chercher_d;
- deplacer_robot(1,2,repos,numeros_tours);
- engager_robot(1,2,num_nice);
- fermer_pince(1,2);
- desengager_robot(1,2,num_nice);
- accept fin_chercher_d;
- deplacer_robot(1,2,numeros_tours,stock_aval);
- T_stock_avale.poser;
- ouvrir_pince(1,2);
- T_stock_avale.fin_poser;
- deplacer_robot(1,2,stock_aval,repos);
- end loop ;
- end robot_decharge;
- pp_piece:T_PIECE;
- num:T_NUM_TOUR;
- n_t:T_LIEU;
- --num_bis:Natural;
- begin
- B(1):=false;
- pp_piece.num_piece:=10;
- loop pp_piece.num_gamme:=10;
- for i in 1..3 loop
- if not B(i) then
- if i=1 then
- n_t:=TOUR_1;
- num:=1;
- elsif i=2 then
- n_t:=TOUR_2;
- num:=2;
- elsif i=3 then
- n_t:=TOUR_3;
- num:=3;
- end if ;
- T(i).init(num_tours =>n_t ,
- pieces => pp_piece,
- num => num,
- num_bis => i) ;
- end if ;
- end loop;
- end loop ;
- end Main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement