JRoboUtils.clearModules();
JRoboUtils.addModules(m0);
} catch (Exception e) {
}
Tag tagInput1 = m0.tagTable.createTag("MCHB_111_Input", 0);
Tag tagMasterout1 = m0.tagTable.createTag("MCHB_111_Masterout", 0);
Tag tagSusp1 = m0.tagTable.createTag("MCHB_111_Susp", 0);
Tag tagInput2 = m0.tagTable.createTag("MCHB_222_Input", 0);
Tag tagMasterout2 = m0.tagTable.createTag("MCHB_222_Masterout", 0);
Tag tagSusp2 = m0.tagTable.createTag("MCHB_222_Susp", 0);
Tag tagA2 = m0.tagTable.createTag("A2", 0);
Tag tagInput3 = m0.tagTable.createTag("MCHB_333_Input", 0);
Tag tagMasterout3 = m0.tagTable.createTag("MCHB_333_Masterout", 0);
Tag tagSusp3 = m0.tagTable.createTag("MCHB_333_Susp", 0);
Tag tagA3 = m0.tagTable.createTag("A3", 0);
Tag tagB3 = m0.tagTable.createTag("B3", 0);
Tag tagBb3 = m0.tagTable.createTag("Bb3", 0);
SeqControl m = new SeqControl(m0, "S01", "test seq S01");
m.setTimeStepMs(0);
SeqEntry se1 = m.create("111", "descr 111");
se1.setTime(0, 0);
se1.setDeviceInputTag(tagInput1, 1, 0);
se1.setDeviceStateTag(tagMasterout1, 1);
se1.setDeviceSuspTag(tagSusp1, 1);
SeqEntry se2 = m.create("222", "descr 222");
se2.setTime(2, 1);
se2.setDeviceInputTag(tagInput2, 1, 0);
se2.setDeviceStateTag(tagMasterout2, 1);
se2.setDeviceSuspTag(tagSusp2, 1);
se2.addControlTag(tagA2, 1);
se2.addControlTag(se1.tagOutput, 1);
SeqEntry se3 = m.create("333", "descr 333");
se3.setTime(4, 2);
se3.setDeviceInputTag(tagInput3, 1, 0);
se3.setDeviceStateTag(tagMasterout3, 1);
se3.setDeviceSuspTag(tagSusp3, 1);
se3.addControlTag(tagA3, 1);
se3.addControlTag(se2.tagOutput, 1);
se3.addControlTagGroup();
se3.addControlTag(tagB3, 1);
se3.addControlTag(tagBb3, 1);
se3.addControlTag(se2.tagOutput, 1);
assertEquals(m.tagInput.getName(), "SEQCTL_S01_Input");
assertEquals(m.tagSusp.getName(), "SEQCTL_S01_Susp");
assertEquals(m.tagState.getName(), "SEQCTL_S01_State");
assertEquals(m.tagCntRun.getName(), "SEQCTL_S01_CntRun");
assertEquals(se1.tagInput.getName(), "SEQCTL_S01_111_Input");
assertEquals(se1.tagOutput.getName(), "SEQCTL_S01_111_Output");
assertEquals(se1.tagTimeStart.getName(),"SEQCTL_S01_111_TimeStart");
assertEquals(se1.tagTimeStop.getName(), "SEQCTL_S01_111_TimeStop");
m.execute();
assertEquals(m.tagInput.get(), 0);
assertEquals(m.tagSusp.get(), 0);
assertEquals(m.tagState.get(), 0);
assertEquals(m.tagCntRun.get(), 0);
assertEquals(se1.tagInput.get(), 0);
assertEquals(se1.tagOutput.get(), 0);
assertEquals(se1.tagDeviceInput.get(), 0);
assertEquals(se1.tagDeviceState.get(), 0);
assertEquals(se2.tagInput.get(), 0);
assertEquals(se2.tagOutput.get(), 0);
assertEquals(se2.tagDeviceInput.get(), 0);
assertEquals(se2.tagDeviceState.get(), 0);
assertEquals(se3.tagInput.get(), 0);
assertEquals(se3.tagOutput.get(), 0);
assertEquals(se3.tagDeviceInput.get(), 0);
assertEquals(se3.tagDeviceState.get(), 0);
m.tagInput.set(1);
m.execute();
assertEquals(m.tagState.get(), 2);
assertEquals(m.tagCntRun.get(), 0);
assertEquals(se1.tagInput.get(), 1);
assertEquals(se2.tagInput.get(), 0);
assertEquals(se3.tagInput.get(), 0);
assertEquals(se1.tagOutput.get(), 0);
assertEquals(se2.tagOutput.get(), 0);
assertEquals(se3.tagOutput.get(), 0);
tagMasterout1.set(1);
m.execute();
assertEquals(m.tagState.get(), 2);
assertEquals(m.tagCntRun.get(), 1);
assertEquals(se1.tagInput.get(), 1);
assertEquals(se2.tagInput.get(), 0);
assertEquals(se3.tagInput.get(), 0);
assertEquals(se1.tagOutput.get(), 1);
assertEquals(se2.tagOutput.get(), 0);
assertEquals(se3.tagOutput.get(), 0);
tagA2.set(1);
m.execute();
assertEquals(m.tagState.get(), 2);
assertEquals(m.tagCntRun.get(), 1);
assertEquals(se1.tagInput.get(), 1);
assertEquals(se2.tagInput.get(), 1);
assertEquals(se3.tagInput.get(), 0);
assertEquals(se1.tagOutput.get(), 1);
assertEquals(se2.tagOutput.get(), 0);
assertEquals(se3.tagOutput.get(), 0);
tagMasterout2.set(1);
m.execute();
assertEquals(m.tagState.get(), 2);
assertEquals(m.tagCntRun.get(), 2);
assertEquals(se1.tagInput.get(), 1);
assertEquals(se2.tagInput.get(), 1);
assertEquals(se3.tagInput.get(), 0);
assertEquals(se1.tagOutput.get(), 1);
assertEquals(se2.tagOutput.get(), 1);
assertEquals(se3.tagOutput.get(), 0);
tagA3.set(1);
tagB3.set(1);
tagBb3.set(1);
m.execute();
assertEquals(m.tagState.get(), 1); //2
assertEquals(m.tagCntRun.get(), 2);
assertEquals(se1.tagInput.get(), 1);