Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        /// <summary>
        /// Executes the ations with the marked qualifier in the given program context and delta time
        /// </summary>
        public void ExecuteActions(SfcProgram context, ActionQualifier qualifier, int deltaTimeMs)
        {
            List <AssignmentExpression> actions = _actions[qualifier];

            foreach (AssignmentExpression action in actions)
            {
                action.Execute(context.Plc);
            }
            UpdateStepCounter(qualifier, deltaTimeMs);
        }
Esempio n. 3
0
 /// <summary>
 /// Calculates the transitions and updates the step status according to the result
 /// </summary>
 public void CalculateTransition(SfcProgram context)
 {
     foreach (SfcTransition transition in _transitions)
     {
         if (transition.CalculateTransition(context))
         {
             context.UpdateStepStatus(transition.NextSteps, transition.DependingSteps);
             return; // If multiple transitions could fire due to user error, we use the first mode.
         }
     }
 }
 /// <summary>
 /// Calculates if this transition fires or not.
 /// </summary>
 public bool CalculateTransition(SfcProgram program)
 {
     // All dependent steps must be active
     foreach (SfcStep step in DependingSteps)
     {
         if (!program.Plc.SfcProgramData.IsStepActive(step))
         {
             return(false);
         }
     }
     return(Transition.Result(program.Plc));
 }