SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
PLC programs development guide-
lines
Itris Automation Square- November 13th 2015 - Version 1.7.0
www.itris-automation.com
©Itris Automation
2008-2015
Contents
1 Document purpose 4
2 Document structure 5
2.1 Rules classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Presentation of each rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Coding Rules 6
3.1 Naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Writing code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3.2 Unity Pro specific rules (Schneider Electric). . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.5 Useful Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.5.1 Useful information for all PLCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.6 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6.1 Unity Project Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.7 Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.7.1 Verification of the programming languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Annexes 16
4.1 Summary of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2 Document history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
PLC programs development guidelines
Chapter 1
Document purpose
This document contains coding style guidelines for PLC programming, to improve readability, maintainability and the
consistency of PLC programs. It describes simple rules which allow to get meaningful quality indicators from the first
day of development.
All rules in this document are checked automatically with PLC Checker, which supports PL7 PRO and Unity Pro
from Schneider Electric, STEP7 from Siemens and Rockwell Automation RSLogix 5000 PLCs.
This document was written by IAS’ seasoned consultants, based on analysis results of many codes used by Itris
Automation Square’s customers in several industries and using various ranges of PLCs. It also reflects some best
practices from other computer engineering domains such as embedded systems, which have been applying standard
sets of programming guidelines for years.
4
PLC programs development guidelines
Chapter 2
Document structure
2.1 Rules classification
The rules described in this document are classified into several categories: Naming, Comments, Writing and Structure.
The last part of this document also provides useful information which are not only about coding rules, but also allow
improvements of the programs’ quality. The last part is about the rules on the options of the PLC workbench.
Each category is divided into two parts:
1) The rules that may be applied independently of the PLC for which the program is developed.
2) The rules that are only relevant for a specific PLC or that need to be adapted in order to be applicable.
2.2 Presentation of each rule
The rules are numbered according to their implementation in ”PLC Checker”. For each rule, we find an identical struc-
ture made up of a title, an explanation of the rule, a justification of its importance and, when relevant, a code example
to facilitate understanding of the rule.
5
PLC programs development guidelines
Chapter 3
Coding Rules
3.1 Naming
The elements manipulated in PLCs have mnemonics. Elements are, for example, variables, routines (sections, sub-
routines, FCs . . . ) or function blocks (FB). The purpose of this section is to make sure that the symbols follow rules
ensuring readability, maintainability and allow for greater code durability. Generally, the libraries elements are ex-
cluded from naming verification. Of course, when the workbench allows this, we don’t recommend to change the
elements’ names defined in the libraries.
3.1.1 PLCs common Rules
N.1 - All program elements should have a mnemonic
All program’s elements should have a mnemonic (program, modules, variables, DFB, FB, OB, SR, routine, Add-On)..
Comment : When all programs elements have a mnemonic, maintenance is easier and it is easier to understand
program content. Moreover, not using mnemonic makes an implicit link between a code and an hardware implementa-
tion.
N.2 - Elements names length should be in a given range
The names of program elements must contain at least 3 characters and no more than 15 characters.
Comment : A minimum number of characters ensures more meaningful naming. A maximum number of characters
allows:
• In Schneider Unity, Schneider PL7pro and Rockwell RSLogix : to avoid the mnemonics being truncated in
display or export, . . .
• In Siemens Step7: to improve readability
N.3 - Topological physical address should not be used as part of a mnemonic
The mnemonics shall not contain a reference to their physical address (for instance, ”MW2”, ”FB4”. . . ).
Comment : The reference to the physical address of the entity in the code may have bad properties : readability
is worse, and it may induce dangerous confusion. It should be noted that with the evolution of software workbenches,
referencing the elements names by their physical address is not necessary anymore. Even-though such a reference to
the physical address may be unintentional, it is prohibited.
Example :
6
PLC programs development guidelines
Physical ad-
dress
Mnemonics comment
%MW23 Cde 23 Never link the naming of the variable to its
physical address
N.4 - Debug mnemonics should not be part of the final program
Debug mnemonics although useful during development shall not be part of the final program. For example, some
names such as test, todo, to be removed, ... are forbidden and comments shall not contain expressions that may lead
to think that the program is still to be completed (todo, to be removed, to be completed later...). The same applies to
non identified variables (whose name contains unknown or ?. . . ).
Comment : Leaving debug items in the final program reduces its readability and may have different behavior than
expected. The list of prohibited elements is configurable (of course, it is language specific).
N.5 - Special or graphical characters are prohibited in mnemonics
The special characters set (e.g : `a, ´e, c¸. . . ), space and accents are prohibited in the mnemonics names. Only alphanu-
merical characters and the underscore are allowed.
Comment : Using special characters, may generate some problems of portability to future workbench version
and / or to other platforms. It also reduces the readability in an international context. Finally, the restriction to only
alphanumerical characters ensures a better distinction between variable names.
Example :
d´epart := true;
# .... Lines of code
depart := false; #Using the special character ’´e’, leads to a confusion between mnemonics.
N.6 - The programming language keywords should not be used as mnemonics
Programming language keywords (for example “if”, “set”, “start”. . . ) should not be used as mnemonics. But it is
possible that mnemonics contain a keyword. Most cases are handled by PLC workbench, but there are exceptions.
Comment : Using keywords as mnemonics lowers program readability and portability.
Example :
start := true; # mistaken mnemonic, "start" is a language keyword
start_motor := true; # Correct mnemonic
3.2 Comments
In addition to good naming practices, it is important to follow rules when commenting programs. In fact, the more
explicit and detailed the comments are, the more the code will be understandable. Generally, the standard library
elements comments are not checked.
Comments 7
PLC programs development guidelines
3.2.1 PLCs common Rules
C.1 - All program elements should have a comment
All program elements must be commented (Program, Section, Modules, Variables, DFB, FB, OB, SR).
Comment : If all the program elements are commented significantly, it is easier to read and understand the pro-
gram, therefore its maintenance is less costly.
C.2 - Comments should be longer than a given number of characters
The comments of program elements must contain a minimum number of characters (7 for variables, 15 for codes) to
avoid insignificant comments.
Comment : Having a minimum length ensures that the comments are more meaningful.
C.3 - Each network should have a comment
The networks must be commented. This rule is specific to some languages of the IEC61131 standard. Also please note
that the concept of network is not always present in PLC vendor IDEs.
Comment : In addition to a good overall rate of comments, it’s important to ensure that comments are well dis-
tributed within the program. Such a rule is also a guide that ensures consistency when copy/pasting code sections.
C.4 - Comments should not contain comment start marker
Comments should not contain comment start marker (e.g, ”/ *”, ”( *”).
Comment : The presence of a comment start marker is often a symptom of a forgotten comment end marker, which
can lead to commenting out of a part of program and thus a non intended behavior.
Example:
/* Any comment with the end marker has been forgotten
Critical_section_that_must_be_executed_which_is_found_in_the comment();
/* <- The start marker comment is commented because the end marker of the previous comment has been
forgotten */
3.3 Writing code
3.3.1 PLCs common Rules
E.1 - All variables should be written before being read
Except for physical and communication inputs and system variables, all variables should be written before being read
during a PLC cycle.
Comment : a variable that is read before being written, can increase program latency. Efficient code should respect
during one PLC cycle the following diagram:
inputs reading -> processing -> update the outputs.
8 Writing code
PLC programs development guidelines
In addition, make sure that the variables that are never written in the code have been initialized, otherwise they are
updated by other ways.
In some cases it is justified to ignore this rule:
• variables that were initialized in the database,
• variables updated by a communications link,
• state variables that store the value of a previous PLC cycle.
Example:
if urgentAlarme then
alarmeTreatement();
end if;
# ...
urgentAlarme := presenceDefault AND ...;
In this example, the call of the alarm function “alarmTraitement” happens during the next PLC cycle, which increases
the average response time. This delay is around one PLC cycle.
E.2 - The parameters of the user functional blocks should be used correctly
This rule is divided into three sub-rules :
• E.2.a and b - Inputs of the user functional blocks should be read and not written.
• E.2.c and d - Inputs/Outputs of the user functional blocks should be read and written.
• E.2.e - Outputs of the user functional blocks should be written before being read.
Comment : Parameters incorrectly used are evidence of unfinished code or a code that still contains unnecessary el-
ements of correct behavior. In some PLCs, misusing parameters may generate undesirable and potentially dangerous
effects, such as data corruption. Please note that checking whether private parameters of user blocks are used is done
by the rule S7.
3.3.2 Unity Pro specific rules (Schneider Electric).
E.U.1 - The functions of the Unity obsolete libraries should not be used
In a new Unity Pro PLC Project, the functions of the obsolete libraries should not be used.
Comment : In Unity, some libraries are obsolete and exist to ensure backward compatibility with previous ver-
sions of Schneider PLCs. In new applications, the usage of the functions of those libraries must be avoided for future
portability problems. Furthermore, some of those functions can make the code nondeterministic (ex: shifts on signed
integers shl int, shlz int, shr int, shrz int, rol int, ror int).
Writing code 9
PLC programs development guidelines
3.4 Structure
3.4.1 PLCs common Rules
S.1 - Backward jumps are forbidden
Backward jumps are forbidden.
Comment : Using a backward jump can trigger an infinite loop, which can lead to a PLC shutdown. Moreover, in
general, jumps make the code less understandable and therefore their maintenance is more complex.
Example: Example of jump which triggers an infinite loop
Figure 3.1: Example of jump which triggers an infinite loop
S.2 - A variable should be elaborated only in one routine
A variable should be elaborated only in one routine.
Comment : A simple and clear code architecture facilitates understanding of the code and therefore its mainte-
nance. Moreover, multiple variable elaborations can lead to erratic behavior of the code.
S.3 - A variable should be written from one task only
A variable should be written from one task only.
Comment : writing a variable from several tasks leads to an nondeterministic behavior, such as a potential access
conflict.
S.4 - A physical output should be written only once per PLC cycle
A physical output should be written only once per PLC cycle.
Comment : Multiple output writing may lead to problems of dependability. Also, a code where the outputs are
written more than once is less easy to understand and maintain. It should be noted that writing in a loop is considered
as multiple writing and therefore constitutes a violation of this rule.
Example:
10 Structure
PLC programs development guidelines
if very_complicated_condition then
Critical_Output := TRUE;
end if;
#.... much later in the program
if another_very_complicated_condition then
Critical_Output := FALSE;
end if;
In the case where the output is not controlled where it should be, it is very difficult to identify which affectation is
executed
S.5 - Variables should not be localized
Variable memory mapping should be reserved to variables which elaboration or consumption is done out of the program
: communication tags, I/O variables, special function variables. All internal variables should not be localized.
Detailed explanation : Using localized variables constraints program evolution, due to a more rigid memory or-
ganization. It reduces portability, as memory organization varies from one PLC to another. So the code cannot be
reused in another application, as in the other application the given memory zone may be reserved for other purposes.
Moreover, it may lead to memory organization mistakes in which several variables will be saved in the same memory
cells. This bug may be silent during a long time and be encountered late in the development or in the production cycle.
S.6 - DFB/FBs instances should be called only once
Comment : A functional block instance owns its variables used to save the FB state between two consecutive cycles.
Each FB execution should modify those variables to show the state evolution. When executed more than once, it looks
like the cycle is progressing twice quicker than the other instances.
Often used more than once, the same instance is the result of a cut and paste not updated.
It may lead to bugs hard to discover.
S.7 - Declared variables should be used
Variables and defined types should be used, except for reserve variables. Reserve variables shall not be used.
Comment : Variables (except reserves) and unused types are often a sign of a forgotten treatment or incomplete
database cleaning. When reserve variables are used this is often the sign of a forgotten renaming.
S.8 - Variables location shall not overlap
The overlapping variables are to be checked.
Comment : Localized variables that overlap are equivalent to an implicit transfer of value between each other. This
is sometimes a difficulty to code readability. It is also sometimes a localization error.
S.9 - Complexity measure
Complexity of the code shall be assessed. Loops (for, repeat, while), jumps and a high level of imbrication are criteria
of code complexity.
Comment : Parts of program are more complicated than others. This is specially the case when execution sequen-
tial flow is often cut. This rule searches for some root causes for flow discontinuation, like loops, backward goto and
high complex instructions nested level.
Structure 11
PLC programs development guidelines
S.10 - SCADA Limitations
SCADA software doesn’t support structures arrays. Such constructions shall be avoided for portability purposes.
Comment : When using a SCADA which doesn’t support array of structures, it is important to not build a PLC
database based on these arrays of structures. This rule is used here to detect this kind of construction.
S.12 - Conditional instructions without default case
In some standards, it may be requested to always add a default case to conditional instructions (IF, CASE, . . . ).
Comment : The goal of that rule is to make sure that for each IF instruction there is a ELSE statement and that
for each CASE instruction there is a OTHERS statement. Thus , the developer is making sure that all cases have been
taken into account in the program, even if it’s a ’ELSE NULL;’ case.
S.13 - SFC diagrams without an initial step
SFC diagrams without any initial steps should be explicitly identified.
Comment : Such diagrams are generally launched for other sections in the program. It is more complicated to
understand the behavior of the diagram, thus reducing the maintainability of the application.
3.5 Useful Information
3.5.1 Useful information for all PLCs
I.1 - Comments rate
It is recommended that the code contains a minimum percentage of comments.
Comment : Itris Automation Square recommends a rate of 30% (# of commented instructions / total # of in-
structions). Such a minimum rate of comments ensures that the development was carried taking into account the
maintainability of the code, and ensuring that it will be easy to understand when evolution is needed.
I.2 - Code in the comments
It is very important to check the possible presence of code as comments.
Comment : Commenting out code is a typical test and debug strategy. The final program should not contain com-
mented out code as maintenance technicians may be confused.
I.3 - Dead code
Provision shall be made against the presence of dead code in the program.  
Clarification : Dead code affects the readability and maintainability of the program and can be a symptom of a
functional problem. Please note that when PLC Checker detects unreferenced functions and parts of isolated code
after an unconditional jump, the completeness of the detection is not guaranteed (for example, dead code related to the
evaluation of an expression).
I.4 - List of locked elements
The locked elements are not scanned by PLC Checker, they should be identified for manual review.
Comment : In applications where the major part of the code is locked, it is important to know it.
12 Useful Information
PLC programs development guidelines
I.5 - Cyclomatic number v(G)
A cyclomatic number gives information about complexity. It is important to keep it reasonably low.
Comment : A cyclomatic number counts the number of different paths that can be executed in a routine. The
higher this number is, the more difficult it is to validate the correct behavior of the routine. In such a case, the routine
should be divided in subroutines. Each of them having a cyclomatic number below the given threshold.
I.6 - Essential Complexity ev(G)
Essential complexity gives information about unstructured instructions. It is important to keep it reasonably very low.
Comment : Essential complexity counts the number of different unstructured instructions in a routine. The higher
this number is, the more difficult it is to validate the correct behavior of the routine. Most of the time, unstructured
instructions can normally be replaced by structured instructions.
I7 - Source Line of Code count
The source line of code counts number of instructions in a POU. It is important to keep it under control.
Comment : Very big procedure or function blocks may be difficult to test, to read and to maintain. It may be better
to split a very big procedure into two or more procedures of reasonable size.
I8 - Sequential Function Chart (SFC) steps count
This is the count of steps in a given SFC.
Comment : This rules returns the number of steps found by SFC. This number may be further used to detect
complex SFCs or to give an overview of the relative size of SFCs.
I9 - SFC branches count
This number sums the number of branches in each AND/OR divergence found in a given SFC.
Comment : This rule calculates the number of branches available in a given SFC. This count gives information
about SFC complexity. This number is equivalent to the v(G) applied to imperative coding languages.
I10 - Copy/Paste detection ratio
This number detects the percentage of code which is redundant.
Comment : Reusing the code by copying code is not a good practice. Maintenance and evolution are more
expensive to perform because modifications and corrections should be applied at each copy/paste instance. Moreover,
the manual copy/paste is error prone : after doing the copy/paste, code should be modified. When code is not modified
correctly, it introduces subtle bugs hard to discover.
3.6 Options
3.6.1 Unity Project Options
O.U.1 - SFC : ”Multiple Token” should not be Allowed
In the language extensions tab of project settings, the check-box ”Allow multiple token” shall be deactivated.
Comment : The only purpose of the multiple token mode is to ensure backward compatibility with previous ver-
sions of Schneider PLCs. It should not be used in new projects because it can make the code indeterministic. SFC code
with Multi Token is not compliant with IEC 61131-3.
Example: In the following SFC code, if the condition ”A” is always true, after several PLC cycles, all steps are
simultaneously active.
Options 13
PLC programs development guidelines
Figure 3.2: indeterministic SFC in multi-token mode
O.U.2 - SFC : ”Keep previous steps in active state” should not be Allowed
In the language extensions tab of project settings, the check-box ”SetSteps: keep previous step(s) in active state” shall
be deactivated.
Comment : This option is only available if the ”Allow multiple token check-box is activated” - see O.U.1.
O.U.3 - SFC : ”Parallel branches: allow jump in/out” should not be Allowed
In the language extensions tab of project settings, the check-box ”Parallel branches: allow jump in/out” shall be deac-
tivated.
Comment : This option is only available if the ”Allow multiple token check-box” is activated - see O.U.1.
O.U.4 - SFC : Only one evolutions by divergence of sequence selection
In the language extensions tab of project settings, the check-box ”Allow multiple evolutions by divergence of sequence
selection” shall be deactivated.
Comment : This option is only available if the ”Allow multiple token check-box” is activated - see O.U.1.
O.U.5 - ST : ”Jump and label” should not be Allowed
In the language extensions tab of project settings, the check-box ”Allow Jump and label” shall be deactivated.
Comment : In general, usage of jumps reduces the readability of the code and therefore its maintainability.
14 Options
PLC programs development guidelines
O.U.6 - Identifiers: leading digits in names should not be Allowed
In the language extensions tab of project settings, the check-box ”Allow leading digits” shall be deactivated.
Comment : In general, usage of leading digits in names reduces the readability and portability of the program.
O.U.7 - Identifiers: the standard (IEC) character set shall be used in names
In the language extensions tab of project settings, the check-box ≪standard≫ shall be deactivated.
Comment : In general, usage of the non standard (IEC) character set in names , reduces the readability and porta-
bility of the program.
O.U.8 - Graphical languages (FBD/LD): Usage of ST expressions should not be Allowed
In the language extensions tab of project settings, the check-box ”Usage of ST expressions” shall be deactivated.
Comment : In general, usage of ST expressions in FBD reduces the readability of the program.
O.U.9 - Upload information: Upload information with comments and animation tables
In the Build tab of project settings (project generation settings) the following check-boxes shall be activated:
1. ≪ Include ≫ in the Upload information,
2. ≪ Comments (Variables and types) ≫ in the Upload information,
3. ≪ Animation tables ≫ in the Upload information
Comment : If the PLC memory allows, the storage of all upload information ensures a smooth restoration of the source
of the project from the PLC, thus improving the long term maintainability (lost backup issues).
O.U.10 - Ladder Diagram : Right-justify coils
In the Editors tab of project settings, the check-box ”Right-justify coils” for Ladder Diagram (LD) shall be activated.
Comment : Right-justify coils allow a better readability of the program.
3.7 Languages
3.7.1 Verification of the programming languages
L.1 - The IL language is forbidden
The Instruction List language is a low level language and thus difficult to read and understand. It is thus recommended
to avoid it as much as possible.
Comment : Depending on the type of PLC being programmed, it may be difficult to avoid the IL language. In-
deed, for example, with a Siemens Step7 PLC, all sections in Ladder (LAD) and Function Block Diagrams (FBD) are
actually saved in the IL language. For other PLCs such as Schneider’s and Rockwell’s, it is much easier to avoid the
usage of the IL language.
Languages 15
PLC programs development guidelines
Chapter 4
Annexes
4.1 Summary of Rules
This annexe summarizes all the rules and useful information contained in this document.
Naming rules
• N.1 - Non-specific - All elements of the program must be named
• N.2 - Non-specific - Elements name length should be in a given range
• N.3 - Non-specific - Topological physical address should not be used as part of a mnemonic
• N.4 - Non-specific - Testing mnemonics should not be part of the final program
• N.5 - Non-specific - Special or graphical characters are prohibited in mnemonics
• N.6 - Non-specific - The programming language keywords should not be used as mnemonics
Commenting rules
• C.1 - Non-specific - All program elements should have a comment
• C.2 - Non-specific - Comments should be longer than a given number of characters
• C.3 - Non-specific - Each network should have a comment
• C.4 - Non-specific - Comments should not only contain the comment start marker
Writing rules
• E.1 - Non-specific - All variables should be written before being read
• E.2.a, E.2.b - Non-specific - Inputs of the user functional blocks should be read and not written.
• E.2.c, E.2.d - Non-specific - Inputs/Outputs of the user functional blocks should be read and written.
• E.2.e - Non-specific - Outputs of the user functional blocks should be written before being read.
• E.U.1 - SE Unity - The functions of the Unity obsolete libraries should not be used
16
PLC programs development guidelines
Structure rules
• S.1 - Non-specific - Backward jumps are forbidden
• S.2 - Non-specific - A variable should be elaborated only in one routine
• S.3 - Non-specific - A variable should be written from one task only
• S.4 - Non-specific - A physical output should be written only once per PLC cycle
• S.5 - SE Unity - Variable should not be localized
• S.6 - Non-specific - DFB/FBs instances should be called once
• S.7 - Non-specific - Declared variables should be used
• S.8 - Non-specific - Variables location doesn’t overlap
• S.9 - Non-specific - Complexity measure
• S.10 - Non-specific - SCADA Limitations
• S.12 - Non-specific - Conditional instructions without default case
• S.13 - Non-specific - SFC diagrams without an initial step
Informations Utilities
• I.1 - Non-specific - Comments rate
• I.2 - Non-specific - Code in the comments
• I.3 - Non-specific - Dead code
• I.4 - Non-specific - List of locked elements
• I.5 - Cyclomatic number v(G)
• I.6 - Essential Complexity ev(G)
• I.7 - Source Line of Code count
• I.8 - SFC steps count
• I.9 - SFC branches count
• I.10 - Copy/Paste detection ratio
Options
• O.U.1 - SE Unity - SFC : ”Multiple Token” should not be Allowed ===
• O.U.2 - SE Unity - SFC : ”Keep previous steps in active state” should not be Allowed ===
• O.U.3 - SE Unity - SFC : ”Parallel branches: allow jump in/out” should not be Allowed ===
• O.U.4 - SE Unity - SFC : Only one evolutions by divergence of sequence selection ===
• O.U.5 - SE Unity - ST : ”Jump and label” should not be Allowed ===
• O.U.6 - SE Unity - Identifiers: leading digits in names should not be Allowed ===
• O.U.7 - SE Unity - Identifiers:Using the standard (IEC) character set in names ===
• O.U.8 - SE Unity - Graphical languages (FBD/LD): Usage of ST expressions should not be Allowed ===
• O.U.9 - SE Unity - Upload information: Upload information with comments and animation tables ===
• O.U.10 - SE Unity - Ladder Diagram : Right-justify coils ===
Summary of Rules 17
PLC programs development guidelines
Languages
• L.1 - Non-specific - The IL language is forbidden ===
4.2 Document history
Date Changes
2010
Jul 12th
Initial version
2010
Dec
21th
Add Options chapter
2011
Nov
9th
Add description for rules S5, S6, S7, S8, S9, S10, I5, I6, I7, I8, I9, I10
2011
Nov
21th
Add version number. Texts Corrections. Extend EU1 rule to all functions of the obsolete libraries
2012
Jan
20th
Proofreading and corrections (grammar, spelling)
2014
Jan
27th
Add description for rules S12, S13 and L1 - Modify N4
2015
Nov
13th
Proofreading and corrections (spelling)
18 Document history
PLC programs development guidelines
For any question or information about Itris Automation products, contact-us by phone at +33(0) 476234320 or
by email at sales@automationsquare.com.
For technical inquiries send an email to support@automationsquare.com.
19
PLC programs development guidelines
20

Weitere ähnliche Inhalte

Was ist angesagt?

Tutorial simocode pro c
Tutorial simocode pro cTutorial simocode pro c
Tutorial simocode pro cconfidencial
 
Mips implementation
Mips implementationMips implementation
Mips implementationRohit Raj
 
B 64484 en-03
B 64484 en-03B 64484 en-03
B 64484 en-03mt7038
 
PERKINS 1300 SERIES WF DIESEL ENGINE Service Repair Manual
PERKINS 1300 SERIES WF DIESEL ENGINE Service Repair ManualPERKINS 1300 SERIES WF DIESEL ENGINE Service Repair Manual
PERKINS 1300 SERIES WF DIESEL ENGINE Service Repair Manualhjnskmdje
 
Treinamento em Programação de Nível Avançado para o Controlador NX-100
Treinamento  em Programação de  Nível Avançado  para o Controlador  NX-100 Treinamento  em Programação de  Nível Avançado  para o Controlador  NX-100
Treinamento em Programação de Nível Avançado para o Controlador NX-100 Gerson Roberto da Silva
 
User Manual_ WH527 LCD Display_King-Meter Technology Co.,Ltd
User Manual_ WH527 LCD Display_King-Meter Technology Co.,LtdUser Manual_ WH527 LCD Display_King-Meter Technology Co.,Ltd
User Manual_ WH527 LCD Display_King-Meter Technology Co.,LtdCory KingMeter
 
Introduction to AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)
Introduction to  AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)Introduction to  AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)
Introduction to AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)Embitel Technologies (I) PVT LTD
 
Cop dvr16 b ( manual )
Cop dvr16 b ( manual )Cop dvr16 b ( manual )
Cop dvr16 b ( manual )falames
 
Case ih jx75 t tier 3 tractor service repair manual
Case ih jx75 t tier 3 tractor service repair manualCase ih jx75 t tier 3 tractor service repair manual
Case ih jx75 t tier 3 tractor service repair manualfjsekksemfmm
 

Was ist angesagt? (12)

Memodulable
MemodulableMemodulable
Memodulable
 
Tutorial simocode pro c
Tutorial simocode pro cTutorial simocode pro c
Tutorial simocode pro c
 
Mips implementation
Mips implementationMips implementation
Mips implementation
 
B 64484 en-03
B 64484 en-03B 64484 en-03
B 64484 en-03
 
PERKINS 1300 SERIES WF DIESEL ENGINE Service Repair Manual
PERKINS 1300 SERIES WF DIESEL ENGINE Service Repair ManualPERKINS 1300 SERIES WF DIESEL ENGINE Service Repair Manual
PERKINS 1300 SERIES WF DIESEL ENGINE Service Repair Manual
 
Treinamento em Programação de Nível Avançado para o Controlador NX-100
Treinamento  em Programação de  Nível Avançado  para o Controlador  NX-100 Treinamento  em Programação de  Nível Avançado  para o Controlador  NX-100
Treinamento em Programação de Nível Avançado para o Controlador NX-100
 
User Manual_ WH527 LCD Display_King-Meter Technology Co.,Ltd
User Manual_ WH527 LCD Display_King-Meter Technology Co.,LtdUser Manual_ WH527 LCD Display_King-Meter Technology Co.,Ltd
User Manual_ WH527 LCD Display_King-Meter Technology Co.,Ltd
 
Introduction to AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)
Introduction to  AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)Introduction to  AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)
Introduction to AUTOSAR BSW (Base Software) & RTE (Real-Time Environment)
 
Cop dvr16 b ( manual )
Cop dvr16 b ( manual )Cop dvr16 b ( manual )
Cop dvr16 b ( manual )
 
Repetitive Scheduling Method RSM
Repetitive Scheduling Method RSMRepetitive Scheduling Method RSM
Repetitive Scheduling Method RSM
 
Case ih jx75 t tier 3 tractor service repair manual
Case ih jx75 t tier 3 tractor service repair manualCase ih jx75 t tier 3 tractor service repair manual
Case ih jx75 t tier 3 tractor service repair manual
 
Multisplit 3x1
Multisplit 3x1Multisplit 3x1
Multisplit 3x1
 

Andere mochten auch

Andere mochten auch (9)

[EN] PLC Checker Datasheet
[EN] PLC Checker Datasheet[EN] PLC Checker Datasheet
[EN] PLC Checker Datasheet
 
[EN] Mesures article: "PLC programs quality checked by their designers"
[EN] Mesures article: "PLC programs quality checked by their designers"[EN] Mesures article: "PLC programs quality checked by their designers"
[EN] Mesures article: "PLC programs quality checked by their designers"
 
Best plc-programming
Best plc-programmingBest plc-programming
Best plc-programming
 
[EN] Success story pharma
[EN] Success story pharma[EN] Success story pharma
[EN] Success story pharma
 
[FR] Récit utilisateur inudstrie pharmaceutique
[FR] Récit utilisateur inudstrie pharmaceutique[FR] Récit utilisateur inudstrie pharmaceutique
[FR] Récit utilisateur inudstrie pharmaceutique
 
[EN] Success story Herakles
[EN] Success story Herakles[EN] Success story Herakles
[EN] Success story Herakles
 
Villaudy_f_2016
Villaudy_f_2016Villaudy_f_2016
Villaudy_f_2016
 
[EN] Club Automation presentation "Quality Model for Industrial Automation", ...
[EN] Club Automation presentation "Quality Model for Industrial Automation", ...[EN] Club Automation presentation "Quality Model for Industrial Automation", ...
[EN] Club Automation presentation "Quality Model for Industrial Automation", ...
 
Best Practices in PLC Programming
Best Practices in PLC ProgrammingBest Practices in PLC Programming
Best Practices in PLC Programming
 

Ähnlich wie [EN] PLC programs development guidelines

Intro to embedded systems programming
Intro to embedded systems programming Intro to embedded systems programming
Intro to embedded systems programming Massimo Talia
 
API design
API designAPI design
API designsakpece
 
Design Patterns in Electronic Data Management
Design Patterns in Electronic Data ManagementDesign Patterns in Electronic Data Management
Design Patterns in Electronic Data ManagementGlen Alleman
 
DBMS_Lab_Manual_&_Solution
DBMS_Lab_Manual_&_SolutionDBMS_Lab_Manual_&_Solution
DBMS_Lab_Manual_&_SolutionSyed Zaid Irshad
 
Distributed Deployment Model Driven Development
Distributed Deployment Model Driven DevelopmentDistributed Deployment Model Driven Development
Distributed Deployment Model Driven DevelopmentPathfinder Solutions
 
Stale pointers are the new black - white paper
Stale pointers are the new black - white paperStale pointers are the new black - white paper
Stale pointers are the new black - white paperVincenzo Iozzo
 
Github-Source code management system SRS
Github-Source code management system SRSGithub-Source code management system SRS
Github-Source code management system SRSAditya Narayan Swami
 
Coding guideline
Coding guidelineCoding guideline
Coding guidelineVu Nguyen
 
robert-kovacsics-part-ii-dissertation
robert-kovacsics-part-ii-dissertationrobert-kovacsics-part-ii-dissertation
robert-kovacsics-part-ii-dissertationRobert Kovacsics
 
Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...
Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...
Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...ItaecioJunior2
 
Exploiting arm linux
Exploiting arm linuxExploiting arm linux
Exploiting arm linuxDan H
 
IEC programing manual
IEC programing manualIEC programing manual
IEC programing manualquanglocbp
 
Picaxe manual3 interfaces
Picaxe manual3 interfacesPicaxe manual3 interfaces
Picaxe manual3 interfacesalto34
 

Ähnlich wie [EN] PLC programs development guidelines (20)

Thesis
ThesisThesis
Thesis
 
Embedded2003
Embedded2003Embedded2003
Embedded2003
 
Intro to embedded systems programming
Intro to embedded systems programming Intro to embedded systems programming
Intro to embedded systems programming
 
API design
API designAPI design
API design
 
ApiDesign
ApiDesignApiDesign
ApiDesign
 
MIL-STD-498:1994
MIL-STD-498:1994MIL-STD-498:1994
MIL-STD-498:1994
 
Systems se
Systems seSystems se
Systems se
 
Design Patterns in Electronic Data Management
Design Patterns in Electronic Data ManagementDesign Patterns in Electronic Data Management
Design Patterns in Electronic Data Management
 
DBMS_Lab_Manual_&_Solution
DBMS_Lab_Manual_&_SolutionDBMS_Lab_Manual_&_Solution
DBMS_Lab_Manual_&_Solution
 
Srs
SrsSrs
Srs
 
Distributed Deployment Model Driven Development
Distributed Deployment Model Driven DevelopmentDistributed Deployment Model Driven Development
Distributed Deployment Model Driven Development
 
Stale pointers are the new black - white paper
Stale pointers are the new black - white paperStale pointers are the new black - white paper
Stale pointers are the new black - white paper
 
Github-Source code management system SRS
Github-Source code management system SRSGithub-Source code management system SRS
Github-Source code management system SRS
 
Micro Assembler
Micro AssemblerMicro Assembler
Micro Assembler
 
Coding guideline
Coding guidelineCoding guideline
Coding guideline
 
robert-kovacsics-part-ii-dissertation
robert-kovacsics-part-ii-dissertationrobert-kovacsics-part-ii-dissertation
robert-kovacsics-part-ii-dissertation
 
Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...
Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...
Book - Automating with SIMATIC_ Controllers, Software, Programming, Data Comm...
 
Exploiting arm linux
Exploiting arm linuxExploiting arm linux
Exploiting arm linux
 
IEC programing manual
IEC programing manualIEC programing manual
IEC programing manual
 
Picaxe manual3 interfaces
Picaxe manual3 interfacesPicaxe manual3 interfaces
Picaxe manual3 interfaces
 

Mehr von Itris Automation Square

[FR] Récit Utilisateur Industrie Pharmaceutique
[FR] Récit Utilisateur Industrie Pharmaceutique[FR] Récit Utilisateur Industrie Pharmaceutique
[FR] Récit Utilisateur Industrie PharmaceutiqueItris Automation Square
 
SPS IPC Drives 2015 - Itris Automation paper
SPS IPC Drives 2015 - Itris Automation paperSPS IPC Drives 2015 - Itris Automation paper
SPS IPC Drives 2015 - Itris Automation paperItris Automation Square
 
[EN] Itris Automation - Company presentation
[EN] Itris Automation - Company presentation [EN] Itris Automation - Company presentation
[EN] Itris Automation - Company presentation Itris Automation Square
 
Risk management and business protection with Coding Standardization & Static ...
Risk management and business protection with Coding Standardization & Static ...Risk management and business protection with Coding Standardization & Static ...
Risk management and business protection with Coding Standardization & Static ...Itris Automation Square
 
[DE] Itris Automation - Unternehmenspräsentation
[DE] Itris Automation - Unternehmenspräsentation[DE] Itris Automation - Unternehmenspräsentation
[DE] Itris Automation - UnternehmenspräsentationItris Automation Square
 
[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....
[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....
[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....Itris Automation Square
 

Mehr von Itris Automation Square (18)

[FR] Récit Utilisateur Eiffage Energie
[FR] Récit Utilisateur Eiffage Energie[FR] Récit Utilisateur Eiffage Energie
[FR] Récit Utilisateur Eiffage Energie
 
[FR] Récit Utilisateur Industrie Pharmaceutique
[FR] Récit Utilisateur Industrie Pharmaceutique[FR] Récit Utilisateur Industrie Pharmaceutique
[FR] Récit Utilisateur Industrie Pharmaceutique
 
[EN] Success Story ArianeGroup
[EN] Success Story ArianeGroup[EN] Success Story ArianeGroup
[EN] Success Story ArianeGroup
 
[FR] Récit Utilisateur ArianeGroup
[FR] Récit Utilisateur ArianeGroup[FR] Récit Utilisateur ArianeGroup
[FR] Récit Utilisateur ArianeGroup
 
PLCopen Webinar Presentation
PLCopen Webinar PresentationPLCopen Webinar Presentation
PLCopen Webinar Presentation
 
SPS IPC Drives 2015 - Itris Automation paper
SPS IPC Drives 2015 - Itris Automation paperSPS IPC Drives 2015 - Itris Automation paper
SPS IPC Drives 2015 - Itris Automation paper
 
[IT] PLC Converter Presentation
[IT] PLC Converter Presentation[IT] PLC Converter Presentation
[IT] PLC Converter Presentation
 
[EN] PLC DocGen Datasheet
[EN] PLC DocGen Datasheet[EN] PLC DocGen Datasheet
[EN] PLC DocGen Datasheet
 
[FR] Fiche produit PLC Converter
[FR] Fiche produit PLC Converter[FR] Fiche produit PLC Converter
[FR] Fiche produit PLC Converter
 
[FR] Fiche produit PLC DocGen
[FR] Fiche produit PLC DocGen[FR] Fiche produit PLC DocGen
[FR] Fiche produit PLC DocGen
 
[FR] Papier Cetsis 2014 - PLC Checker
[FR] Papier Cetsis 2014 - PLC Checker[FR] Papier Cetsis 2014 - PLC Checker
[FR] Papier Cetsis 2014 - PLC Checker
 
[FR] Poster Cetsis 2014 - PLC Checker
[FR] Poster Cetsis 2014 - PLC Checker[FR] Poster Cetsis 2014 - PLC Checker
[FR] Poster Cetsis 2014 - PLC Checker
 
[EN] Itris Automation - Company presentation
[EN] Itris Automation - Company presentation [EN] Itris Automation - Company presentation
[EN] Itris Automation - Company presentation
 
Risk management and business protection with Coding Standardization & Static ...
Risk management and business protection with Coding Standardization & Static ...Risk management and business protection with Coding Standardization & Static ...
Risk management and business protection with Coding Standardization & Static ...
 
[DE] Itris Automation - Unternehmenspräsentation
[DE] Itris Automation - Unternehmenspräsentation[DE] Itris Automation - Unternehmenspräsentation
[DE] Itris Automation - Unternehmenspräsentation
 
[EN] Press kit IAS
[EN] Press kit IAS[EN] Press kit IAS
[EN] Press kit IAS
 
[FR] Dossier de presse IAS
[FR] Dossier de presse IAS[FR] Dossier de presse IAS
[FR] Dossier de presse IAS
 
[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....
[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....
[FR] Presentation Club Automation "Modele Qualite pour l'automatisme" 22 nov....
 

Kürzlich hochgeladen

OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 

Kürzlich hochgeladen (20)

DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 

[EN] PLC programs development guidelines

  • 1. PLC programs development guide- lines Itris Automation Square- November 13th 2015 - Version 1.7.0 www.itris-automation.com ©Itris Automation 2008-2015
  • 2.
  • 3. Contents 1 Document purpose 4 2 Document structure 5 2.1 Rules classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Presentation of each rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 Coding Rules 6 3.1 Naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.1.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.2 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3 Writing code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3.2 Unity Pro specific rules (Schneider Electric). . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.4.1 PLCs common Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.5 Useful Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.5.1 Useful information for all PLCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.6 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.6.1 Unity Project Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.7 Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.7.1 Verification of the programming languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4 Annexes 16 4.1 Summary of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.2 Document history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
  • 4.
  • 5. PLC programs development guidelines Chapter 1 Document purpose This document contains coding style guidelines for PLC programming, to improve readability, maintainability and the consistency of PLC programs. It describes simple rules which allow to get meaningful quality indicators from the first day of development. All rules in this document are checked automatically with PLC Checker, which supports PL7 PRO and Unity Pro from Schneider Electric, STEP7 from Siemens and Rockwell Automation RSLogix 5000 PLCs. This document was written by IAS’ seasoned consultants, based on analysis results of many codes used by Itris Automation Square’s customers in several industries and using various ranges of PLCs. It also reflects some best practices from other computer engineering domains such as embedded systems, which have been applying standard sets of programming guidelines for years. 4
  • 6. PLC programs development guidelines Chapter 2 Document structure 2.1 Rules classification The rules described in this document are classified into several categories: Naming, Comments, Writing and Structure. The last part of this document also provides useful information which are not only about coding rules, but also allow improvements of the programs’ quality. The last part is about the rules on the options of the PLC workbench. Each category is divided into two parts: 1) The rules that may be applied independently of the PLC for which the program is developed. 2) The rules that are only relevant for a specific PLC or that need to be adapted in order to be applicable. 2.2 Presentation of each rule The rules are numbered according to their implementation in ”PLC Checker”. For each rule, we find an identical struc- ture made up of a title, an explanation of the rule, a justification of its importance and, when relevant, a code example to facilitate understanding of the rule. 5
  • 7. PLC programs development guidelines Chapter 3 Coding Rules 3.1 Naming The elements manipulated in PLCs have mnemonics. Elements are, for example, variables, routines (sections, sub- routines, FCs . . . ) or function blocks (FB). The purpose of this section is to make sure that the symbols follow rules ensuring readability, maintainability and allow for greater code durability. Generally, the libraries elements are ex- cluded from naming verification. Of course, when the workbench allows this, we don’t recommend to change the elements’ names defined in the libraries. 3.1.1 PLCs common Rules N.1 - All program elements should have a mnemonic All program’s elements should have a mnemonic (program, modules, variables, DFB, FB, OB, SR, routine, Add-On).. Comment : When all programs elements have a mnemonic, maintenance is easier and it is easier to understand program content. Moreover, not using mnemonic makes an implicit link between a code and an hardware implementa- tion. N.2 - Elements names length should be in a given range The names of program elements must contain at least 3 characters and no more than 15 characters. Comment : A minimum number of characters ensures more meaningful naming. A maximum number of characters allows: • In Schneider Unity, Schneider PL7pro and Rockwell RSLogix : to avoid the mnemonics being truncated in display or export, . . . • In Siemens Step7: to improve readability N.3 - Topological physical address should not be used as part of a mnemonic The mnemonics shall not contain a reference to their physical address (for instance, ”MW2”, ”FB4”. . . ). Comment : The reference to the physical address of the entity in the code may have bad properties : readability is worse, and it may induce dangerous confusion. It should be noted that with the evolution of software workbenches, referencing the elements names by their physical address is not necessary anymore. Even-though such a reference to the physical address may be unintentional, it is prohibited. Example : 6
  • 8. PLC programs development guidelines Physical ad- dress Mnemonics comment %MW23 Cde 23 Never link the naming of the variable to its physical address N.4 - Debug mnemonics should not be part of the final program Debug mnemonics although useful during development shall not be part of the final program. For example, some names such as test, todo, to be removed, ... are forbidden and comments shall not contain expressions that may lead to think that the program is still to be completed (todo, to be removed, to be completed later...). The same applies to non identified variables (whose name contains unknown or ?. . . ). Comment : Leaving debug items in the final program reduces its readability and may have different behavior than expected. The list of prohibited elements is configurable (of course, it is language specific). N.5 - Special or graphical characters are prohibited in mnemonics The special characters set (e.g : `a, ´e, c¸. . . ), space and accents are prohibited in the mnemonics names. Only alphanu- merical characters and the underscore are allowed. Comment : Using special characters, may generate some problems of portability to future workbench version and / or to other platforms. It also reduces the readability in an international context. Finally, the restriction to only alphanumerical characters ensures a better distinction between variable names. Example : d´epart := true; # .... Lines of code depart := false; #Using the special character ’´e’, leads to a confusion between mnemonics. N.6 - The programming language keywords should not be used as mnemonics Programming language keywords (for example “if”, “set”, “start”. . . ) should not be used as mnemonics. But it is possible that mnemonics contain a keyword. Most cases are handled by PLC workbench, but there are exceptions. Comment : Using keywords as mnemonics lowers program readability and portability. Example : start := true; # mistaken mnemonic, "start" is a language keyword start_motor := true; # Correct mnemonic 3.2 Comments In addition to good naming practices, it is important to follow rules when commenting programs. In fact, the more explicit and detailed the comments are, the more the code will be understandable. Generally, the standard library elements comments are not checked. Comments 7
  • 9. PLC programs development guidelines 3.2.1 PLCs common Rules C.1 - All program elements should have a comment All program elements must be commented (Program, Section, Modules, Variables, DFB, FB, OB, SR). Comment : If all the program elements are commented significantly, it is easier to read and understand the pro- gram, therefore its maintenance is less costly. C.2 - Comments should be longer than a given number of characters The comments of program elements must contain a minimum number of characters (7 for variables, 15 for codes) to avoid insignificant comments. Comment : Having a minimum length ensures that the comments are more meaningful. C.3 - Each network should have a comment The networks must be commented. This rule is specific to some languages of the IEC61131 standard. Also please note that the concept of network is not always present in PLC vendor IDEs. Comment : In addition to a good overall rate of comments, it’s important to ensure that comments are well dis- tributed within the program. Such a rule is also a guide that ensures consistency when copy/pasting code sections. C.4 - Comments should not contain comment start marker Comments should not contain comment start marker (e.g, ”/ *”, ”( *”). Comment : The presence of a comment start marker is often a symptom of a forgotten comment end marker, which can lead to commenting out of a part of program and thus a non intended behavior. Example: /* Any comment with the end marker has been forgotten Critical_section_that_must_be_executed_which_is_found_in_the comment(); /* <- The start marker comment is commented because the end marker of the previous comment has been forgotten */ 3.3 Writing code 3.3.1 PLCs common Rules E.1 - All variables should be written before being read Except for physical and communication inputs and system variables, all variables should be written before being read during a PLC cycle. Comment : a variable that is read before being written, can increase program latency. Efficient code should respect during one PLC cycle the following diagram: inputs reading -> processing -> update the outputs. 8 Writing code
  • 10. PLC programs development guidelines In addition, make sure that the variables that are never written in the code have been initialized, otherwise they are updated by other ways. In some cases it is justified to ignore this rule: • variables that were initialized in the database, • variables updated by a communications link, • state variables that store the value of a previous PLC cycle. Example: if urgentAlarme then alarmeTreatement(); end if; # ... urgentAlarme := presenceDefault AND ...; In this example, the call of the alarm function “alarmTraitement” happens during the next PLC cycle, which increases the average response time. This delay is around one PLC cycle. E.2 - The parameters of the user functional blocks should be used correctly This rule is divided into three sub-rules : • E.2.a and b - Inputs of the user functional blocks should be read and not written. • E.2.c and d - Inputs/Outputs of the user functional blocks should be read and written. • E.2.e - Outputs of the user functional blocks should be written before being read. Comment : Parameters incorrectly used are evidence of unfinished code or a code that still contains unnecessary el- ements of correct behavior. In some PLCs, misusing parameters may generate undesirable and potentially dangerous effects, such as data corruption. Please note that checking whether private parameters of user blocks are used is done by the rule S7. 3.3.2 Unity Pro specific rules (Schneider Electric). E.U.1 - The functions of the Unity obsolete libraries should not be used In a new Unity Pro PLC Project, the functions of the obsolete libraries should not be used. Comment : In Unity, some libraries are obsolete and exist to ensure backward compatibility with previous ver- sions of Schneider PLCs. In new applications, the usage of the functions of those libraries must be avoided for future portability problems. Furthermore, some of those functions can make the code nondeterministic (ex: shifts on signed integers shl int, shlz int, shr int, shrz int, rol int, ror int). Writing code 9
  • 11. PLC programs development guidelines 3.4 Structure 3.4.1 PLCs common Rules S.1 - Backward jumps are forbidden Backward jumps are forbidden. Comment : Using a backward jump can trigger an infinite loop, which can lead to a PLC shutdown. Moreover, in general, jumps make the code less understandable and therefore their maintenance is more complex. Example: Example of jump which triggers an infinite loop Figure 3.1: Example of jump which triggers an infinite loop S.2 - A variable should be elaborated only in one routine A variable should be elaborated only in one routine. Comment : A simple and clear code architecture facilitates understanding of the code and therefore its mainte- nance. Moreover, multiple variable elaborations can lead to erratic behavior of the code. S.3 - A variable should be written from one task only A variable should be written from one task only. Comment : writing a variable from several tasks leads to an nondeterministic behavior, such as a potential access conflict. S.4 - A physical output should be written only once per PLC cycle A physical output should be written only once per PLC cycle. Comment : Multiple output writing may lead to problems of dependability. Also, a code where the outputs are written more than once is less easy to understand and maintain. It should be noted that writing in a loop is considered as multiple writing and therefore constitutes a violation of this rule. Example: 10 Structure
  • 12. PLC programs development guidelines if very_complicated_condition then Critical_Output := TRUE; end if; #.... much later in the program if another_very_complicated_condition then Critical_Output := FALSE; end if; In the case where the output is not controlled where it should be, it is very difficult to identify which affectation is executed S.5 - Variables should not be localized Variable memory mapping should be reserved to variables which elaboration or consumption is done out of the program : communication tags, I/O variables, special function variables. All internal variables should not be localized. Detailed explanation : Using localized variables constraints program evolution, due to a more rigid memory or- ganization. It reduces portability, as memory organization varies from one PLC to another. So the code cannot be reused in another application, as in the other application the given memory zone may be reserved for other purposes. Moreover, it may lead to memory organization mistakes in which several variables will be saved in the same memory cells. This bug may be silent during a long time and be encountered late in the development or in the production cycle. S.6 - DFB/FBs instances should be called only once Comment : A functional block instance owns its variables used to save the FB state between two consecutive cycles. Each FB execution should modify those variables to show the state evolution. When executed more than once, it looks like the cycle is progressing twice quicker than the other instances. Often used more than once, the same instance is the result of a cut and paste not updated. It may lead to bugs hard to discover. S.7 - Declared variables should be used Variables and defined types should be used, except for reserve variables. Reserve variables shall not be used. Comment : Variables (except reserves) and unused types are often a sign of a forgotten treatment or incomplete database cleaning. When reserve variables are used this is often the sign of a forgotten renaming. S.8 - Variables location shall not overlap The overlapping variables are to be checked. Comment : Localized variables that overlap are equivalent to an implicit transfer of value between each other. This is sometimes a difficulty to code readability. It is also sometimes a localization error. S.9 - Complexity measure Complexity of the code shall be assessed. Loops (for, repeat, while), jumps and a high level of imbrication are criteria of code complexity. Comment : Parts of program are more complicated than others. This is specially the case when execution sequen- tial flow is often cut. This rule searches for some root causes for flow discontinuation, like loops, backward goto and high complex instructions nested level. Structure 11
  • 13. PLC programs development guidelines S.10 - SCADA Limitations SCADA software doesn’t support structures arrays. Such constructions shall be avoided for portability purposes. Comment : When using a SCADA which doesn’t support array of structures, it is important to not build a PLC database based on these arrays of structures. This rule is used here to detect this kind of construction. S.12 - Conditional instructions without default case In some standards, it may be requested to always add a default case to conditional instructions (IF, CASE, . . . ). Comment : The goal of that rule is to make sure that for each IF instruction there is a ELSE statement and that for each CASE instruction there is a OTHERS statement. Thus , the developer is making sure that all cases have been taken into account in the program, even if it’s a ’ELSE NULL;’ case. S.13 - SFC diagrams without an initial step SFC diagrams without any initial steps should be explicitly identified. Comment : Such diagrams are generally launched for other sections in the program. It is more complicated to understand the behavior of the diagram, thus reducing the maintainability of the application. 3.5 Useful Information 3.5.1 Useful information for all PLCs I.1 - Comments rate It is recommended that the code contains a minimum percentage of comments. Comment : Itris Automation Square recommends a rate of 30% (# of commented instructions / total # of in- structions). Such a minimum rate of comments ensures that the development was carried taking into account the maintainability of the code, and ensuring that it will be easy to understand when evolution is needed. I.2 - Code in the comments It is very important to check the possible presence of code as comments. Comment : Commenting out code is a typical test and debug strategy. The final program should not contain com- mented out code as maintenance technicians may be confused. I.3 - Dead code Provision shall be made against the presence of dead code in the program. Clarification : Dead code affects the readability and maintainability of the program and can be a symptom of a functional problem. Please note that when PLC Checker detects unreferenced functions and parts of isolated code after an unconditional jump, the completeness of the detection is not guaranteed (for example, dead code related to the evaluation of an expression). I.4 - List of locked elements The locked elements are not scanned by PLC Checker, they should be identified for manual review. Comment : In applications where the major part of the code is locked, it is important to know it. 12 Useful Information
  • 14. PLC programs development guidelines I.5 - Cyclomatic number v(G) A cyclomatic number gives information about complexity. It is important to keep it reasonably low. Comment : A cyclomatic number counts the number of different paths that can be executed in a routine. The higher this number is, the more difficult it is to validate the correct behavior of the routine. In such a case, the routine should be divided in subroutines. Each of them having a cyclomatic number below the given threshold. I.6 - Essential Complexity ev(G) Essential complexity gives information about unstructured instructions. It is important to keep it reasonably very low. Comment : Essential complexity counts the number of different unstructured instructions in a routine. The higher this number is, the more difficult it is to validate the correct behavior of the routine. Most of the time, unstructured instructions can normally be replaced by structured instructions. I7 - Source Line of Code count The source line of code counts number of instructions in a POU. It is important to keep it under control. Comment : Very big procedure or function blocks may be difficult to test, to read and to maintain. It may be better to split a very big procedure into two or more procedures of reasonable size. I8 - Sequential Function Chart (SFC) steps count This is the count of steps in a given SFC. Comment : This rules returns the number of steps found by SFC. This number may be further used to detect complex SFCs or to give an overview of the relative size of SFCs. I9 - SFC branches count This number sums the number of branches in each AND/OR divergence found in a given SFC. Comment : This rule calculates the number of branches available in a given SFC. This count gives information about SFC complexity. This number is equivalent to the v(G) applied to imperative coding languages. I10 - Copy/Paste detection ratio This number detects the percentage of code which is redundant. Comment : Reusing the code by copying code is not a good practice. Maintenance and evolution are more expensive to perform because modifications and corrections should be applied at each copy/paste instance. Moreover, the manual copy/paste is error prone : after doing the copy/paste, code should be modified. When code is not modified correctly, it introduces subtle bugs hard to discover. 3.6 Options 3.6.1 Unity Project Options O.U.1 - SFC : ”Multiple Token” should not be Allowed In the language extensions tab of project settings, the check-box ”Allow multiple token” shall be deactivated. Comment : The only purpose of the multiple token mode is to ensure backward compatibility with previous ver- sions of Schneider PLCs. It should not be used in new projects because it can make the code indeterministic. SFC code with Multi Token is not compliant with IEC 61131-3. Example: In the following SFC code, if the condition ”A” is always true, after several PLC cycles, all steps are simultaneously active. Options 13
  • 15. PLC programs development guidelines Figure 3.2: indeterministic SFC in multi-token mode O.U.2 - SFC : ”Keep previous steps in active state” should not be Allowed In the language extensions tab of project settings, the check-box ”SetSteps: keep previous step(s) in active state” shall be deactivated. Comment : This option is only available if the ”Allow multiple token check-box is activated” - see O.U.1. O.U.3 - SFC : ”Parallel branches: allow jump in/out” should not be Allowed In the language extensions tab of project settings, the check-box ”Parallel branches: allow jump in/out” shall be deac- tivated. Comment : This option is only available if the ”Allow multiple token check-box” is activated - see O.U.1. O.U.4 - SFC : Only one evolutions by divergence of sequence selection In the language extensions tab of project settings, the check-box ”Allow multiple evolutions by divergence of sequence selection” shall be deactivated. Comment : This option is only available if the ”Allow multiple token check-box” is activated - see O.U.1. O.U.5 - ST : ”Jump and label” should not be Allowed In the language extensions tab of project settings, the check-box ”Allow Jump and label” shall be deactivated. Comment : In general, usage of jumps reduces the readability of the code and therefore its maintainability. 14 Options
  • 16. PLC programs development guidelines O.U.6 - Identifiers: leading digits in names should not be Allowed In the language extensions tab of project settings, the check-box ”Allow leading digits” shall be deactivated. Comment : In general, usage of leading digits in names reduces the readability and portability of the program. O.U.7 - Identifiers: the standard (IEC) character set shall be used in names In the language extensions tab of project settings, the check-box ≪standard≫ shall be deactivated. Comment : In general, usage of the non standard (IEC) character set in names , reduces the readability and porta- bility of the program. O.U.8 - Graphical languages (FBD/LD): Usage of ST expressions should not be Allowed In the language extensions tab of project settings, the check-box ”Usage of ST expressions” shall be deactivated. Comment : In general, usage of ST expressions in FBD reduces the readability of the program. O.U.9 - Upload information: Upload information with comments and animation tables In the Build tab of project settings (project generation settings) the following check-boxes shall be activated: 1. ≪ Include ≫ in the Upload information, 2. ≪ Comments (Variables and types) ≫ in the Upload information, 3. ≪ Animation tables ≫ in the Upload information Comment : If the PLC memory allows, the storage of all upload information ensures a smooth restoration of the source of the project from the PLC, thus improving the long term maintainability (lost backup issues). O.U.10 - Ladder Diagram : Right-justify coils In the Editors tab of project settings, the check-box ”Right-justify coils” for Ladder Diagram (LD) shall be activated. Comment : Right-justify coils allow a better readability of the program. 3.7 Languages 3.7.1 Verification of the programming languages L.1 - The IL language is forbidden The Instruction List language is a low level language and thus difficult to read and understand. It is thus recommended to avoid it as much as possible. Comment : Depending on the type of PLC being programmed, it may be difficult to avoid the IL language. In- deed, for example, with a Siemens Step7 PLC, all sections in Ladder (LAD) and Function Block Diagrams (FBD) are actually saved in the IL language. For other PLCs such as Schneider’s and Rockwell’s, it is much easier to avoid the usage of the IL language. Languages 15
  • 17. PLC programs development guidelines Chapter 4 Annexes 4.1 Summary of Rules This annexe summarizes all the rules and useful information contained in this document. Naming rules • N.1 - Non-specific - All elements of the program must be named • N.2 - Non-specific - Elements name length should be in a given range • N.3 - Non-specific - Topological physical address should not be used as part of a mnemonic • N.4 - Non-specific - Testing mnemonics should not be part of the final program • N.5 - Non-specific - Special or graphical characters are prohibited in mnemonics • N.6 - Non-specific - The programming language keywords should not be used as mnemonics Commenting rules • C.1 - Non-specific - All program elements should have a comment • C.2 - Non-specific - Comments should be longer than a given number of characters • C.3 - Non-specific - Each network should have a comment • C.4 - Non-specific - Comments should not only contain the comment start marker Writing rules • E.1 - Non-specific - All variables should be written before being read • E.2.a, E.2.b - Non-specific - Inputs of the user functional blocks should be read and not written. • E.2.c, E.2.d - Non-specific - Inputs/Outputs of the user functional blocks should be read and written. • E.2.e - Non-specific - Outputs of the user functional blocks should be written before being read. • E.U.1 - SE Unity - The functions of the Unity obsolete libraries should not be used 16
  • 18. PLC programs development guidelines Structure rules • S.1 - Non-specific - Backward jumps are forbidden • S.2 - Non-specific - A variable should be elaborated only in one routine • S.3 - Non-specific - A variable should be written from one task only • S.4 - Non-specific - A physical output should be written only once per PLC cycle • S.5 - SE Unity - Variable should not be localized • S.6 - Non-specific - DFB/FBs instances should be called once • S.7 - Non-specific - Declared variables should be used • S.8 - Non-specific - Variables location doesn’t overlap • S.9 - Non-specific - Complexity measure • S.10 - Non-specific - SCADA Limitations • S.12 - Non-specific - Conditional instructions without default case • S.13 - Non-specific - SFC diagrams without an initial step Informations Utilities • I.1 - Non-specific - Comments rate • I.2 - Non-specific - Code in the comments • I.3 - Non-specific - Dead code • I.4 - Non-specific - List of locked elements • I.5 - Cyclomatic number v(G) • I.6 - Essential Complexity ev(G) • I.7 - Source Line of Code count • I.8 - SFC steps count • I.9 - SFC branches count • I.10 - Copy/Paste detection ratio Options • O.U.1 - SE Unity - SFC : ”Multiple Token” should not be Allowed === • O.U.2 - SE Unity - SFC : ”Keep previous steps in active state” should not be Allowed === • O.U.3 - SE Unity - SFC : ”Parallel branches: allow jump in/out” should not be Allowed === • O.U.4 - SE Unity - SFC : Only one evolutions by divergence of sequence selection === • O.U.5 - SE Unity - ST : ”Jump and label” should not be Allowed === • O.U.6 - SE Unity - Identifiers: leading digits in names should not be Allowed === • O.U.7 - SE Unity - Identifiers:Using the standard (IEC) character set in names === • O.U.8 - SE Unity - Graphical languages (FBD/LD): Usage of ST expressions should not be Allowed === • O.U.9 - SE Unity - Upload information: Upload information with comments and animation tables === • O.U.10 - SE Unity - Ladder Diagram : Right-justify coils === Summary of Rules 17
  • 19. PLC programs development guidelines Languages • L.1 - Non-specific - The IL language is forbidden === 4.2 Document history Date Changes 2010 Jul 12th Initial version 2010 Dec 21th Add Options chapter 2011 Nov 9th Add description for rules S5, S6, S7, S8, S9, S10, I5, I6, I7, I8, I9, I10 2011 Nov 21th Add version number. Texts Corrections. Extend EU1 rule to all functions of the obsolete libraries 2012 Jan 20th Proofreading and corrections (grammar, spelling) 2014 Jan 27th Add description for rules S12, S13 and L1 - Modify N4 2015 Nov 13th Proofreading and corrections (spelling) 18 Document history
  • 20. PLC programs development guidelines For any question or information about Itris Automation products, contact-us by phone at +33(0) 476234320 or by email at sales@automationsquare.com. For technical inquiries send an email to support@automationsquare.com. 19
  • 21. PLC programs development guidelines 20