Inst ToolsInst ToolsInst Tools
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Search
  • Books
  • Software
  • Projects
  • Process
  • Tools
  • Basics
  • Formula
  • Power Plant
  • Root Cause Analysis
  • Electrical Basics
  • Animation
  • Standards
  • 4-20 mA Course
  • Siemens PLC Course
Reading: PLC Structured Text Program for Output Generation via Equations
Share
Font ResizerAa
Inst ToolsInst Tools
Font ResizerAa
  • Courses
  • Design
  • PLC
  • Interview
  • Control System
Search
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Inst Tools > Blog > PLC Tutorials > PLC Structured Text Program for Output Generation via Equations

PLC Structured Text Program for Output Generation via Equations

In this article, we will write a sample PLC program on how to generate output based on equations using structured text language.

Last updated: September 16, 2024 4:50 am
Viral Nagda
PLC Tutorials
No Comments
Share
4 Min Read
SHARE

When you are doing mathematical calculations in a PLC program, you need to understand how to derive proper answers and get the desired result. Accordingly, the logic will help in keeping the calculations and answers intact.

Contents
Output Generation via EquationsPLC Structured Text Program

One of the most preferred languages in PLC programming for writing equations is structured text. This is because the syntax and instruction suits them the best. In this post, we will write a sample program on how to generate output based on equations using structured text language.

Output Generation via Equations

Let us understand the case scenario first. There is a PLC digital output and two PLC inputs – one analog and one digital. The PLC output is controlled through formulae.

The analog input has a range of 0-100%. When the value of that input is more than 30%, a fixed value of 4 is added every 5 seconds.

After addition, when this value becomes more than 20, then the output turns on and the value is subtracted with a fixed value of 4 every 5 seconds. It will subtract till 0 and then, the output turns off.

Again, the cycle continues for addition and subtraction. During this sequence, if the value of the analog input goes less than 30%, then the whole cycle stops. The digital input is an emergency button, which when received, will reset the whole cycle.

PLC Structured Text Program

Now, we will write the logic for the same. Refer to the below image. We take a common timer of 5 seconds for the whole logic.

The timer runs when the value of analog input is more than equal to 30 and the emergency input is healthy. We use the negate done bit of timer for making the timer self reset and run again.

PLC Structured Text Program for Output Generation via Equations

Now, when the timer is done and the value has not reached 20 yet, then the value is added with 4. For checking whether the value of 20 has been reached or not, we use a bit add_done with negate condition.

When the value becomes 20, we set the bit add_done and turn on the motor output, by writing a value of 1 to them.

Now, when the timer is done and the value has not reached 0 yet, then the value is subtracted with 4. For checking whether the value of 0 has been reached or not, we use the bit add_done.

When the value becomes 0, we reset the bit add_done and turn off the motor output, by writing a value of 0 to them. Due to this, the second condition is activated once again and the cycle repeats.

In any instance, when the value of analog input becomes less than 30 or if the emergency is pressed, then all the bits and values are reset and the cycle becomes zero.

We have used if-else statements in the whole program for execution. Due to this, the logic becomes easier to write and understand.

In this way, we saw how to operate a PLC output using equations in structured text language.

Read next:

  • Structured Text for two-tank level application
  • Tanks Draining Control in PLC Programming
  • Functional Block Diagram for Oil and Water Logic
  • Structured Text for Measuring Event Duration
  • PLC FBD Example for Tank Liquid Heating Logic
Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
You've successfully subscribed !

Continue Reading

Connect to the Siemens S7 PLC
OpenPLC – PLC Training for Students – Free Tutorials & Courses
Open User Communication in Siemens Tia Portal – PLC to PLC
PLC Automatic Pedal Switch for Speed Control
What is Seal-in Circuit ?
How to Control VFD with PLC using Ladder Logic
Share This Article
Facebook Whatsapp Whatsapp LinkedIn Copy Link
Share
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

128.3kFollowersLike
69.1kFollowersFollow
210kSubscribersSubscribe
38kFollowersFollow

Categories

Explore More

What are High-Speed Counters and Fast Counters in PLC?
PLC Program for Paint Spraying
How to Filter Digital and Analog Inputs in a PLC?
How to Create DFB in Schneider PLC? – Derived Function Block
VFD Pros and Cons – Variable Frequency Drives
PLC Programming: Sorting and Distribution of Boxes by Height
80+ PLC MCQ Questions
PLC Ladder Logic for Opposite Acting Control Valves Application

Keep Learning

Quiz Program Logic Using PLC Programming

Quiz Program Logic Using PLC Programming

PLC Program for Sequential Motor Control

PLC Program for Sequential Motor Control

SR Flip Flop Logic

How to implement SR Flip Flop using PLC Ladder Logic

Difference between Analog Signal and Digital Signal

What are Analog and Digital Signals? Differences, Examples

Online and Diagnostics of Siemens PLC

How to Use Diagnostic Buffer for SIEMENS PLC?

What is meant by the Batching Process

Batch Simulator PLC Example Program using LogixPro Simulator

Types of Industrial Relays

What is a Relay? Types of Industrial Relays

PLC Program Upload

How to Upload Siemens PLC Programs?

Learn More

Optimal Control Systems

Output Regulator & the Tracking Problem

Advantages of Bundled Conductors in Transmission Lines

Advantages of Bundled Conductors in Transmission Lines

Dual-junction thermocouple circuit

Find Thermocouple Ouput Voltage

Diode-vi-characteristic-curve-for-forward-bias

VI Characteristic of a Diode

Span of Pressure Gauge

How to Decrease Span of Pressure Gauge?

Process Plant Risk and Safety Management

Safety Roles & Responsibilities of Process Engineering (Detail Design)

inductance transducer

Inductance Type Pressure Transducers Principle

Encoders and Decoders Objective Questions

Encoders and Decoders Objective Questions

Menu

  • About
  • Privacy Policy
  • Copyright

Quick Links

  • Learn PLC
  • Helping Hand
  • Part Time Job

YouTube Subscribe

Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?