def IDLE(self): if self.binding_state_material.value() == 'COMMITTED': self.TRANSITION() self.LOADING() return if not self.check_tool_change_req(): self.adapter.begin_gather() self.e1.set_value("READY") self.adapter.complete_gather() if self.reset_required: time.sleep(2) self.reset_statemachine() self.reset_required = False if not self.check_tool_change_req() or getattr(self,'collaborator',None) == None: self.material_unload_interface.superstate.not_ready() self.material_load_interface.superstate.not_ready() self.collaborator = collaborator( parent = self, interface = self.binding_state_material, collaborator_name = self.device_uuid ) self.collaborator.superstate.unavailable() self.priority.collab_check()
def EXIT_TRANSITION(self): if self.has_material == False: self.is_coordinator = False self.is_collaborator = True self.collaborator = collaborator( parent=self, interface=self.binding_state_material, collaborator_name=self.device_uuid) self.collaborator.superstate.task_name = "LoadCnc" self.collaborator.superstate.unavailable() self.priority.collab_check()
def OPERATIONAL(self): if self.has_material: self.unloading() self.is_coordinator = True self.is_collaborator = False if self.master_uuid in self.master_tasks: del self.master_tasks[self.master_uuid] self.master_uuid = self.device_uuid + '_' + str(uuid.uuid4()) master_task_uuid = copy.deepcopy(self.master_uuid) self.adapter.begin_gather() self.cmm_binding.set_value(master_task_uuid) self.adapter.complete_gather() self.part_quality = self.part_quality_next()[1] if self.part_quality: if self.part_quality == 'rework': self.coordinator_task = "MoveMaterial_5" else: self.coordinator_task = "MoveMaterial_4" + "_" + self.part_quality self.coordinator = coordinator( parent=self, master_task_uuid=master_task_uuid, interface=self.binding_state_material, coordinator_name=self.device_uuid) self.coordinator.superstate.task_name = "UnloadCmm" self.coordinator.superstate.unavailable() elif self.has_material == False: self.loading() self.is_coordinator = False self.is_collaborator = True self.collaborator = collaborator( parent=self, interface=self.binding_state_material, collaborator_name=self.device_uuid) self.collaborator.superstate.task_name = "LoadCmm" self.collaborator.superstate.unavailable() self.priority.collab_check() else: self.start()
def OPERATIONAL(self): part_order = self.part_order() if part_order == "coordinator": self.unloading() self.is_coordinator = True self.is_collaborator = False if self.master_uuid in self.master_tasks: del self.master_tasks[self.master_uuid] self.master_uuid = self.device_uuid + '_' + str(uuid.uuid4()) master_task_uuid = copy.deepcopy(self.master_uuid) self.adapter.begin_gather() self.conv1_binding.set_value(self.master_uuid) self.adapter.complete_gather() self.coordinator_task = "MoveMaterial_1" self.coordinator = coordinator( parent=self, master_task_uuid=master_task_uuid, interface=self.binding_state_material, coordinator_name=self.device_uuid) self.coordinator.superstate.task_name = "UnloadConv" self.coordinator.superstate.unavailable() elif part_order == "collaborator": self.loading() self.is_coordinator = False self.is_collaborator = True self.collaborator = collaborator( parent=self, interface=self.binding_state_material, collaborator_name=self.device_uuid) self.collaborator.superstate.task_name = "LoadConv" self.collaborator.superstate.unavailable() self.priority.collab_check() else: if part_order == None: self.cell_part(current_part="reset") else: self.cell_part(current_part=self.current_part)
def IDLE(self): if len(self.buffer) > 0: self.has_material = True else: self.has_material = False if self.binding_state_material.value() != "COMMITTED": if self.has_material: self.is_coordinator = True self.is_collaborator = False self.material_load_interface.superstate.DEACTIVATE() else: self.is_coordinator = False self.is_collaborator = True self.material_unload_interface.superstate.DEACTIVATE() if not self.has_material: self.collaborator = collaborator( parent=self, interface=self.binding_state_material, collaborator_name=self.device_uuid) self.collaborator.superstate.task_name = "LoadBuffer" self.collaborator.superstate.unavailable() self.material_load_interface.superstate.IDLE() self.priority.collab_check() if self.has_material: if self.master_uuid in self.master_tasks: del self.master_tasks[self.master_uuid] self.master_uuid = self.device_uuid + '_' + str( uuid.uuid4()) master_task_uuid = copy.deepcopy(self.master_uuid) self.coordinator_task = "MoveMaterial_3" self.adapter.begin_gather() self.buffer_binding.set_value(master_task_uuid) self.adapter.complete_gather() self.coordinator = coordinator( parent=self, master_task_uuid=master_task_uuid, interface=self.binding_state_material, coordinator_name=self.device_uuid) self.coordinator.superstate.task_name = "UnloadBuffer" self.coordinator.superstate.unavailable() self.material_unload_interface.superstate.IDLE()
def EXITING_IDLE(self): if self.has_material: self.unloading() self.is_coordinator = True self.is_collaborator = False if self.master_uuid in self.master_tasks: del self.master_tasks[self.master_uuid] self.master_uuid = self.device_uuid + '_' + str(uuid.uuid4()) master_task_uuid = copy.deepcopy(self.master_uuid) self.adapter.begin_gather() self.cnc_binding.set_value(master_task_uuid) self.adapter.complete_gather() self.coordinator_task = "MoveMaterial_2" self.coordinator = coordinator( parent=self, master_task_uuid=master_task_uuid, interface=self.binding_state_material, coordinator_name=self.device_uuid) self.coordinator.superstate.task_name = "UnloadCnc" self.coordinator.superstate.unavailable() else: self.loading() self.is_coordinator = False self.is_collaborator = True self.collaborator = collaborator( parent=self, interface=self.binding_state_material, collaborator_name='cnc1') self.collaborator.superstate.task_name = "LoadCnc" self.collaborator.superstate.unavailable() self.priority.collab_check()