Viewing 0 reply threads
  • Author
    Posts
    • #13351
      Michel Castaño
      Keymaster

      Idling is a very common event used to detect when a vehicle is stopped with the engine on. Idling is a common event to detect fuel overconsumption, And it is easily detectable even when there is no Engine Control Unit data (ECU) available.

      To generate events on Syruslang it is necessary the following:
      1. Define Signals

      2. Define events (The ones which are reported when a signal or combination of signals are triggered

      3. Actions: Useful to trigger local outputs, to change variables and even to trigger events.

       

      For this  example we are going to implement an idling event to detect more of 15 minutes idling, and a “End of idling” event to know when Idling finished and to know the amount of time the vehicle spent idling.

      First lets design a State Machinery to depict the possible states of the algorithm of idling and end of idling states:

      According to the State machinery depicted above, let’s generate the code in Syruslang:

      
      # 1. Define timers
      define timer idle15tmr duration=1min
      
      # 2. define signals
      define signal ignon min_duration=5s $io.ign==true
      define signal ignoff min_duration=5s $io.ign==false
      define signal idlspd min_duration=5sec $gnss.kph < 5
      define signal idlCancelspd min_duration=5sec $gnss.kph > 5
      
      # 3. Define variables
      define variable idle15True
      set variable idle15True false
      define signal idle15True_signal $variables.idle15True
      
      # 3. Define events
      define event ignon_ev group=tracking fieldset=default ack=seq label=ignon code=2
      define event ignoff_ev group=tracking fieldset=default ack=seq label=ignoff code=3
      
      define event idl15_ev group=tracking fieldset=default ack=seq label=idl15 code=5
      define event idl15end_ev group=tracking fieldset=default ack=seq label=idl15end code=6
      
      #define Machinery state 1: Ignition On AND Speed less than 5 kph start a timer of 15 minutes
      define action idlingstart_act trigger=ignon,idlSpd,and
      start timer idle15tmr
      
      #define Machinery state 2: Ignition Off OR Speed>5 cancels timer 15 minutes
      define action idlingcancel_act trigger=ignoff,idlCancelspd,or
      stop timer idle15tmr
      
      #Define Machinery State 3: Timer 15 minutes reaches end
      define action idling15_act trigger=@timers.idle15tmr
      send event idl15_ev
      set variable idle15True true
      
      #Define Machinery state 4: (Ignition Off OR Speed>5) AND Flag = true
      define action EndIdling15_act trigger=ignoff,idlCancelspd,idle15True_signal,or,and
      send event idl15end
      set variable idle15True false
      
Viewing 0 reply threads
  • You must be logged in to reply to this topic.