Module 1 - T04 Basic Programming ESME - HVAC - v3.1
Module 1 - T04 Basic Programming ESME - HVAC - v3.1
4 DEBUGGING TOOLS
5 LIBRARIES
6 DATA TYPES
> Modbus objects (EEPROM Parameters, Status Variables, Enumerations, BIOS Parameters)
> Variable Categories in ESME HVAC
> Physical I/O Mapping
> BIOS Parameters
> Menus
EcoStruxure
Communication
Module
ATV212 EEV Driver IEM3000 M172DCL Temp. Sens. Pressure Sens. Hum. Sensor Zelio Relays & SSRs
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 4
CONFIGURATION Persp. - Modbus objects
EEPROM Parameters
EEPROM Parameters:
> Modbus address
> last value is kept also after device reboot (or power-off/on)
> granted for up to 100.000 max writes
> protected from re-write of same value
Param
Name
> Installer type: on Modbus side (external)
Modbus Address IEC type = Installer type • Scale + Offset
> IEC type: on PLC side (internal)
Range: 16384 … 20479
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 5
CONFIGURATION Persp. - Modbus objects
Status Variables
Status Variables:
> Modbus address
> after device reboot, value be will equal to Default value (last value is lost)
> unlimited number of writes possible
> Default, Min and Max assignable only to R/W ones (Read only = FALSE)
Modbus Address > Installer type: on Modbus side (external) IEC type = Installer type • Scale + Offset
Range: 8960 … 13959 > IEC type: on PLC side (internal)
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 6
CONFIGURATION Persp. - Modbus objects
Enumerations for Installer Type
Enums:
> Useful for commissioning as strings are assigned to integer numbers
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 7
Overview - Variable Categories in ESME HVAC
Comparison between variable categories
Variable Modbus Reset to default Available in the whole Used for
Category Address after reboot project (globally)
Configuration parameters
EEPROM Par. YES NO YES
(setpoints, schedule settings, machines state, etc.)
States or variables changing often that need to be available
Status Var. YES YES YES
on Modbus (probe temperature, fan speed, current set, etc.)
Variables required to be used in the whole project, but which
Global Var. NO YES YES
do not need to be accessible from Modbus
> EEPROM Parameters are read only in the Programs. You must use Target Vars to change the Param. via PLC code
> Global Variables are as Status Variables, but without Modbus Address
> Local Variables cannot be accessed from other programs but the one where they have been defined. In case of name
coincidence, local ones have higher priority over global ones.
> Retained after reboot are EEPROM parameters , BIOS Parameters and Retain Variables.
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 8
Important Note - Retain Variables
> Set as variable address size DW (double WORD) and data block 102.xx where:
• in the M172P xx=0
• in the M171P xx=0,...99
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 9
I/O Mapping
CONFIGURATION Perspective
Physical I/O Mapping
Connected Everywhere
EcoStruxure
Communication
Module
ATV212 EEV Driver IEM3000 M172DCL Temp. Sens. Pressure Sens. Hum. Sensor Zelio Relays & SSRs
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 11
CONFIGURATION Perspective
Physical I/O Mapping
I/O Mapping:
> Inputs and Outputs, Analog or Digital, which are present:
▪ Local: on the base PLC
▪ Field: via CAN expansions
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 12
CONFIGURATION Perspective
Physical I/O Configuration: BIOS Parameters
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 13
CONFIGURATION Perspective
Analog Inputs truth table Cfg_AI1
0 1 2 3, 11 4 5 6 7 8 9 10
(AI1, AI2) and (AI3, AI4) and …
(AI11, AI12) must be complied 0 x x x x
with this truth table where: 1 x x x x
0=NTC(NK103) 2
1=DI
x x x x
2=NTC(103AT) 3, 11 x
3=4÷20mA 4 x
4=0÷10V
Cfg_AI2 5 x x
5=0÷5V (Ratiometric)
6=PT1000 6 x x x
7=hOhm (pull-up 10K)
7 x x x x
8=daOhm (pull-up 2K)
9=PTC 8 x x x
10=0÷5V 9
11=0÷20mA
x x x
10 x x
The cells marked with X indicate combinations of Cfg_AI1 and Cfg_AI2 eligible. Choices outside causing
the error indication 0x8003 field value of the two probes. Same table when you consider the other couples.
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 14
SE Building Sensors Lib
> Additional functionality for NTC conversion to building sensors:
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 15
PROGRAMMING Perspective
Deep-dive
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 17
PROGRAMMING Perspective
Programming Languages
ESME HVAC supports 5 programming languages in compliance
with IEC 61131-3.
Two are text-based and three are graphical-based:
> ST – Structured Text (close to C)
> FBD – Functional Block Diagram (graphical)
> LD – Ladder (graphical)
> IL – Instruction List (text)
> SFC – Sequential Function Chart (graphical)
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 18
PROGRAMMING Persp - Tasks Management
> For a program to run, it must be assigned to a task.
Task Description Note
Boot It executes only once at system startup
Init It executes once: - at each download of the application; - on starting up the system, after Boot.
It executes continuously at regular time • The default time setting depends on target type (100ms on M172P).
Timed
intervals which can be set. • The regulation programs should ideally be assigned to Timed
Modbus Used for Modbus Master on-event messages. Only available on M171O target.
It executes continuously at low priority, after Executed one or more times between the end of a Timed task and the
Background
the execution of the Timed task. start of the next. It can be paused any time because of a Timed task.
Exe
Background
Background
Background
Background
Exe Exe Exe Other Exe Exe
Timed Boot Init Timed System Timed Timed
Tasks
Timed Period
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 19
PROGRAMMING Persp. - Task Execution Time
How To Change the
default Timed Task
execution time:
▪ Task Configuration
▪ Set Period
▪ Period
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 20
PROGRAMMING Perspective - Program Assignement
How To Assign an
existing program to a
Task:
▪ Drag-and-drop
▪ “Add program“ context
menu
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 21
PROGRAMMING Persp. - Object Import from library or project
How To import objects
from a library or project:
▪ Open Project < Import
Objects
▪ Browse the file
▪ Select the objects to
Import
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 22
PROGRAM
Step by Step
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 30
PROGRAMMING Perspective - Shortcuts
Find in Editor CTRL F
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 31
PROGRAMMING Perspective – Cross References
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 32
PROGRAMMING Perspective – Refactor
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 33
PROGRAMMING Perspective – Reuse Code
Import Objects or Multiple Files Project
Select .plcprj
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 34
PROGRAMMING Perspective– Code Encryption
Save Intellectual Property
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 35
PROGRAMMING Perspective – Restart Behavior
HALT, Cold, Warm, Hot, Reboot – Reset to DEFAULT, Task processed
x x x x
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 36
Debugging Tools
Deep-dive
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 38
Debugging Tools – System Variables
Operators and Blocks
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 39
Debugging Tools – Oscilloscope
1 2 3 4 5 6
1. The Oscilloscope includes two measure bars.
> Helpful to take some measures on the trace
2. The tool highlights the single values detected during data acquisition.
> Click on the same item to go back to the default view mode.
3. Display the variables in separated traces
4. Display complete measurements
5. Horizontal Display All
6. Vertical Display All
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 40
Debugging Tools – Trigger
Text Trigger
Watch Tool or
Drag & Drop
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 41
Debugging Tools – Trigger
Graphic Trigger
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 42
Debugging Tools – Breakpoints
How To use
▪ Breakpoints
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 43
Libraries
Deep-dive
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 45
Library Properties
> Right Click, Object Properties
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 46
Basic Addons Library
> Additional functionality for:
> Data Conversion
> Data Interpretation
> Bit to Word
> Linear Conversion
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 47
Command Line Compilation
PROGRAMMING compilation can be called from Command Line
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 49
Appendix
Data Types
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 52
DATA TYPES - Integer
> Base Display & Register
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 53
DATA TYPES - Double Integer
> Base Display & Register
32 bit data
0: positive number
1: negative number
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 54
DATA TYPES - Unsigned Integer
> Base Display
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 55
DATA TYPES - Unsigned Double Integer
> Base Display
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 56
DATA TYPES - Examples
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 57
DATA TYPES - Real & Lreal
REAL and LREAL are so-called floating-point types. They are required to represent rational numbers.
32 bits of memory space is reserved for REAL and 64 bits for LREAL
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 58
DATA TYPES - String
A STRING type variable can contain any string of characters. The size entry in the declaration determines
how much memory space should be reserved for the variable. It refers to the number of characters in the
string and can be placed in parentheses or square brackets. If no size specification is given, the default size
of 80 characters will be used.
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 59
DATA TYPES - Time & Date
The Time type T# or TIME# is represented by an unsigned double integer (UDINT). It expresses a
duration in milliseconds, which approximately represents a maximum duration of 49 days.
The units of time authorized to represent the value are:
• days (D)
• hours (H)
• minutes (M) IEC Data type Description Examples
• seconds (S) TIME The duration of time after T#18d7h19m7s7ms
• milliseconds (MS) an event TIME#18h7s
DATE Calendar date D#1977-07-18
DATE#1977-07-18
TIME_OF_DAY Time of day TOD#18:07:19
TIME_OF_DAY#23:59:59.99
DATE_AND_TIME Date and time of day DT#1977-07-18-18:07:19.77
DATE_AND_TIME#1977-07-18-12:00:00
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 60
DATA TYPES - Array
What Is an Array?
It is a data item that contains a set of data of the same type, such as for example:
• a group of BOOL words,
• a group of UINT integer words,
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 61
Data Types - Structure
What is a Structure?
It is a data item containing a set of data of a different type, such as:
• a group of BOOL, WORD, UNINT, etc.
• a group of tables
• a group of REAL, DWORD, tables, etc.
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 62
Data Types - Constant
Notation: K Notation: H
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 63