PLC

What are the FIFO and LIFO Sequences in PLC?

What is Sequential Logic?

  • The term Sequential Logic in Digital Electronic systems is generally a kind of logical circuit      whose output signal depends on the existing value of its input signals, & on the sequence of past input signals
  • In PLC programming, this Sequential logic is widely used; this      logic aids in sorting out things effortlessly.
  • PLC programming uses two kinds of sequences such as FIFO, & LIFO
  • Basically, in Electronics we came across these FIFO, & LIFO sequences employed in sequencing and in stacking.
  • Since the operation of both these FIFO and LIFO sequences is easy and user-friendly, the programmer must be aware during programming so that any inputs are not assigned to the storage blocks simultaneously because the block becomes nonfunctional without taking any action.
  • Only one input signal needs to be sent for a given time instant. 
  • Various types of PLC offers different function during warm restart or cold restart of PLC

What is the FIFO Sequence in PLC? 

  • FIFO stands for FIRST IN FIRST OUT
  • Basically, FIFO is a specific type of buffer.
  • In FIFO, the data stored first comes      out first, and the data stored last comes out at last.
  • This sequence resembles the people standing in a queue. 
  • This FIFO function consists of two Block Type instructions, First in First out Load, & First in First out Unload.
  • Both these instructions are used in combination with each other, this load and the unload exist on each false to true transition of the instruction. 
  • The first instruction First in First out Load reads the data byte or data word into the FIFO Stack.
  • The second instruction First in First out Unload writes the data byte or data word from FIFO Stack. 
  • These FIFO instructions are known as output instructions, hence fixed on the RHS of the ladder logic.
  • These two instructions occur under the tab, file, shift, and slash sequencer.
  • In PLC programming, a logic block is designated by the name FIFO that can store up to 16 words or more based on PLC make and model. 

Inputs, processing  and Outputs in FIFO Sequence

This consists of three inputs Reset, Storage, and Retrieval.

On the rising edge of the 

  • Reset input, the block is reset and cleared. 
  • Storage input, the data word is stored in the block.
  • Retrieval input, the data word stored first is sent to the destination configured by the PLC programmer.
  • Data inputs can come from various sources within an industrial process, such as sensors, switches, or other devices. These inputs represent the data values or events that need to be processed in the FIFO sequence. As new data values or events are generated or received, they are typically read into the PLC’s memory or data storage area. This is where the inputs are initially captured before being added to the FIFO queue.
  • Control inputs can come from user commands, external signals, or other sources that determine when data should be added to the FIFO queue or when processing should occur. Control inputs help manage the timing and operation of the FIFO sequence.

Processing Logic:

  • Sequential Processing: The PLC’s programming logic is responsible for sequentially processing the data values or events in the FIFO queue. The logic retrieves data from the front of the queue and performs the necessary operations or tasks on each data item. This logic ensures that data is processed in the order it was added.

Control Logic: 

  • The control logic within the PLC uses control inputs, such as timers, counters, or external signals, to determine when and how data should be added to the FIFO queue. It may also include decision-making and error-handling routines.

This consists of two outputs Empty, and Full.

  • For Empty type output, if this empty bit is True or High, this denotes that the storage is empty.
  • For Full type output, if this Full bit is True or High, this denotes that the storage is full.
  • Once data values or events have been processed, the results are typically sent to the appropriate output devices or systems. These outputs could be actuators, displays, or other equipment that takes action based on the processed data. The outputs may also include data logging or communication with external systems.
  • Control outputs may be used to manage the state of the FIFO sequence, such as indicating when the queue is full or empty, resetting counters, or providing feedback to external systems.

What is the LIFO Sequence in PLC?

  • LIFO stands for LAST IN FIRST OUT
  • Basically, LIFO is also another specific type of buffer.
  • In LIFO, the data stored at the last comes out first, and the data stored first comes out at last.
  • This sequence resembles the passenger traveling in a Public Transport system standing without having a seat during his journey hours.
  • In certain emergency situations, the most recent command or event (e.g., an emergency stop button press) takes precedence over earlier commands.
  • When dealing with multiple alarms or fault conditions, the most recent alarm or fault might need immediate attention.
  • LIFO can be used in data buffering applications where the latest data is more critical than older data.
  • Unlike FIFO, this LIFO function consists of two Block Type instructions, Last in First out Load, & Last in First out Unload.
  • Both these instructions are used in combination with each other, this load and the unload exist on each false to true transition of the instruction.
  • In PLC programming, a logic block is designated by the name LIFO that can store up to 16 words or more based on PLC make and model.

Inputs and Outputs in LIFO Sequence

This consists of three inputs Reset, Storage, and Retrieval.

On the rising edge of the 

  • Reset input, the block is reset and cleared. 
  • Storage input, the data word present at the input is stored in the block, the block remembers the sequence of the received data word.
  • Retrieval input, the data word stored at last is sent to the destination configured by the PLC programmer. 
  • In a LIFO sequence, data elements or values are stored in a stack within the PLC’s memory. New data elements are added to the top (or “pushed onto”) of the stack. This means that the most recently acquired data is always at the top of the stack.
  • The size of the LIFO stack determines how many data values or events can be stored before the stack is full. It’s crucial to configure the stack size based on the application’s requirements.

This consists of two outputs Empty, and Full.

  • For Empty type output, if this empty bit is True or High, this denotes that the storage is empty.
  • For Full type output, if this Full bit is True or High, this denotes that the storage is full.

Comparison between FIFO versus LIFO Sequences

FIFOLIFO
It stands for the First-In-First-Out approach in programming.It stands for the Last-In-First-Out approach in programming.
Here, the recent element is stacked below the existing element, So that the oldest element comes at the top and is taken out first.Here, the recent element is inserted above the existing element, So that the newest element comes at the top and is taken out first.
Hence, in this approach The first element entered gets out First.The Last element entered gets out LastHence, in this approach The first element entered gets out Last.The Last element entered gets out First.
The FIFO approach during computing is used as an operating system algorithm that issues every process CPU time in the order of their arrival.The LIFO approach during computing is used as a queuing theory that refers to the way that items are stacked in types of data structures.
FIFO implements Queue typedata structure.LIFO implements Stack typedata structure.
Typical Use Cases of Maintaining chronological order, batch processing, conveyor systemsTypical Use Cases of Prioritizing recent data, emergency stop situations, alarm handling
Application Examples are Quality control, inventory management, historical data loggingApplication Examples are Emergency shutdown, real-time sensor data processing, stack-based calculations
FIFO logic may be simpler to implement in some casesLIFO logic may require careful handling to ensure recent data is correctly prioritized

Sundareswaran Iyalunaidu

With over 24 years of dedicated experience, I am a seasoned professional specializing in the commissioning, maintenance, and installation of Electrical, Instrumentation and Control systems. My expertise extends across a spectrum of industries, including Power stations, Oil and Gas, Aluminium, Utilities, Steel and Continuous process industries. Tweet me @sundareshinfohe

Related Articles

Back to top button

Adblock Detected

We Noticed You're Using an Ad Blocker Hi there! We understand that ads can be annoying, but they help support our website and allow us to continue providing you with high-quality content. Please consider whitelisting our site or disabling your ad blocker while you visit. Your support means a lot to us! Thank you for understanding!