protected virtual QState S_Sparking(IQEvent ev) { switch (ev.QSignal) { case QSignals.Entry: { LogStateEvent(StateLogType.Entry, s_Sparking); SetTimeOut("Sparking_t1_Spark", TimeSpan.FromSeconds(SparkFrequencyInterval()), new QEvent("Spark"), TimeOutType.Repeat); SetTimeOut("Sparking_t0_StopSpinning", TimeSpan.FromSeconds(RandomSpinInterval()), new QEvent("StopSpinning"), TimeOutType.Single); } return(null); case QSignals.Exit: { ClearTimeOut("Sparking_t1_Spark"); ClearTimeOut("Sparking_t0_StopSpinning"); LogStateEvent(StateLogType.Exit, s_Sparking); } return(null); case QualifiedFlintSignals.Spark: { FuelMixture.Send(new QEvent(FuelMixtureSignals.Ignite)); LogStateEvent(StateLogType.EventTransition, s_Sparking, s_Sparking, "Spark", "t1-every SparkFrequencyInterval() raise Spark/^FuelMixture.Ignite()"); TransitionTo(s_Sparking, s_trans_t1_Spark_Sparking_2_Sparking); return(null); } // Spark case QualifiedFlintSignals.StopSpinning: { LogStateEvent(StateLogType.EventTransition, s_Sparking, s_NoSparks, "StopSpinning", "t0-after RandomSpinInterval() raise StopSpinning"); TransitionTo(s_NoSparks, s_trans_t0_StopSpinning_Sparking_2_NoSparks); return(null); } // StopSpinning } // switch return(TopState); } // S_Sparking
protected virtual QState S_Empty(IQEvent ev) { switch (ev.QSignal) { case QSignals.Entry: { LogStateEvent(StateLogType.Entry, s_Empty, "^FuelMixture.StopFlow()"); FuelMixture.Send(new QEvent(FuelMixtureSignals.StopFlow)); } return(null); case QSignals.Exit: { LogStateEvent(StateLogType.Exit, s_Empty); } return(null); } // switch return(TopState); } // S_Empty
protected virtual QState S_Open(IQEvent ev) { switch (ev.QSignal) { case QSignals.Entry: { LogStateEvent(StateLogType.Entry, s_Open, "^FuelMixture.Mix(FlowValue)"); FuelMixture.Send(new QEvent(FuelMixtureSignals.Mix, FlowValue)); } return(null); case QSignals.Exit: { LogStateEvent(StateLogType.Exit, s_Open); } return(null); case QualifiedValveSignals.Empty: { LogStateEvent(StateLogType.EventTransition, s_Open, s_Empty, "Empty", "Empty"); TransitionTo(s_Empty, s_trans_Empty_Open_2_Empty); return(null); } // Empty case QualifiedValveSignals.User_DecreaseFlow: { ChangeFlowRate(-1); LogStateEvent(StateLogType.EventTransition, s_Open, s_Open, "User.DecreaseFlow", "User.DecreaseFlow/ChangeFlowRate(-1)"); TransitionTo(s_Open, s_trans_User_DecreaseFlow_Open_2_Open); return(null); } // User.DecreaseFlow case QualifiedValveSignals.User_IncreaseFlow: { ChangeFlowRate(1); LogStateEvent(StateLogType.EventTransition, s_Open, s_Open, "User.IncreaseFlow", "User.IncreaseFlow/ChangeFlowRate(1)"); TransitionTo(s_Open, s_trans_User_IncreaseFlow_Open_2_Open); return(null); } // User.IncreaseFlow case QualifiedValveSignals.User_Release: { LogStateEvent(StateLogType.EventTransition, s_Open, s_Closed, "User.Release", "User.Release"); TransitionTo(s_Closed, s_trans_User_Release_Open_2_Closed); return(null); } // User.Release } // switch return(TopState); } // S_Open