122
Schutzvermerk nach DIN 34 beachten 16. März 2022 Seite 2 XSoft Agenda 5 6 7 8 9 10 1 2 3 4 Programming with Moeller XSoft IEC-Basics and basic logic circuits The elementary data types Derived Data Types Application structure and variable scope POU composition Standard libraries and their use Continuous Function Chart Management of global variables in XSoft Structured Text

Schutzvermerk nach DIN 34 beachten 19/07/15 Seite 1 XSoft

Embed Size (px)

Citation preview

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 2

XSoft

Agenda

5

6

7

8

9

10

1

2

3

4

Programming with Moeller XSoft

IEC-Basics and basic logic circuits

The elementary data types

Derived Data Types

Application structure and variable scope

POU composition

Standard libraries and their use

Continuous Function Chart

Management of global variables in XSoft

Structured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 3

XSoft

Agenda

15

16

17

18

19

20

11

12

13

14

Task management in the XSoft

Test and Commissioning

Address structure according to IEC 61131-3

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 4

XSoft

Programming with Moeller XSoft

Programming with Moeller XSoftProgramming with Moeller XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 5

XSoft

Develop efficiently with XSoft

Two parts:

• Programming according to the international standard IEC 61131-3

• Learning about the XSoft features

• Using the programming features and benefits for the hardware of the XSystem

Objective of the workshop

Programming with Moeller XSoftProgramming with Moeller XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 6

XSoft

Moeller Automation

Sys

tem

PS

40

XS

yste

m

MI4 MV4 XI/ON WINbloc

IEC61131-3

DFx/DVx MotionXI/OC

Scope of application

Programming with Moeller XSoftProgramming with Moeller XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 7

XSoft

XVision

XControlXMotion

XSoft

XSoft:

Programming with Moeller XSoftProgramming with Moeller XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 8

XSoft

Programming languages: IL, ST, LD, FBD, SFC

and CFC

Integrated fieldbusconfigurators für CAN, DP, XI/ON, XIO

Extensive libraries

Online functions (Online- change, Insertion of new variables, Tracing etc.)

Integrated visualization for XVision

XSoft: Summary

Programming with Moeller XSoftProgramming with Moeller XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 9

XSoft

IEC-Basics and basic logic circuits

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 10

XSoft

1. General information2. Equipment requirements and tests

3. Programming languages

4. User guidelines5. Messaging service specification6. (not used)

7. Fuzzy

IEC EN 61131 Overview

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 11

XSoft

IEC 61131-3

• How data is declared• the structure of an application• the syntax and the semantics of five different

programming languages

The international standard defines:

XSoft is an IEC 61131-3 programming system!

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 12

XSoft

• Supplier independent programming

• Reduction of software investment thanks to re-usable function blocks

• Reduced training effort

runready

not readyerror

change

power . 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 1 0. 1 1. 1 2. 1 3. 1 4. 1 5. 1 6. 1 7. 1 8. 1 9. 2 0. 2 1. 2 2. 2 3. 2 4. 2 5. 2 6. 2 7. 2 8. 2 9. 3 0. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

. 0

. 1

. 2

. 3

. 4

. 5

. 6

. 7

. 8

. 9

. 1 0

. 1 1

. 1 2

. 1 3

. 1 4

. 1 5

. 1 6

. 1 7

. 1 8

. 1 9

. 2 0

. 2 1

. 2 2

. 2 3

. 2 4

. 2 5

. 2 6

. 2 7

. 2 8

. 2 9

. 3 0

. 3 1

runready

not readyerror

change

processing unit

CPU 400

power

power supply 230 AC

POW-400

SUCOcontrol

PS 416

digital in 16x3ms

INP-400

.0

.1

.2

.3

.4

.5

.6

.7

.0

.1

.2

.3

.4

.5

.6

.7

digital in 16x3ms

INP-400

.0

.1

.2

.3

.4

.5

.6

.7

.0

.1

.2

.3

.4

.5

.6

.7

digital in 16x3ms

INP-400

.0

.1

.2

.3

.4

.5

.6

.7

.0

.1

.2

.3

.4

.5

.6

.7

digital in 16x3ms

INP-400

.0

.1

.2

.3

.4

.5

.6

.7

.0

.1

.2

.3

.4

.5

.6

.7

PS4-341-M M 1

Arguments for IEC systems

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 13

XSoft

Overview of the programming languages

Automation project

LD / FBDIL

ST

SFC

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 14

XSoft

Label

END: LD % IX0.0or

Motor1_ON

Comment

(* Feeder raw parts *)

Director

Symbolic

IL - the programming line structure in instruction list

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 15

XSoft

JMP JMPC JMPCNJump/Branch Operators

& &N AND ANDN OR ORN XOR XORNLogic Operators

ADD DIV MUL SUBArithmet. Operators

CAL CALC CALCN RET RETC RETCNCalls & Returns

EQ GE GT LE LT NEComparators

LD LDN ST STN S R Assignmentoperators

Operators

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 16

XSoft

Variable names must not contain national symbols (ä, ü, ö), blanks or hyphens !

Variable names must not begin with a number !

Variable names and file (program) namesMUST differ !

Keywords must not be used as variable names !

Sample: A variable named LT (e.g. for the function „lamp test“) will lead to an error messagebecause LT is the reserved keyword for a comparator ! (LT=Less Than)

Stör-M1:BOOL Stoer_M1:BOOL

1_Start:BOOL Start_1:BOOL

Pump:BOOL Pump1:BOOLPump.POE Pump.POE

LT:BOOL L_Test:BOOL

Hints for the use of identifiers

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 17

XSoft

Chose your variable name in a way that they are self-explanatory.Use a capital letter as the first letter and use small letter for the rest.

Separate variable names consisting of several word by underscores between the words and start each word with a capital letter.

When working with brackets please use indentions for each level.e.g. use one TAB for each new bracket level.

Always put jump labels in a separate line and highlight them by e.g.framing them with comments

All below mentioned hints serve the purpose of making your programs easy to readand give them a well-defined structure:

Hints for the creation of programs

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 18

XSoft

&

&

>=

>=

Result LD AND OR ( AND ( OR ) )ST Result

LD (

....................

LD

LD

AND

ST

LD

AND ( ( .......

......................

AND )

...........

1Value

Value2

Value3

Value4

Value5

1ValueValue2

Value3Value4

Value5

1Value

Value2X....

1ValueX1Value

X Value5X

Working with brackets

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 19

XSoft

Standard operators

Programming in LD (Ladder diagram)

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 20

XSoft

Storing within networks

Direct support via menu bar

Enable networks at

FB inputs

Specialities in the LD / FBD editors

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 21

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 22

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 23

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 24

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 25

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 26

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 27

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 28

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 29

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 30

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 31

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 32

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 33

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 34

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 35

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 36

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 37

XSoft

Information : Schedule for programming

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 38

XSoft

Exercise: IEC basics and basic circuits

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 39

XSoft

Exercise: IEC basics and basic circuits

IEC-Basics and basic logic circuitsIEC-Basics and basic logic circuits

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 40

XSoft

The elementary data types

• BOOL• BYTE, WORD, DWORD • SINT, INT, DINT• USINT, UINT, UDINT• REAL, LREAL • STRING• TIME, TOD, DATE, DT

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 41

XSoft

Data types - Interpretation of values

Elementary data types

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 42

XSoft

0100 00010100 0001

0100 0001 SINT0100 0001 SINT

41 Hex

Input 1 und 7 high

2 + 2 = 650 6

2 + 2 = 650 6

Now it‘sclear !

Now it‘sclear !

What doesit mean ?

What doesit mean ?

IEC Programming languagesWhy data types ?

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 43

XSoft

Bool Byte

Word DWord

REALANY_INT

ANY Bit

Maths Town

ADD DIV SUBMUL

ANYNUM Bit City

AND OR XOR

Type specific use

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 44

XSoft

Information: Elementary data types

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 45

XSoft

Information: Elementary data types

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 46

XSoft

Information: Elementary data types

The elementary data typesThe elementary data types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 47

XSoft

Derived Data Types

Derived Data Types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 48

XSoft

Value limitations Rotations : UINT(250..3500);

Enumerations tDialmode : (TONE, PULSE);

Arrays

Structures

values : ARRAY[1..10] OF INT;

Oven_data :STRUCT Temperature : REAL; Time : DT;END_STRUCT

IEC 61131-3 Derived data types

Derived Data Types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 49

XSoft

Data:Array[1..10] of INT;

123456789

10

Data[5]

... :Array[1..10,1..4,1..3] of INT;

1

3

1 2 3 4

2

2

3

1

456789

10

Data[5,4,2]

... :Array[1..10,1..4] of INT;

1

1 2 3 4

23456789

10

Data[7,4]

ARRAYs

Derived Data Types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 50

XSoft

1

2

3

4

Datenfelder – ARRAYs – vierdimensional ?!

Derived Data Types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 51

XSoft

Temperature :125 °C

Time : 2002-04-11-15:35:47

Heat_time : 7m

Alarm : 0

Oven1.TemperatureOven1.TimeOven1.Heat_timeOven1.Alarm

Oven_data :STRUCT

Temperature : UINT ;Time : DT ;Heat_time : TIME ;Alarm : BOOL ;

END_STRUCT ;

TYPE

END_TYPE

VAROven1 : Oven_data ;

END_VAR

Derived Data Types - Structures -

Derived Data Types

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 52

XSoft

Application structure and variable scope

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 53

XSoft

Project

Blocks Global Variables Data types

Declaration Code

Structure of an application software

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 54

XSoft

PROGRAM„PLC_PRG“

FU FU

FB

FU

FB

Functionblock

Functionax² + b = yResult in

Akku

Program

LDANDST

IN OUT

IN

PROGRAM

FU FU

FB

FU

FB

PROGRAM

FB

FU

FB

POU Types

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 55

XSoft

FU FU

FB

FU

FB

PROGRAMPROGRAM (e.g. in IL)

Action (CFC)

Action (ST)

Action (LD)

Action (CFC)

Actions

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 56

XSoft

LocalLocal

GlobalGlobal

TypeType

InputInput

OutputOutput

InOutInOut

ExternalExternal

Pump

Pump

Pump

Scope of variables (1)

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 57

XSoft

LocalLocal

GlobalGlobal

TypeType

InputInput

OutputOutput

InOutInOut

ExternalExternal

Global

Pump

External

Pump

Valid area

Scope of variables (2)

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 58

XSoft

LocalLocal

GlobalGlobal

TypeType

InputInput

OutputOutput

InOutInOut

ExternalExternal

Valid area

Input

Druck

Input

Druck

Output

Pump

InOut

Mit

Scope of variables (3)

Application structure and variable scope

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 59

XSoft

POU composition

POU composition

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 60

XSoft

Program Organiation Unit

Declarations Instructions

+VARInput1 AT %I0.0.0.0.0 : BOOL ;Output1 AT %Q0.0.0.0.0 : BOOL ;END_VAR

LD Input1ST Output1

Composition of a POU

POU composition

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 61

XSoft

Instanciation means:Assignment of a data set to afunction block or a variable

VARparts_counter : CTU;

END_VAR

CTU

Instructions

CTU

Instructions+

Parts_counter

Data

Parts_counter

Data

PLC‘s memory

Instanciation (1)

POU composition

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 62

XSoft

Multiple instanciation means:Assignment of several data sets to afunction block

VARraw_parts : CTU;finished_parts : CTU;waste : CTU;

END_VAR

CTU

Instructions

CTU

Instructions+

Data setraw_parts

Data setraw_parts

Xcontrol memory

Data setfinished_parts

Data setfinished_parts

Data setwaste

Data setwaste

Instanciation (2)

POU composition

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 63

XSoft

Call-up of function blocks

Time GeneratorSet

Period

Pulse OutputBOOL

BOOL

BOOL

PROTOTYPE

Instructions

CAL M_Tact (Set:=Start, Period:=20 )LD M_Tact.PulseOutputST Tact

CAL M_Tact (Set:=Start, Period:=20 )LD M_Tact.PulseOutputST Tact

LD StartST M_Tact.SetLD 20ST M_Tact.PeriodCAL M_TactLD M_Tact.PulseOutputST Tact

LD StartST M_Tact.SetLD 20ST M_Tact.PeriodCAL M_TactLD M_Tact.PulseOutputST Tact

PROGRAM Timertest

Declaration

VAR M_Tact : Timegenerator; Start AT%I0.0: BOOL; Tact AT%Q0.0: BOOL;END_VAR

VAR M_Tact : Timegenerator; Start AT%I0.0: BOOL; Tact AT%Q0.0: BOOL;END_VAR

1. VariantIEC compliant

2. VariantIEC compliant

3. Variant(XSoft;next version ofIEC 61131-3)

CAL M_Tact (Set:=Start, Period:=20, PulseOutput=>Tact

)

CAL M_Tact (Set:=Start, Period:=20, PulseOutput=>Tact

)

POU composition

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 64

XSoft

Standard libraries and their use

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 65

XSoft

Power

machine

x

o

stationnumber

alarm

IEC61131-3

Standard libraries

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 66

XSoft

Additional libraries

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 67

XSoft

Exercise: Delayed activation

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 68

XSoft

Solution: Delayed activation

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 69

XSoft

: Toiletten-Licht-Lüfter-SteuerungExercise: Toilet control

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 70

XSoft

Solution: Toilet control

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 71

XSoft

Exercise: Toilet control; extension

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 72

XSoft

Solution: Toilet control; extension

Standard libraries and their use

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 73

XSoft

Continuous Function Chart

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 74

XSoft

Continuous Function Chart (CFC)

• Graphical Programming language• Not within the scope of the standard IEC 61131-3• useful “enhancement” of FBD• Of all the programming languages best suitable for the

programming of complex expressions with feedback loops (therefore widely spread in the process industry)

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 75

XSoft

InputOutput

Block

Jump

Label

Return

Comment

NegateSet/Reset

Enable

Create Macro

In-PinOut-Pin

Operators

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 76

XSoft

Execution rules

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 77

XSoft

Macros

Create macro

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 78

XSoft

Exercise: Function block blinker

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 79

XSoft

Solution: Function block blinker

Continuous Function Chart

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 80

XSoft

Management of global variables in XSoft

Management of global variables in XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 81

XSoft

Generelly accessible variables(Global variables)

Global Variables I

Management of global variables in XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 82

XSoft

Eintrag über die Eingabehilfeder automatischen Deklaration

Auswahl der gewünschtenglobalen Variablenliste

Global Variables II

Management of global variables in XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 83

XSoft

Structured Text

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 84

XSoft

Structured Text

• Textual language• High level language• similar to PASCAL or C• not so well known in the PLC/automation world• of all languages best suitable for programming loops and

branches/decisions

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 85

XSoft

Analog Operators

IL,FBD,LD ST• ADD +• SUB -• MUL *• DIV /

Working with ANY_NUM, TIME

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 86

XSoft

Comparison Operators

IL,FBD,LD ST• EQ =• NE <>• GE >=• GT >• LE <=• LT <

Working with ANY data type

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 87

XSoft

Hierarchy of the operators

IL

LD I1AND I2OR (I3AND I4

)ST result

ST

result:= I1 AND I2 OR I3 AND I4;

result:= (I1 AND I2) OR (I3 AND I4);result:= (I1 AND I2) OR (I3 AND I4);

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 88

XSoft

Branching I

LD variableGT 100JMPC greaterLD variableEQ 100JMPC equalLD aADD 1ST aJMP END

greater:LD aSUB 1ST aJMP END

equal:LD aST result

END:

IL

IF variable > 100 THENa:=a-1;

ELSIF variable = 100 THENresult:=a;

ELSEa:=a+1;

END_IF;

ST

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 89

XSoft

Branching IILD variableEQ 1JMPC case_1LD variableEQ 2OR (variableEQ 3

)OR (variableEQ 4

)JMPC case_2LD aADD 1ST aJMP END

case_1:LD aADD 1ST aJMP END

case_2:..

IL

CASE variable OF1:

a:=a+1;2,3,4:

a:=a+2;5..100:

a:=a+3;ELSE

a:=0;END_CASE;

ST

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 90

XSoft

Loops I

FOR variable := 1 TO 10 DO STEP 1array_a[variable]:=100;array_b[variable]:=50;array_c[variable]:=3;

END_FOR;

FOR

VARarray_a:ARRAY[1..10] OF INT;array_b:ARRAY[1..10] OF UINT;array_c:ARRAY[1..10] OF USINT;

END_VAR

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 91

XSoft

WHILE a <= 100 DOa:=a*2;b:=b+1;c:=c+5;

END_WHILE;

WHILEDO

REPEATa:=a+1;b:=b*2;

UNTIL a=100 OR b=50END_REPEAT;

REPEATUNTIL

The cycle time trap

Loops II

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 92

XSoft

Exercise: Cycle Counter with level check

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 93

XSoft

Solution: Cycle Counter with level check

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 94

XSoft

Exercise: Extension of cycle counter

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 95

XSoft

Solution: Extension of cycle counter

Structured TextStructured Text

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 96

XSoft

Task management in the XSoft

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 97

XSoft

Task Definition

Task120ms

Prg1 Prg2 Prg3

Task2event

Prg4 Prg5

In XSoft there exist two kinds of tasks „Periodic“ and„Event triggered“.

For the execution the following rules are valid:. The task, for which the condition is fulfilled, will be

executed, i.e. if the time period has elapsed or on the rising edge of the associated global triggering event.

· If several task have valid conditions at the same momentthe task with the highest priority will be executed first.

· If several tasks have valid conditions and the samepriority the task with the longest waiting time will be executed.

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 98

XSoft

Task Definition Xsoft

Task Interval

Executionpriority

Event triggeredtask with globaltrigger variable

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 99

XSoft

Project

Task 1

Task 2

Task 9

.

.

.

Program 1

Program 2

Program 3

Program N

Definition of hierarchies

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 100

XSoft

Cyclic

Event triggered e.g. by global variable S1= 1

TaskAProg1H1:=NOT H1

TaskAProg1H1:=NOT H1

TaskAProg1H1:=NOT H1

H1:=1 H1:=0 H1:=1

1s 1s 1s

TaskAProg1H1:=NOT H1

TaskAProg1H1:=NOT H1

TaskAProg1H1:=NOT H1

H1:=1 H1:=0 H1:=1

S1=1 S1=1 S1=1

Task Interval:

Definitions:

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 101

XSoft

Task A Prio 5

Task B Prio4

Task A Prio 5

High priority tasks interrupt low priority tasks!

Priorities of 0-31 are allowed !

Definition of Priority

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 102

XSoft

TaskAProg1H1:=NOT H1

TaskAProg1H1:=NOT H1

TaskAProg1H1:=NOT H1

H1:=1 H1:=0 H1:=1

1s 1s 1sTask Interval:

TaskBProg2

Cycle time error(Watchdog)

If any one task can NOT complete the execution of its assigned programs within the defined interval, the PLC will go into HALT (watchdog) !

Definition of priorities

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 103

XSoft

Prog_L

Prog_H

Program execution timet

0 TProgLTProgH

(Task interval H)

TIH

(Task intervall L)TIL

Prog_L 1. Break

Prog_H TIRH

Prio

0

1

Task_L:

Task_H:

Prog_L 2. Prog_L 3. 4.Break

Prog_H

Break

Prog_H

New Start

1.

Prog_H

TprogL*

Definition: Task Timing

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 104

XSoft

(Task interval L)TIL

Break

Prog_H TIRH

Task_LL:

Task_L:

Break

Prog_H

Break

Prog_H

Prog_L 1. Prog_L 2. Prog_L 3. 4.

Prog_L 1. Prog_L 2. Prog_L 3.

TProgL*

Prog_LProg_H

Program execution timet

0 TProgLTProgH

Prio

01

Prog_LL2

TILR

Prog_LL

4

Break etc.

And what about 3 Tasks?

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 105

XSoft

Exercise: Task configuration

Task management in the XSoftTask management in the XSoft

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 106

XSoft

Test and Commissioning

Test and Commissioning

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 107

XSoft

Watch- and recipe manager

F2

Test and Commissioning

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 108

XSoft

Breakpoint and single step

Breakpoint

Test and Commissioning

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 109

XSoft

Sampling Trace

Test and Commissioning

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 110

XSoft

Exercise

Test and Commissioning

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 111

XSoft

Exercise

Test and Commissioning

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 112

XSoft

Address structure according to IEC 61131-3

Address structure according to IEC 61131-3Address structure according to IEC 61131-3

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 113

XSoft

Structure of an address

• Percent character ‘%’

• Area prefix

– I Input

– Q Output

– M Marker

• Size

– X Single Bit

– None Single Bit

– B Byte (8 Bits)

– W Word (16 Bits)

– D Double word (32 Bits)

• Samples– %IW214– %QX1.1– %MD48

Manufacturer specific; not defined in the standard !Manufacturer specific; not defined in the standard !

Address structure according to IEC 61131-3Address structure according to IEC 61131-3

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 114

XSoft

Erzeugen einer Symboldatei

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 115

XSoft

Variablen in eine globale Variablenliste eintragen!

Schritt1: Projekt erstellen und speichern

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 116

XSoft

Schritt 2: Übersetzen

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 117

XSoft

Simulation abschalten

Simulation

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 118

XSoft

Schritt 3: Symboldateierzeugen anklicken

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 119

XSoft

Schritt 5: Symbolfile konfigurieren

Wegklicken!

Symbolfile konfigurieren

Anklicken!

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 120

XSoft

Schritt 6: Auswahl der Variablen

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 121

XSoft

Schritt 7: Auswahl zu Symbolliste hinzufügen

Anklicken!

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 122

XSoft

Schritt 8: Fenster mit OK verlassen und übersetzen

Bestätigen!

Erzeugen einer Symboldatei

Sch

utz

verm

erk

na

ch D

IN 3

4 b

eac

hte

n

19. April 2023 Seite 123

XSoft

Schritt 9: Übersetzen

Erzeugen einer Symboldatei