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

DCS
What is Seal-in Circuit ?
Series Tanks Level Control using PLC Ladder Programming
PLC Program for Ceramic Burning Oven Conveyor System
MODBUS ASCII Communication Protocol Explained
Draw a Ladder Logic to switch ON-OFF a Bulb using a Toggle Switch ?
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

Does Really a Safety Barrier is Important? – PLC DCS Systems
PLC Ladder Logic Questions and Answers
PLC Programming for 3 Motors control in Ladder logic
Machine Indicator Lights: PLC Programming Solution
Quiz Program Logic Using PLC Programming
PLC Program for Star Delta Motor Starter
Ladder Logic Programming Examples
How to Create Faceplate in FactoryTalk View Studio?

Keep Learning

Timer STL Programming

Timers using Statement List (STL) PLC Programming

Siemens TIA Portal program blocks

Tia Portal – Optimized and Standard Data Block Access

SCADA Engineer

SCADA Engineer Job Responsibilities and Skills

Firmware Version in Siemens PLC

What is the Firmware Version of a PLC? – Siemens PLC Hardware

Current to Voltage Conversion Circuit

How to Convert Current to Voltage using Resistor ?

Compare DCS, PLC, RTU

Difference between DCS, PLC, and RTU ?

Industrial Automation and Control Systems (IACS)

Industrial Automation and Control Systems (IACS)

Control Methods in Servo Motor Drives

Various Control Methods in Servo Motor Drives

Learn More

Weir Diaphragm Valve

Diaphragm Valves Construction, Types, Stem & Bonnet Assembly

Direct Acting Solenoid Valve

Top 5 Things for selecting a Solenoid Valve

FF Function block location

Foundation Fieldbus Logics

Guided-wave Radar Level Measurement Animation

PLC Program for motor operation based on time cycle

PLC Motor Operation based on Time Cycle Sequence – Program

Thermocouples

Important Factors for Thermocouple Selection

Free Download Industrial Control System Book

Free Download Industrial Control System Book

Basics of Actuators

Basics of Actuators

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?