コード例 #1
0
        def INACTIVE(self):
            self.activated()

            self.task_uuid = self.parent.device_uuid + '_' + str(uuid.uuid4())

            #create subtask asset
            self.arch2ins = archetypeToInstance(self.taskName, self.task_uuid,
                                                self.parent.device_uuid,
                                                self.master_task_uuid)
            self.taskIns = self.arch2ins.addElement(
                '<ParentRef assetId = "' + str(self.master_task_uuid) + '" />')

            if self.arch2ins.taskCoordinator == self.parent.device_uuid:
                self.parent.adapter.addAsset('Task', self.task_uuid,
                                             self.taskIns)

            self.quorum()
コード例 #2
0
        def INACTIVE(self):
            self.subTask = {}
            self.currentSubTask = str()

            if not self.initialize:
                #execute only once when initiated
                arch2ins = archetypeToInstance(
                    self.parent.coordinator_task, self.master_task_uuid,
                    self.coordinator.coordinator_name)
                self.arch2ins = arch2ins
                self.parent.master_tasks[
                    self.master_task_uuid] = arch2ins.jsonInstance()
                self.taskIns = arch2ins.taskIns
                self.parent.adapter.addAsset('Task', self.master_task_uuid,
                                             arch2ins.taskIns)
                self.initialize = True
                self.activated()
コード例 #3
0
ファイル: cnc_spec.py プロジェクト: mtconnect/ros_mtconnect_2
    with context('move material from conv to cnc'):

        with before.all:
            self.cnc = None
            self.cnc = cnc('localhost', 7791)

            self.cnc.superstate.priority.collab_check = Mock()
            self.cnc.superstate.load_time_limit(20)
            self.cnc.superstate.unload_time_limit(20)
            self.cnc.superstate.open_door_interface.superstate.simulated_duration = 0
            self.cnc.superstate.close_door_interface.superstate.simulated_duration = 0
            self.cnc.superstate.close_chuck_interface.superstate.simulated_duration = 0
            self.cnc.superstate.cycle_time = 0
            self.cnc.superstate.master_uuid = '1'
            self.cnc.superstate.master_tasks['1'] = archetypeToInstance(
                'MoveMaterial_1_good', '1', 'cnc1').jsonInstance()
            self.cnc.superstate.enable()

        with it('should complete successfully'):

            self.cnc.superstate.event(
                'conv', 'Coordinator', 'binding_state', 'PREPARING',
                ['1', self.cnc.superstate.master_tasks['1']], 'conv1')
            expect(self.cnc.superstate.binding_state_material.value()).to(
                equal('PREPARING'))

            self.cnc.superstate.event('conv', 'Coordinator', 'binding_state',
                                      'COMMITTING', '1', 'conv1')
            expect(self.cnc.superstate.binding_state_material.value()).to(
                equal('COMMITTED'))
コード例 #4
0
            self.collaborator.superstate.task_name = 'LoadCnc'
            self.collaborator.superstate.commit_time_limit = 1
            self.collaborator.superstate.unavailable()

        with it('should be INACTIVE initially'):
            expect(self.collaborator.superstate.state).to(
                equal('base:inactive'))
            expect(self.collaborator.superstate.interface.value()).to(
                equal('INACTIVE'))

        with it('should be PREPARING when event received from the Coordinator'
                ):
            self.collaborator.superstate.event(
                'conv', 'Coordinator', 'binding_state', 'PREPARING', [
                    '1',
                    archetypeToInstance('MoveMaterial_1_good', '1',
                                        'conv1').jsonInstance()
                ], 'conv1')
            self.collaborator.superstate.parent.master_uuid = '1'

            expect(self.collaborator.superstate.state).to(
                equal('base:preparing'))
            expect(self.collaborator.superstate.interface.value()).to(
                equal('PREPARING'))

        with it('should be COMMITTED when Coordinator is COMMITTING'):
            self.collaborator.superstate.event('conv', 'Coordinator',
                                               'binding_state', 'COMMITTING',
                                               '1', 'conv1')

            expect(self.collaborator.superstate.state).to(
                equal('base:committed'))
コード例 #5
0
ファイル: cmm_spec.py プロジェクト: mtconnect/ros_mtconnect_2
            expect(self.cmm.superstate.e1.value()).to(equal('READY'))

        with it('should be in controller mode automatic when initialized'):
            expect(self.cmm.superstate.mode1.value()).to(equal('AUTOMATIC'))

    with context('move material from buffer to cmm'):

        with before.all:
            self.cmm = None
            self.cmm = cmm('localhost',7691)

            self.cmm.superstate.priority.collab_check = Mock()
            self.cmm.superstate.load_time_limit(10)
            self.cmm.superstate.unload_time_limit(10)
            self.cmm.superstate.master_uuid = '1'
            self.cmm.superstate.master_tasks['1'] = archetypeToInstance('MoveMaterial_3','1','cmm1').jsonInstance()
            self.cmm.superstate.cycle_time = 0
            self.cmm.superstate.enable()

        with it ('should complete successfully'):
            self.cmm.superstate.event('buffer','Coordinator', 'binding_state', 'PREPARING',['1', self.cmm.superstate.master_tasks['1']],'b1')
            expect(self.cmm.superstate.binding_state_material.value()).to(equal('PREPARING'))

            self.cmm.superstate.event('buffer','Coordinator', 'binding_state', 'COMMITTING','1','b1')
            expect(self.cmm.superstate.binding_state_material.value()).to(equal('COMMITTED'))

            self.cmm.superstate.event('buffer','Coordinator', 'binding_state', 'COMMITTED','1','b1')
            expect(self.cmm.superstate.material_unload.value()).to(equal('NOT_READY'))
            expect(self.cmm.superstate.material_load.value()).to(equal('READY'))
            expect('LoadCmm' in self.cmm.superstate.collaborator.superstate.subTask).to(equal(True))