Inst ToolsInst ToolsInst Tools
  • Ask
  • Courses
  • Videos
  • Q & A
    • Interview
      • Instrumentation
      • Electronics
      • Electrical
      • Practical Questions
    • MCQ
      • Instrumentation MCQ
      • Electrical MCQ
      • Electronics MCQ
      • Control Systems MCQ
      • Analog Electronics MCQ
      • Digital Electronics MCQ
      • Power Electronics MCQ
      • Microprocessor MCQ
      • Multiple Choice Questions
  • EE
    • Electronics
      • Electronics Q & A
      • Electronic Basics
      • Electronic Devices & Circuits
      • Electronics Animation
      • Digital Electronics
    • Electrical
      • Electrical Basics
      • Electrical Q & A
      • Power Electronics
      • Electrical Machines
      • Electrical Animation
      • Power Systems
      • Switchgear & Protection
      • Transmission & Distribution
  • Measure
    • Control Valves
    • Calibration
    • Temperature
    • Pressure
    • Flow
    • Level
    • Analyzers
    • Switches
    • Vibration
    • Solenoid Valve
  • Control
    • PLC Tutorials
    • Control Systems
    • Safety Instrumented System (SIS)
    • Communication
    • Fire & Gas System
  • More
    • Design
    • Tools
    • Animation
    • Basics
    • Formulas
    • Standards
    • TextBooks
    • Common
    • Software
    • Excel Tools
    • Erection & Commissioning
    • Process Fundamentals
    • Videos
    • Books
Search
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Reading: #1 PLC Best Practices – Split PLC Code into Modules
Share
Notification Show More
Font ResizerAa
Inst ToolsInst Tools
Font ResizerAa
  • Courses
  • PLC Tutorials
  • Control Systems
Search
  • Ask
  • Courses
  • Videos
  • Q & A
    • Interview
    • MCQ
  • EE
    • Electronics
    • Electrical
  • Measure
    • Control Valves
    • Calibration
    • Temperature
    • Pressure
    • Flow
    • Level
    • Analyzers
    • Switches
    • Vibration
    • Solenoid Valve
  • Control
    • PLC Tutorials
    • Control Systems
    • Safety Instrumented System (SIS)
    • Communication
    • Fire & Gas System
  • More
    • Design
    • Tools
    • Animation
    • Basics
    • Formulas
    • Standards
    • TextBooks
    • Common
    • Software
    • Excel Tools
    • Erection & Commissioning
    • Process Fundamentals
    • Videos
    • Books
Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Inst Tools > Blog > PLC Tutorials > #1 PLC Best Practices – Split PLC Code into Modules

#1 PLC Best Practices – Split PLC Code into Modules

#1 PLC Best Practices - Split PLC code into modules, using different function blocks (sub-routines). Test program modules independently.

Last updated: September 20, 2021 11:59 pm
Editorial Staff
PLC Tutorials
No Comments
Share
3 Min Read
SHARE

PLC best practices – Split PLC code into modules, using different function blocks (sub-routines). Test modules independently.

Contents
Split PLC Code into ModulesExample
Security ObjectiveTarget Group
The integrity of PLC logicProduct Supplier

Split PLC Code into Modules

Do not program the complete PLC logic in one place e.g., in the main Organization Block or main routine. Instead, split it into different function blocks (sub-routines) and monitor their execution time and their size in Kb.

Create separate segments for logic that functions independently. This helps in input validation, access control management, integrity verification, etc.

Modularized code also facilitates testing and keeping track of the integrity of code modules. If the code inside the module has been meticulously tested, any modifications to these modules can be verified against the hash of the original code, e.g., by saving a hash of each of these modules (when that’s an option in the PLC).

This way, modules can be validated during the FAT/SAT or if the integrity of the code is in question after an incident.

PLC Best Practices

Example

Gas Turbine logic is segregated into “startup”, “Inlet Guide Vanes Control”, “Bleed Valve Control” etc. so that you can apply standard logic systematically. This also helps in troubleshooting quickly if there were to be a security incident.

Custom function blocks that are tested rigorously can be re-used without alteration (and alerted if change attempts are made) and locked against abuse/misuse with a password/digital signature.

Why?

Beneficial for…?Why?
  SecurityFacilitates the detection of newly added portions of code that could be malicious.  Helps in logic standardization, consistency, and locking against unauthorized modifications.
  ReliabilityHelps control the program flow sequence and avoid loops, which could cause the logic to not react properly or crash.
      MaintenanceModular code is not only easier to debug (modules can be tested independently) but also easier to maintain and update.

Also, the modules may be used for additional PLCs, thus allowing for common code to be used and identified in separate PLCs.

This can aid maintenance personnel with quickly recognizing common modules during troubleshooting.

References

Standard/framework
Standard/frameworkMapping
  MITRE ATT&CK for ICSTactic: TA002 – Execution Technique:  T0844 – Program Organization Units
ISA 62443-3-3SR 3.4: Software and information integrity
ISA 62443-4-2CR 3.4: Software and information integrity
ISA 62443-4-1SI-2: Secure coding standards
  MITRE CWECWE-1120: Excessive Code Complexity
CWE-653: Insufficient Compartmentalization

Source: PLC Security

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 !
Automate Batch Mixing with Repeated Cycles in Omron PLC
PLC Ladder Logic Questions and Answers
What are User Defined Function Blocks in PLC?
Schneider PLC Programming Example for Beginners
PLC Program for Latching and unlatching Circuit
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
208kSubscribersSubscribe
38kFollowersFollow

Categories

Recent Comments

  • Guifty Shimica on Top Non-PLC Certification Courses for Automation Professionals
  • Guifty Shimica on Top Non-PLC Certification Courses for Automation Professionals
  • MIHARITSOA Aina Sitraka on Top Non-PLC Certification Courses for Automation Professionals
  • Vaishnavi on Free Instrumentation Course for Trainee Engineers

Related Articles

AI AO DI DO Questions

AI, AO, DI, DO Questions (PLC I/O Types)

Basic Concepts of the Safety Relay

Basic Concepts of the Safety Relay

two-way communication between PLC systems

Transferring Data Across PLC Systems – TSEND_C and TRCV_C

Boolean Algebra to PLC Logic

From Boolean Algebra to PLC Logic

RSlogix 500 to communicate with Excel

How to Communicate with Excel from RsLinx?

PLC Programming Examples using Timer

Basic PLC Ladder Programming Example

What is an instruction list language?

Structured Text vs. Instruction List for PLC Programming

PLC Automation Memory

What is NOR Flash Memory in PLC?

More Articles

Difference Between LDR and Photodiode

Difference Between LDR and Photodiode

Types of Engineering Courses

Various Types of Engineering Courses

H2 S and Total Sulfur Using Lead Acetate Principle

H2S Measurement Using Lead Acetate Principle

Worldwide Voltage & Frequency Values

Worldwide Voltage & Frequency Values

Smart Transmitter Calibration Tutorial Part 3

Smart Transmitter Calibration Tutorial Part 3

Electrical Power Distribution

Electrical Power Distribution

Linear Heat Detector Working Principle

What are Linear Heat Detectors?

Turbine Flow meter coefficient

Turbine Flow Meter Coefficient and Scaling Factor

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?