from montchg_lib import * # Bibliothèque utilisateur du monte-charge ############################################################################### # montchg_cmd.py # @title: Commandes du monte-charge ############################################################################### ############################################################################### # Instructions élémentaires pour le monte-charge # # Actions (ordre = True ou False) : # - Monter le monte-charge (moteur sens trigo) : mot_m(True | False) # - Descendre le monte-charge (moteur sens horaire) : mot_d(True | False) # # Capteurs (valeur retournée = True ou False) : # - Capteur présence cabine niveau 0 : pc_0() # - Capteur présence cabine niveau 1 : pc_1() # # Consignes du pupitre (valeur retournée = True ou False) : # - Bouton poussoir appel niveau 0 : ba_0() # - Bouton poussoir appel niveau 1 : ba_1() # # Retours d'information du pupitre (allumer = True ou False) : # - Voyant témoin d'étage niveau 0 : voy_0(True | False) # - Voyant témoin d'étage niveau 1 : voy_1(True | False) # # Gestion du temps : # - Temporisation en seconde : tempo(duree) # ############################################################################### ############################################################################### # Fonctions ############################################################################### ############################################################################### # Commandes ############################################################################### def commandes(): # Init -> Descendre while pc_0() ==False : voy_0(True) mot_m(False) mot_d(True) mot_d(False) voy_0(False) print ("") daq(['mot_angle', 'mot_vitesse', 'cabine_z', 'cabine_vitesse']) # Monter mot_digitset (500) t0,z0, a0= get('t'), get('cabine_z'), get('mot_angle') print ("Début monter : cabine_z : "+str(round(z0, 3)) + " - mot_angle : " + str(round(a0, 3))) while pc_1() ==False : voy_1(True) mot_d(False) mot_m(True) mot_pas, mot_vitesse, cabine_pas, cabine_vitesse= get('mot_pas'), get('mot_vitesse'), get('cabine_pas'), get('cabine_vitesse') mot_m(False) voy_1(False) t1,z1, a1= get('t'), get('cabine_z'), get('mot_angle') print ("Fin monter : cabine_z : "+str(round(z1, 3)) + " - mot_angle : " + str(round(a1, 3))) print ("") print ("Monter : "+str(round(t1-t0, 3)) +" s - distance : " +str(round(z1-z0, 3))+" mm - angle : " +str(round(a1-a0, 3))+ " rad - cabine_vitesse : " +str(round(cabine_vitesse, 3))+" mm/s - moteur_vitesse : " +str(round(mot_vitesse, 3))+ " rad/s - cabine_pas : " +str(round(cabine_pas, 3))+" mm/impulsion - moteur_pas : " +str(round(mot_pas, 3))+" rad/impulsion") print ("") # Descendre mot_digitset () # 5 tr/s t0,z0, a0= get('t'), get('cabine_z'), get('mot_angle') print ("Début descendre : cabine_z : "+str(round(z0, 3)) + " - mot_angle : " + str(round(a0, 3))) while pc_0() ==False : voy_0(True) mot_m(False) mot_d(True) mot_pas, mot_vitesse, cabine_pas, cabine_vitesse= get('mot_pas'), get('mot_vitesse'), get('cabine_pas'), get('cabine_vitesse') mot_d(False) voy_0(False) t1,z1, a1= get('t'), get('cabine_z'), get('mot_angle') print ("Fin descendre : cabine_z : "+str(round(z1, 3)) + " - mot_angle : " + str(round(a1, 3))) print ("") print ("Descendre : "+str(round(t1-t0, 3)) +" s - distance : " +str(round(z1-z0, 3))+" mm - angle : " +str(round(a1-a0, 3))+ " rad - cabine_vitesse : " +str(round(cabine_vitesse, 3))+" mm/s - moteur_vitesse : " +str(round(mot_vitesse, 3))+ " rad/s - cabine_pas : " +str(round(cabine_pas, 3))+" mm/impulsion - moteur_pas : " +str(round(mot_pas, 3))+" rad/impulsion") fin() # A garder ############################################################################### # En: External call << DONT CHANGE THIS SECTION >> # Fr: Appel externe << NE PAS MODIFIER CETTE SECTION >> ############################################################################### if __name__=='start': thread_cmd_start(commandes) if __name__=='stop': stop()