public ProgrammableLogicController(SimulationPage simulationPage, SfcEntity sfcEntity) { _simulationPage = simulationPage; _inputRegisters = new ResettingStateTable(_simulationPage.SimulationOutput); _outputRegisters = new ResettingStateTable(_simulationPage.SimulationInput); SfcProgramData = new SfcProgramData(sfcEntity); SfcProgram = new SfcProgram(this); }
private static IDiagramSimulationMaster LoadSfc(ILessonEntity openedLesson, SimulationPage simulationPage) { SfcEntity sfcEntity = SfcEntity.TryLoadFromFile(openedLesson.TemporaryDiagramFilePath); if (sfcEntity == null) { return(null); } return(new Master(sfcEntity, simulationPage)); }
public SfcTestHelper(List <PatchEntity> stepEntities, Test testContext) { SfcEntity sfcEntity = new SfcEntity(); foreach (PatchEntity step in stepEntities) { sfcEntity.AddPatch(step); } SimulationPageMock simulationPageMock = new SimulationPageMock(); _controller = new ProgrammableLogicController(simulationPageMock, sfcEntity); _controller.Startup(); testContext.Assert.IsTrue(_controller.IsLogicValid(), "ProgrammableLogicController->IsLogicValid"); }
/// <summary> /// The step name must be unique to create step references /// </summary> public void UpdateStepNames(SfcEntity sfcEntity) { _patchNameMap.Clear(); _patchStepTimeMap.Clear(); _patchStepStateMap.Clear(); foreach (PatchEntity entity in sfcEntity.Patches) { if (entity.ContainsRealStep()) { EnsureUniqueStepKey(entity); int mapKey = entity.Key; _patchNameMap.Add(entity.StepName, mapKey); _patchStepTimeMap.Add(entity.StepName + ".T", mapKey); _patchStepStateMap.Add(entity.StepName + ".Q", mapKey); } } }
public Master(SfcEntity sfcEntity, SimulationPage simulationPage) { SimulationPage = simulationPage; Plc = new ProgrammableLogicController(simulationPage, sfcEntity); Plc.Startup(); }
/// <summary> /// Returns true if the given step is in the active list /// (Remember: Soon active objects are not in the active list) /// </summary> public bool IsStepActive(int x, int y) { return(_controller.SfcProgramData.IsStepActive(SfcEntity.CalculateMapKey(x, y))); }
public SfcProgramData(SfcEntity sfcEntity) { SfcEntity = sfcEntity; StepMaster = new StepMaster(); StepMaster.UpdateStepNames(sfcEntity); }