Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
273 views

Module 1 - T04 Basic Programming ESME - HVAC - v3.1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
273 views

Module 1 - T04 Basic Programming ESME - HVAC - v3.1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

EcoStruxure™ Machine Expert HVAC Training Portfolio

Module 1 – T04 Programming with ESME HVAC & M172P

Machine Solutions Training Center

Confidential Property of Schneider Electric


Module 1 – T04 1 CONFIGURATION Perspective: Deep-dive

Programming with ESME HVAC 2 PROGRAMMING Perspective: Deep-dive


& M172P
3 PROGRAM: Step by Step

4 DEBUGGING TOOLS

5 LIBRARIES

6 DATA TYPES

Confidential Property of Schneider Electric | Page 2


CONFIGURATION Perspective
Deep-dive

> Modbus objects (EEPROM Parameters, Status Variables, Enumerations, BIOS Parameters)
> Variable Categories in ESME HVAC
> Physical I/O Mapping
> BIOS Parameters
> Menus

Confidential Property of Schneider Electric | Page 3


CONFIGURATION Persp. - Modbus objects
Modbus Objects
Connected Everywhere

EcoStruxure

Ethernet (Modbus TCP, BACnet/IP, HTML5)


BACnet MS/TP, Modbus SL
LonWorks
Magelis HMI

M172P M172P Expansion Modules


(up to 12) LCD Display

Communication
Module

CAN (Binding) Expansion Bus (CAN)

Modbus Master I/Os

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

Default, Min and Unit and Format are used in Display


Max Value and Commissioning

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)

Unit and Format are used in Display


Default, Min and and Commissioning
Max Value (available
only if R/W )

Read only or R/W on


Param. Name Modbus side (external)

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

> Used to display variable values on the WebServer

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

Local Var. NO YES NO Variables required to be available only in a specific program

BIOS Param. YES NO YES System parameters

Retain Var. NO NO YES 1 DWORD on M172P. 100 DWORDs on M171P.

> 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

Ethernet (Modbus TCP, BACnet/IP, HTML5)


BACnet MS/TP, Modbus SL
LonWorks
Magelis HMI

M172P M172P Expansion Modules


(up to 12) LCD Display

Communication
Module

CAN (Binding) Expansion Bus (CAN)

Modbus Master I/Os

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

> While assigning a name to I/O point, a new Global Variable is


generated and linked to that specific I/O

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 12
CONFIGURATION Perspective
Physical I/O Configuration: BIOS Parameters

• BIOS parameters define the default configuration of analog I/O

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:

> NTC103AT to I/Net NTC 10k Type2

> NTC103AT to Continuum NTC 10k Type3

> Link: https://schneider-electric.box.com/s/ojy1lhqfch6y3wwqfnenksu8bl9x32h3

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 15
PROGRAMMING Perspective
Deep-dive

> Project Resources


> Programming Languages
> Tasks Management, Execution Time, Program Assignment
> Object Import

Confidential Property of Schneider Electric | Page 16


PROGRAMMING Persp. - Project Resources
> After saving the project, all the
resources defined in Configuration
will be available under the “Global
shared” folder in “Aux Variables”

> Drag-and-drop is possible for using


the resources

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.

Actual execution time, background task Start New Background Exe

Exe

Background

Background
Background

Background
Exe Exe Exe Other Exe Exe
Timed Boot Init Timed System Timed Timed
Tasks

Timed Period

Timed Period Timed Period Timed Period


Exe Background
Read Read Read Other System Tasks:
Read
Serial Connection, HMI
Input Input Update Input Update Input Update Update and others
Timed Period Output Output Output

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

Confidential Property of Schneider Electric | Page 23


PROGRAMMING Persp. – EEPROM Access
EEPROM Target Block

• EEPROM variables cannot be written from PLC code directly

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 30
PROGRAMMING Perspective - Shortcuts
Find in Editor CTRL F

Find in Project CTRL SHIFT F

Auto Complete CTRL SPACE

Zoom CTRL Mouse Wheel

Move/Insert <-> Connect SPACE

Multi Select SHIFT Left Mouse

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

Encryption is not only for POUs but we


can also encrypt the entire program.

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

Status PLC Init Boot


Variables Variables Task Task
x x x
x x x

x x x x

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 36
Debugging Tools
Deep-dive

> First Steps in Simulation


> System Variables
> Oscilloscope Description
> Trigger
> Using Breakpoints

Confidential Property of Schneider Electric | Page 37


Debugging Tools – First Steps
How To use:
▪ Simulation
▪ Live Debug Mode
▪ Watch
▪ Oscilloscope

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 38
Debugging Tools – System Variables
Operators and Blocks

• Hold system information, e.g. local IO status

• Can be grouped in folders for better overview

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

Define Trace Period

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

> Add Libraries


> Library Properties

Confidential Property of Schneider Electric | Page 44


Add Libraries
View Library Tree,
select Library
Manager, Add
2
Library

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

> Link: https://schneider-electric.app.box.com/s/nrofepuzc6gtzh9v5spgyhta7nl8ib8d

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 47
Command Line Compilation
PROGRAMMING compilation can be called from Command Line

Confidential Property of Schneider Electric | Page 48


Command Line Compilation of PROGRAMMING
> The Compilation can be run from Command Line, with the following options.
This compiles the PROGRAMMING part only, therefore do not use it if you have an HMI.

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 49
Appendix
Data Types

Confidential Property of Schneider Electric | Page 50


DATA TYPES - Integers
BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, and UDINT are all integer data types.
Each of the different number types covers a different range of values. The following range limitations apply to
the integer data types:
IEC Data type Description Range Memory Space
SINT Short integer -128 … +127 8 Bit
INT Integer -32768 … +32767 16 Bit
DINT Double integer -231 … +231 -1 32 Bit
LINT Long integer -263 … +263 -1 64 Bit
USINT Unsigned short integer 0 … +255 8 Bit
UINT Unsigned integer 0 … +65535 16 Bit
UDINT Unsigned double integer 0 … +232 -1 32 Bit
ULINT Unsigned long integer 0 … +264 -1 64 Bit
BYTE Byte 0 … +255 8 Bit
WORD Word 0 … +65535 16 Bit
DWORD Double word 0 … +232 -1 32 Bit
LWORD Long word 0 … +264 -1 64 Bit
Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 51
DATA TYPES - Boolean
BOOL type variables give the value TRUE or FALSE.
8 bits of memory space will be reserved

IEC Data type Description Range Memory Space


BOOL Boolean 0 or 1 8 Bit (1 Byte)

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 52
DATA TYPES - Integer
> Base Display & Register

Base Range Memory Space


Decimal -32768 … 32767 16 Bit
Binary 2#1000000000000000 … 2#0111111111111111 16 Bit
Octal 8#100000 … 8#077777 16 Bit
Hexadecimal 16#8000 … 16#7FFF 16 Bit

16 bit data 0: positive number


1: negative number

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 53
DATA TYPES - Double Integer
> Base Display & Register

Base Range Memory Space


Decimal -2147483648 … 2147483647 32 Bit
Binary 2#10000000000000000000000000000000 … 32 Bit
2#01111111111111111111111111111111
Octal 8#20000000000 … 8#17777777777 32 Bit
Hexadecimal 16#80000000 … 16#7FFFFFFF 32 Bit

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

Base Range Memory Space


Decimal 0 … 65535 16 Bit
Binary 2#0 … 2#1111111111111111 16 Bit
Octal 8#100000 … 8#177777 16 Bit
Hexadecimal 16#0 … 16#FFFF 16 Bit

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 55
DATA TYPES - Unsigned Double Integer
> Base Display

Base Range Memory Space


Decimal 0 … 4294967295 32 Bit
Binary 2#0 … 2#11111111111111111111111111111111 32 Bit
Octal 8#0 … 8#37777777777 32 Bit
Hexadecimal 16#0 … 16#FFFFFFFF 32 Bit

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

IEC Data type Description Range Memory Space

REAL Real ± 10±38 32 Bit

LREAL Long real ± 10±308 64 Bit

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.

IEC Data type Description Examples Memory Space

STRING Character strings ‘Hello word’ 255 Characters X 8 Bit

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,

An array is characterized by two parameters:


• a parameter which defines its organization (array dimension(s)),
• a parameter that defines the type of data it contains.
Entry Comments

Tab_1: ARRAY[1..2] OF BOOL 1 dimensional array with 2 Boolean words

Tab_2: ARRAY[-10..20] OF WORD 1 dimensional array with 31 WORD type


structures (structure defined by the user)

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.

A structure is composed of data which are each characterized by:


• a type
• a name, which enables it to be identified
• a comment (optional) describing its role

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 62
Data Types - Constant

Notation: K Notation: H

Role: decimal constant values Role: Hexadecimal constant values

Types: 16 (-32768 - +32767) and Types: 16 (0 - FFFF) and


32 (-2147483648 - +2147483647) bit 32 (0 – FFFF FFFF) bit

Usage: in counters, timers, instruction Usage: in counters, timers,


parameters instruction parameters

Machine Solutions Training Center | EcoStruxureTM Machine Expert HVAC Software Training | Page 63

You might also like