• No results found

TC3_E_04

N/A
N/A
Protected

Academic year: 2021

Share "TC3_E_04"

Copied!
559
0
0

Loading.... (view fulltext now)

Full text

(1)

Training für Umsteiger

(2)

Training für Umsteiger

(3)

Overview of contents

ƒ Object orientation with

IEC 61131-3 3

rd

edition

ƒ Extension Details

ƒ Example applications for

OOP

03.05.2012 TwinCAT 3 | Training | Object-orientated

(4)

Requirements of the OO in automation technology

ƒ Integration into one PLC development environment (with online functions, online change etc.)

ƒ Mixing of procedural and object-orientated code (existing projects must be capable of being integrated simply and without expenditure)

ƒ Extension of the familiar IEC languages instead of an extra language for OOP ƒ OOP universal in all IEC languages (not only ST)

ƒ Standardisation of the language by the IEC ¾ New third edition of the IEC61131-3

(5)

Advanced IEC features | Keywords

Six new keywords:

ƒMETHOD : action on FB with own variables ƒPROPERTY: POE pair for Set/Get of attribute

ƒTHIS : in Methode/Property for the current FB instance ƒSUPER : in Method for access to the basic class instance ƒEXTENDS : inheritance between FBs

ƒINTERFACE : defines abstract object type (FB without implementation) ƒIMPLEMENTS in the FB: instances can be called via the named interface

Call syntax for methods:

ƒObjekt.Methodname(…)

Special methods:

ƒFB_Init, FB_Exit, FB_Reinit

03.05.2012 TwinCAT 3 | Training | Object-orientated

(6)

Advanced IEC features | Application

Object-orientated extensions of IEC 61131-3, 3

rd

edition:

ƒ the concept of the functional blocks has been extended by ¾ Classes

¾ Interfaces ¾ Methods ¾ Inheritance ¾ Attributes

¾ Keywords such as THIS, SUPER

ƒ Use of the extensions

¾ Possible in all IEC languages

(7)

Advanced IEC Features | SUPER and THIS

03.05.2012 TwinCAT 3 | Training | Object-orientated

(8)

Overview of the language properties

Language properties 2nd Edition

IEC 61131-3 3rd Edition IEC 61131-3 C++ Java C# Multilingual capability + + - - -OOP/procedural mixed - + + - -Classes ~ (FB) + + + + Methods ~ (Actions) + + + + Interfaces - + - + +

Partially abstract classes - - + + +

Polymorphism - + +/- + +

Reference semantics - + (Interfaces) - + +

Constructor/Destructor - + + + +

Properties - + - - +

(9)

Overview of contents

ƒ Object orientation with

IEC 61131-3 3

rd

edition

ƒ Extension Details

ƒ Example applications for

OOP

03.05.2012 TwinCAT 3 | Training | Object-orientated

(10)

History

ƒ 1st edition 1993

ƒ 2nd edition 2003: bugfixes and small extensions ƒ 3rd edition 2011

ƒ working at 3rd starts 2008 ƒ 1st draft in july 2009

(11)

Typography

ƒ 3rd edition = 2nd edition + extensions ƒ single line comment

ƒ nanoseconds

ƒ enum type with named values ƒ pointers allowed

ƒ references

ƒ object oriented extension ƒ namespaces

ƒ call a program from other programs

ƒ mixed data types in expressions and implicit conversions. ƒ …

(12)

New datatypes

ƒ LINT, ULINT, LWORD ƒ 64 bit length.

ƒ LTIME, LDATE, LDATE_AND_TIME, LTIME_OF_DAY ƒ tTime:= LTIME#12s34ms2us44ns

ƒ DT:= CONCAT_DATE_TOD(DATE, TOD);

ƒ DATE:= CONCAT_DATE(YEAR, MONTH, DAY); ƒ UNION

ƒ several datatypes in a single memory space ƒ WSTRING

(13)

Enum Type

IEC61131-3 3rd Edition

ƒ Explixitly specify the datatype of an enumeration. ƒ Default type is INT.

(14)

UNION

ƒ All variables have the same memory offset.

ƒ All variables occupy the same memory location.

(15)

VAR_TEMP - Temporary Variables

IEC61131-3 3rd Edition

ƒ Temporary variables get initialized each call of the POU. ƒ Usable in programs and function blocks.

ƒ In methods and functions every declared variable is temporary!

(16)

VAR_STAT - Static Variables

ƒ Static variables get initialized only at the first call of the POU. ƒ Static variables get stored and don‘t lose their value.

ƒ Usable in methods and functions.

(17)

Expression for variable initialization

ƒ initialize variables with ST expressions

(18)

Pragma Instructions

ƒ {defined identifier} ƒ {undefined identifier} ƒ {IF expr} ƒ {ELSIF expr} ƒ {ELSE} ƒ {END_IF} ƒ {IF defined(variable:iInput)} ƒ {IF defined(pou:CheckBounds)} ƒ {IF defined(type:ST_DataType)}

ƒ {IF hasattribute(variable:iInput, ‚DoSomething‘)} ƒ {IF hastype(variable:iInput, UINT)}

(19)

Pragma Instructions

ƒ Messages

ƒ {text 'Hello World!'} ƒ {info 'Information!'} ƒ {warning 'Warning!'} ƒ {error 'Error!'}

(20)
(21)

References

ƒ A reference is an alias for an object. ƒ Instead of pointers.

ƒ Typesafe.

ƒ No dereferencing.

(22)

Object Oriented Extensions

ƒ METHOD ƒ PROPERTY

ƒ FB_Init, FB_Exit, FB_Reinit

ƒ EXTENDS ƒ INTERFACE ƒ IMPLEMENTS

ƒ THIS ƒ SUPER

(23)

METHOD

ƒ Methods are describing a sequence of instructions. ƒ Like a function that depends to a function block. ƒ Extends the existing ACTION functionality.

ƒ VAR_INPUT, VAR_IN_OUT and VAR_OUTPUT ƒ Access to variables of the belonging function block.

(24)

PROPERTY

ƒ Gives access to internal states or values.

(25)

FB_init, FB_reinit, FB_exit

ƒ FB_init

ƒ Contains explicit initialization code for the function block. ƒ Gets called before starting the PLC. (SAFEOP => OP) ƒ Implicit initializations have already been done.

ƒ User defined inputs: fbVal: FB_Val(iVal:= 3); ƒ FB_reinit

ƒ Contains explicit reintinialization code for the function block. ƒ Gets called when the instance gets copied. (online change) ƒ FB_exit

ƒ Contains explicit deinitialization of ressources.

ƒ Gets called before a download, a reset or online change.

(26)
(27)

Execution order while online change.

IEC61131-3 3rd Edition ƒ Exit old instance.

ƒ old_inst.fb_exit(bInCopyCode := TRUE); ƒ Initialize new instance.

ƒ new_inst.fb_init(bInitRetains := FALSE, bInCopyCode := TRUE); ƒ Copy instance.

ƒ copy_fub(&old_inst, &new_inst);

(28)

THIS

ƒ Every function block provides the pointer THIS. ƒ THIS points to the current function block.

(29)

EXTENDS

ƒ Structure includes all variables from the extended base.

(30)

EXTENDS

(31)

EXTENDS

ƒ function block includes all methods from the extended base.

(32)

SUPER

ƒ Every function block provides the pointer SUPER. ƒ SUPER points to the basic function block.

ƒ Usable for overwriting existing methods from the base. ƒ Change the behaviour of a existing function block.

(33)

INTERFACE

IEC61131-3 3rd Edition

ƒ POU which defines/describes. ƒ methods and properties.

ƒ Just declaration, no implementation. ƒ Only input, output and inout variables.

ƒ No body (implementation).

ƒ No declaration of internal variables.

(34)

IMPLEMENTS

ƒ A function block implements the interface.

ƒ Provides the implementation of the declaration.

(35)

Interface Usage

ƒ Declare an instance of the function block, implementing the interface.

ƒ Declare an variable of the interface.

ƒ Store a reference to the function block in the interface.

(36)

Interface Benefits

ƒ Use different implementations depending on the situation.

ƒ If use mem instance is active, FB_MathMem would be used. ƒ Otherwise the FB_MathErase would be used.

(37)

Attention while using interfaces!

ƒ Function blocks are „value types“. Copied by value/memory. ƒ Interfaces are „reference types“. Copdied by reference/address.

Î Interfaces are pointers!

(38)

Extended Structured Text - ExST

ƒ TwinCAT 3 specific extensions.

ƒ Dynamic Memory ƒ __NEW

ƒ __DELETE

ƒ Adressing, Pointers and References ƒ __ISVALIDREF

ƒ __QUERYPOINTER ƒ __QUERYINTERFACE

(39)

Not yet implemented

ƒ Extensible Function – PARAMS

ƒ ANDN, ORN, XORN

ƒ ANY_TYPE

ƒ ANY_NUM_TO_<NUMERIC> ƒ ANY_TO_<TYPE>

(40)

Overview of contents

ƒ Object orientation with

IEC 61131-3 3

rd

edition

ƒ Extension Details

ƒ Example applications for

OOP

(41)

Example applications for OOP

ƒ Sample01: Classic inheritance

ƒ EXTENDS : Inheritance between FBs

ƒ METHOD : Action on FB with own variables

ƒ Sample02: Inheritance with abstract upper class (late Binding) ƒ EXTENDS : Inheritance between FBs

ƒ METHOD : Action on FB with own variables

ƒ INTERFACE : defines abstract object type (FB without implementation) ƒ IMPLEMENTS in the FB: Instances can be called via the named interface ƒ SUPER : in Method for access to the basic class instance

ƒ Sample03: Access via Property by means of Get/Set ƒ PROPERTY: POE pair for Set/Get of attribute ƒ Sample04: Cylinder

ƒ EXTENDS, METHOD, INTERFACE , SUPER ƒ Sample05: Crossroads

ƒ Sample06: Overshadowing with THIS and SUPER

03.05.2012 TwinCAT 3 | Training | Object-orientated

(42)

Sample01: Classic inheritance

¾ EXTENDS : Inheritance between FBs

ƒ By setting the keyword EXTENDS, the respective function block gets all the properties (variables, actions, methods, etc.) of the basic function block as an extension to its own!

(43)

Sample01: Classic inheritance

¾ METHOD : Action on FB with own variables

ƒ Methods strongly resemble the familiar functions (FUN), i.e. all data are only present temporarily!

ƒ Permitted variable classes: VAR, VAR_INPUT, VAR_OUTPUT ƒ Not permitted: VAR_IN_OUT, VAR_TEMP

03.05.2012 TwinCAT 3 | Training | Object-orientated

(44)

Sample02: Inheritance with abstract upper class

¾ INTERFACE : defines abstract object type (FB without implementation) ƒ Used on function blocks for the management/organisation of methods

ƒ An INTERFACE describes a collection of method prototypes, i.e. methods that are only declared but not implemented. All methods of the interface are implemented by the FB (IMPLEMENTS).

ƒ The instance of an INTERFACE is filled in with code by assigning the FB that implements this INTERFACE at runtime (dynamically)

(45)

Sample02: Inheritance with abstract upper class

ƒ Characterisation of the interface with the respective FB instance that implements this interface.

03.05.2012 TwinCAT 3 | Training | Object-orientated

(46)

Sample03: Access via Property by means of Get/Set

¾ A PROPERTY can use the private variables of the block module in a program block (PRG) or function block (FB) by means of SET and GET

ƒ The SET and GET methods are added automatically by appending a PROPERTY. A

(47)

Sample04: Cylinder

03.05.2012 TwinCAT 3 | Training | Object-orientated

programming in IEC 46

Example: Cylinder

Task:

• Cylinders should all look the same

• Identical behaviour

(48)

Sample04 : PLC | OOA cylinder

+M_StateMachine() : bool ICylinder +M_StateMachine() : bool +bAtLeftPos : bool +bAtRightPos : bool ‐TimerReach ‐TimerStart ‐iState : int FB_Cylinder +M_StateMachine() : bool +M_Diag() : bool +tTimeOut ‐WatchDogTimer FB_CylinderDiag

(49)

Sample04 : PLC | Cylinder | Interface

ƒ Definition of an abstract upper class (INTERFACE): ICylinder

ƒ Associated METHOD is only created, associated data are only defined on implementation!

03.05.2012 TwinCAT 3 | Training | Object-orientated

(50)

Sample04 : PLC | Cylinder | Function block

ƒ Definition of a (basic) function block that implements the interface ICylinder. ƒ All functions required for a (basic) cylinder are defined here.

(51)

Sample04 : PLC | Cylinder | Method

ƒ METHOD for controlling all cylinders:

03.05.2012 TwinCAT 3 | Training | Object-orientated

programming in IEC 50

Implementation of the interface

(52)

Sample04 : PLC | Cylinder | Inheritance

ƒ Creation of a further FB, which extends the basic type (EXTENDS):

(53)

Sample04 : PLC | Cylinder | Further methods

ƒ Extension of the inherited METHOD by special types for diagnosis:

03.05.2012 TwinCAT 3 | Training | Object-orientated

programming in IEC 52

Overwriting the interface

(54)

Sample04 : PLC | Cylinder | Call via interface

(55)

Training für Umsteiger

Object-orientated programming in IEC

Thank you very much

for your attention!

(56)

Training für Umsteiger

(57)

ƒ eXtended Automation

(XA) overview

ƒ Architecture (XAA)

ƒ Engineering (XAE)

ƒ Runtime (XAR)

ƒ Connectivity

ƒ TwinCAT 2 Migration

ƒ Functions

23.05.2012 TwinCAT 3 | Overview 3

(58)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ

Runtime (XAR)

(59)

Architecture (XAA)

23.05.2012 TwinCAT 3 | Overview 5 TwinCAT 3 eXtended Automation (XA) eXtended Automation Runtime (XAR) eXtended Automation Engineering (XAE)

Modular runtime system

TcCOM PLC Safety TcCOM NC TcCOM C++ Module TcCOM … TcCOM

TwinCAT 3 development environment based on Visual Studio® 2010

TwinCAT 3 Standard Visual Studio® 2010 Shell TwinCAT 3 Integrated Visual Studio® 2010 eXtended Architecture (XAA)

(60)

Architecture (XAA): subdivision into

engineering/runtime

eXtended Automation

Engineering (XAE)

ƒ Visual Studio

®

2010 for

real-time programming in

IEC 61131-3 and C/C++

ƒ Visual Studio

®

2010 for

the configuration of the

complete system

eXtended Automation

Runtime (XAR)

ƒ Execution of the created

modules in real-time

ƒ Support for multi-core

CPUs

(61)

23.05.2012

TwinCAT 3 | Overview 7

eXtended

Automation Engineering (XAE)

TwinCAT 3 Engineering Environment based on Visual Studio®

TwinCAT Transport Layer - ADS

TwinCAT 3 Runtime Real-time Kernel TcCOM PLC PLC SafetyPLC TcCOM PLC NC TcCOM PLC C Module TcCOM PLC CNC TcCOM PLC C++ Module TcCOM TcCOM PLC PLC

TwinCAT Automation Device Driver - ADD

PC System Fieldbus System Manager - Configuration Programming -IEC 61131-3 -objectoriented extensions - C/C++ PLC TcCOM Simulink® Module Windows 32/64 bit eXtended

(62)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

(63)

Engineering (XAE)

23.05.2012

(64)

Engineering (XAE)

eXtended Automation Engineering (XAE)

ƒTwinCAT 3

¾ One programming environment ¾ One project folder

¾ One debugging environment for IEC and C/C++ - code ƒ Integration of the familiar TwinCAT System Manager

ƒ Programming in IEC 61131-3 3rd Edition (NEU: object-orientated extension)NEU

ƒReal-time programming in C/C++

¾ Integration and sequence of the C/C++ - program in the IEC environment or ¾ execution as independent real-time code

ƒ Link to Matlab®/Simulink®

ƒ TwinCAT 2 PLC projects can be converted into a TwinCAT 3 PLC project ƒ The ‘old’ TwinCAT System Manager file (*.tsm file) can be converted

(65)

Engineering (XAE) - variants

TwinCAT 3 Standard

ƒ Based on the Microsoft

Visual Studio

®

Shell

ƒ Integrated System

Manager

ƒ Integrated IEC-61131-3

3

rd

edition programming

(OOP)

ƒ Integrated Safety PLC

TwinCAT 3 Integrated

ƒ Integration in an existing

Microsoft Visual Studio® 2010 ƒ Integrated System Manager ƒ Integrated IEC-61131-3 3rd

edition programming (OOP) ƒ Integrated Safety PLC

ƒ C/C++ programming ƒ Matlab®/Simulink®

ƒ C# and .NET programming for non-real-time applications

ƒ Optional: implementation of third-party software tools

23.05.2012

(66)

TwinCAT 3 Standard

ƒ For (standard) PLC

programmers and users

of existing, compiled

modules (e.g. C/C++,

Matlab

®

/Simulink

®

)

ƒ Configuration,

parameterisation and

diagnosis

ƒ Debugging of the PLC

code

TwinCAT 3 Engineering Environment

System Manager Configuration – I/O – PLC – MC – NC – CNC – Safety – others Programming IEC 61131 Object-oriented extensions IEC Compiler TwinCAT 3 Runtime

(67)

TwinCAT 3 Integrated

ƒ For PLC and C/C++

programmer

ƒ Configuration,

parameterisation

and diagnosis

ƒ Module development

(C/C++ or

Matlab

®

/Simulink

®

)

ƒ Debugging (PLC,

C/C++,

Matlab

®

/Simulink

®

)

23.05.2012 TwinCAT 3 | Overview 13

TwinCAT 3 Engineering Environment based on Visual Studio®

System Manager Configuration – I/O – PLC – C/C++ – MC – NC – CNC – Safety – others Programming IEC 61131 Object-oriented extensions IEC Compiler TwinCAT 3 Runtime

TwinCAT Transport Layer – ADS Non real-time C#.NET Real-time C/C++ Matlab®/ Simulink Real-time Workshop Microsoft C Compiler Third-party programming tool C/C++

(68)

TwinCAT 3 Integrated – integrated working area

Workbench integration - integrated working area

TwinCAT 3 framework = Microsoft Visual Studio® 2010

ƒUse of the commonest development environment ƒSupported by Microsoft

ƒExtendable via plug-ins (e.g. third party modules) ƒUsable with many common source-safe databases

ƒUse of C/C++ source code for the programming of automation devices

ƒUse of .NET languages for non-real-time applications (e.g. visualisations)

ƒImproved help system on the basis of Microsoft Visual Studio®

2010 Help (Microsoft Help system)

Ultimate

Professional

(69)

Parallel programming of IEC 61131 and C++

C++ Code IEC Code

23.05.2012

(70)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

(71)

Integrated System Manager | Directory tree

23.05.2012

TwinCAT 3 | Overview 17

System configuration

Motion control configuration

PLC configuration

Safety PLC configuration C++ module configuration

(72)

Integrated System Manager | Mapping

Mapping of the process image

ƒOpen for all common fieldbuses

ƒSupport for all PC hardware interfaces ƒSimple diagnosis of the fieldbus data

ƒCorrelation between logical and physical fieldbus ¾A change of the bus system does not entail a change of the PLC code!

TwinCAT process images

Physical process Virtual process images Inputs Outputs

(73)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

23.05.2012 TwinCAT 3 | Overview 19

(74)

TwinCAT 3 PLC

Multiple numbers of PLC projects:

ƒNumber of possible tasks: 256 (compare here to TwinCAT 2: 4x4)

ƒNumber of possible PLC projects limited only by the memory capacity of the automation device (instead of 4 runtime systems in TwinCAT 2)

Programming

ƒStandard IEC 61131-3 languages (IL, ST, FBD, LD, SFC) +CFC ƒUse of the object-orientated extensions of IEC 61131-3, 3rd edition

ƒCall and data exchange of code developed in C/C++ and Matlab®/Simulink® ƒLarge number of import and export interfaces

ƒNo direct addressing (necessary)

Commissioning/maintenance

ƒSource code upload/download ƒOnline Change

ƒComplete debugging (breakpoints, monitoring, sequence control etc.) of IEC and C/C++ code

(75)

TwinCAT 3 PLC | Development environment

Common tree structure for hardware and software

23.05.2012

TwinCAT 3 | Overview 21

(76)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

(77)

TwinCAT 3 Motion Control

ƒ Scalable solutions (from stepper motor to servo) ¾ Higher flexibility in use and exchange of technology ¾ Shortened development time Æfaster delivery

¾ Fast commissioning, diagnosis and maintenance ƒ Abstraction level - identical access:

¾ PLC/SCADA/HMI always access the same objects, irrespective of the type of axis or fieldbus employed.

ƒ Conversion of mechanical to electronic systems: ¾ Electronic cam plate

¾ Electronic gearing ¾ Electronic coupling ¾ Electronic cam shaft ¾ ‘Flying saw’

23.05.2012

(78)

TwinCAT 3 Motion Control | Abstraction level

Soft SPS Lay e r + + + -Soft Mo tion Lay e r Fie ldbus Lay e r Drives Lay e r Velo Preset Pos Ctrl Pos Meas. PLC SP Limit

(79)

TwinCAT 3 Motion Control | From PTP to Robot Control

Covered functionality 23.05.2012 TwinCAT 3 | Overview 25 NC PTP NC I CNC Robotics Point-to-Point- movement – gearing – camming – superposition – flying saw Interpolated motion with 3 axes and 5 additional axes – programming according to DIN 66025 – technological features – straightforward utilisation through function blocks from the PLC Complete CNC functionality – interpolated movement for up to 32 axes per channel – various transformations Interpolated motion for robotic control

– support for a wide rande of kinematic systems

– optional torque pre-control

(80)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

(81)

C/C++ programming languages

ƒ Reusability of already existing C/C++ code ƒ Common use of C/C++ and PLC code

ƒ Real-time applications available for all platforms (CE, 7)

ƒ Opening up of a completely new world for automation technology ƒ Renowned and well-known programming language

ƒ Standardised (C: ISO/IEC 9899 TC3, C++: IEC 14882)

ƒ The creation of Automation Device Drivers (ADD) enables you to implement your own drivers (e.g. for your own fieldbus system or the like)

ƒ Beckhoff SDK supports (similar to PLC libraries) ƒ ADS ƒ Motion ƒ File I/O 23.05.2012 TwinCAT 3 | Overview 27 Not ye t available!

(82)
(83)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

23.05.2012 TwinCAT 3 | Overview 29

(84)

Matlab

®

/Simulink

®

ƒ Well-known from science and measurement technology ƒ Large variability of toolboxes (e.g. fuzzy etc.)

ƒ Generation, simulation and optimisation of controller structures

ƒ Debug interface between Simulink® and TwinCAT

Code generation

ƒ Design: Simulink®

ƒ Automatic generation of C code by the Simulink® real-time workshop

ƒ Compilation with the Visual Studio® C compiler

ƒ Parameterisation in the TwinCAT System Manager

(85)

Matlab

®

/Simulink

®

| Integration

23.05.2012

(86)

ƒ Architektur (XAA)

ƒ

Engineering (XAE)

ƒ TwinCAT 3 Standard ƒ TwinCAT 3 Integrated ƒ System Manager ƒ PLC ƒ Motion Control ƒ C/C++ programming ƒ Matlab®/Simulink® Integration ƒ C#/ .NET programming

ƒ

Runtime (XAR)

(87)

C#/.NET programming

23.05.2012 TwinCAT 3 | Overview 33 PLC module C++ module Real-time Code HMI/ Windows processes

(88)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ

Runtime (XAR)

ƒ Modular runtime system

ƒ TwinCAT modules

(89)

Runtime (XAR)

23.05.2012

(90)

Runtime (XAR) | Modular runtime systems

ƒ Dynamic environment for the execution and management of TwinCAT 3

modules

¾ Standard PLC code ¾ NC code

¾ C++ code ¾ …

ƒ Management of the modules with the TwinCAT Object Manager

ƒ Firmly defined interface (e.g. TwinCAT Component Object Model - TcCOM)

Fieldbus

TwinCAT Transport Layer - ADS

TwinCAT Object Manager

TwinCAT Re al-time Ke rne l TcCOM PLC TcCOM PLC C++ Module TcCOM PLC CNC TcCOM PLC Safety TcCOM PLC Simulink® Module TcCOM PLC PLC TcCOM PLC NC TcCOM C++ Module

TwinCAT Automation Device Driver - ADD

TcCOM PLC C Module TcCOM PLC Simulink® Module TC Configuration Debugging Task Task Task Task Task Task Task Call Call Call TwinCAT 3 Runtime

(91)

Runtime (XAR) | TwinCAT modules

Must

ƒDescription (methods, functions, names etc.)

ƒStateMachine (Init, PreOp, Op) ƒTcCom Interface Can ƒInterfaces ƒParameter ƒData Areas ƒ… 23.05.2012 TwinCAT 3 | Overview 37 TwinCAT Module Interfaces Module Description Parameter State Machine ITComObject Interface

Data Areas Contexts Categories ADS Port Interfaces Pointers Data Area Pointers

(92)
(93)

TwinCAT 3 – Multi-core support

Support for multi-core systems

ƒAssignment of the individual projects to different cores

¾ PLC, NC, HMI etc. each assigned to their own core

ƒScalable basic time for each core

ƒScalable CPU limit adjustable for each core 23.05.2012 TwinCAT 3 | Overview 39 Core 0 ADS Multi-core CPU Windows Apps PLC Control Windows Drivers ADS User HMI Core 1 ADS Core 2 PLC Runtime 0 Task 0 Task 1 ADS PLC Runtime 1 Core 3 ADS NC Runtime 1 Core ...

ADS Router Engine

System Memory

ADS Router Message Queues L2 Shared Cache

(94)

TwinCAT 3 – Multi-core support | Assignment

Activation of the cores Definition of the CPU limits

Definition of the basic time

(95)

ƒ Motivation – why

TwinCAT 3

ƒ eXtended Automation

(XA) - overview

ƒ Architecture (XAA)

ƒ Engineering (XAE)

ƒ Runtime (XAR)

ƒ Connectivity

ƒ TwinCAT 2 Migration

ƒ Functions

23.05.2012 TwinCAT 3 | Overview 41

(96)
(97)

Connectivity | ADS to Communication

23.05.2012 TwinCAT 3 | Overview 43 TwinCAT TwinCAT TwinCAT

(PLC) PC 2

TwinCAT Automation Device Specification (ADS) Automation Protocols OPC UA, Modbus TCP, Modbus RTU 3964R/RK512 Industry Protocols IEC 61850, IEC 61400-25, IEC 60870-5- 10x, BACnet, FIAS, Creston IT Protocols WLAN, Bluetooth, TCP, UDP, RAS, FTP, VPN, SNMP, SNTP, SMS, SMTP Web Server Ils XML, AJAX, ASP, DPWS/WSD TwinCAT Automation Device Specification (ADS)

(PLC) PC 1

TwinCAT ADS Router

Acyclic TCP, UDP, Serial, Fieldbus TwinCAT ADS Router Cyclic EtherCAT Automation Protocol (EAP), Network variables

(98)

ƒ Motivation – why

TwinCAT 3

ƒ eXtended Automation

(XA) - overview

ƒ Architecture (XAA)

ƒ Engineering (XAE)

ƒ Runtime (XAR)

ƒ Connectivity

ƒ TwinCAT 2 Migration

ƒ Functions

(99)

TwinCAT 2 Migration | Opening ‘old’ projects

The opening of projects created with TwinCAT 2 results in:

1.) Conversion of ‘old’ projects to the TwinCAT 3 format ¾ Process can not be undone!

¾ TwinCAT 3 projects can not be saved in the TwinCAT 2 project format!

Conversion of existing TwinCAT 2 projects to the TwinCAT 3 format means:

ƒExtension of the project by new features

ƒIncreased reusability of the existing code in new project parts ƒUse of the same tools for all projects

ƒConversion of PLC Control and System Manager files

23.05.2012

(100)

ƒ Motivation – why

TwinCAT 3

ƒ eXtended Automation

(XA) - overview

ƒ Architecture (XAA)

ƒ Engineering (XAE)

ƒ Runtime (XAR)

ƒ Connectivity

ƒ TwinCAT 2 Migration

ƒ Functions

(101)

TwinCAT Functions

¾ The previously familiar TwinCAT supplements also exist in TwinCAT 3 The designation changes to TwinCAT Functions: TFxxxx

23.05.2012

TwinCAT 3 | Overview 47

TwinCAT 2 supplement licences cannot be used in TwinCAT 3!

New (if necessary trial) licences

(102)

Training für Umsteiger

Overview

Thank you very much for your

attention!

(103)
(104)

ƒ Architecture (XAA)

ƒ

Engineering (XAE)

ƒ

Runtime (XAR)

(105)

Architecture (XAA)

23.05.2012 TwinCAT 3 eXtended Automation (XA) eXtended Automation Runtime (XAR) eXtended Automation Engineering (XAE)

Modular runtime system

TcCOM PLC Safety TcCOM NC TcCOM C++ modules TcCOM … TcCOM

TwinCAT 3 development environment based on Visual Studio® 2010

TwinCAT 3 Standard Visual Studio® 2010 Shell TwinCAT 3 Integrated Visual Studio® 2010 eXtended Architecture (XAA)

(106)

Architecture (XAA) - notebook example (XAE) CX

eXtended Automation

Engineering (XAE)

TwinCAT 3 development environment Visual Studio® 2010 TwinCAT 3 Standard Visual Studio® 2010 Shell TwinCAT 3 Integrated Visual Studio® 2010 eXtended Automation Runtime (XAR)

(107)

Architecture (XAA) - notebook example (XAE) CX

23.05.2012 TwinCAT 3 | Overview eXtended Automation Runtime (XAR)

Modular runtime system

TcCOM PLC Safety TcCOM NC TcCOM C++ modules TcCOM … TcCOM

Ethernet interface used as programming interface

(108)

Architecture (XAA) - notebook example (XAE) CX

TwinCAT 3 development environment on notebook

TwinCAT 3

Standard / Integrated

TwinCAT 3 runtime on CX /IPC

TwinCAT Transport Layer - ADS

TwinCAT 3 Runtime Real-time Kernel PLC CNC C++PLC modules PLC PLC PLC Simulink® modules IO T w in CAT T ranspo rt La ye r -A D S

(109)

Architecture (XAA) - notebook example (XAE) CX

23.05.2012 TwinCAT 3 | Overview

TwinCAT 3 runtime on CX /IPC

TwinCAT Transport Layer - ADS

TwinCAT 3 Runtime Real-time Kernel PLC CNC C++PLC modules PLC PLC PLC Simulink® modules IO TwinCAT 3 development environment PC TwinCAT 3 Standard / Integrated TwinCAT Tra n sp ort L a y e r -A DS Config Mode:

to enable communication (programming) scanning of hardware / IO test in Freerun

Run Mode : PLC NC IO etc. operate in real-time PC

taskbar XAE status

(110)

Architecture (XAA) - notebook example (XAE) CX

PC taskbar

TwinCAT XAE displays TwinCAT state on the target system

TwinCAT on the target computer (CX / IPC)

The target computer

must be in the RUN

state in order to logon to the PLC

(111)

ƒ Practical part

ƒ

Establishment of a

connection

23.05.2012

(112)

ƒ Requirement: TC3 is successfully installed on the programming computer and the target computer

ƒ Hardware with PC (XAE)

(113)

12.04.2013 11 ƒ Example hardware

ƒ PC with TwinCAT3 XAE, CX with EtherCAT

adaptor

ƒ TwinCAT3 XAE / XAR on the same computer (local) ƒ BK1120 Bus Coupler ƒ 2* KL1XX2 2-CHANNEL DIG IN ƒ 2* KL2XX4 4-CHANNEL DIG OUT ƒ 1* KL2531 Stepper Terminal

(114)

ƒ Taskbar TwinCAT VS2010 symbol

(115)

Starting the VS2010 / 2010 shell

ƒ New Project ƒ XAE Project

(116)
(117)

ƒ To search, first select Local Target System

(118)

searches for TC controllers IPC/ CX Connection to both devices (enter PC target system)

(119)

ƒ Logon information: user name and password for computer. ƒ Training CX 1020 12.04.2013 17 CX training: Administrator 1

(120)

Connection valid

(121)
(122)

PC taskbar

TwinCAT XAE displays TwinCAT state on the target system

TwinCAT on the target computer (CX / IPC)

(123)

12.04.2013 21

TwinCAT XAE displays TwinCAT

state on the target system The target system must

be in Config Mode for scanning and freerun test of the hardware

The target computer

must be in the RUN state

in order to logon to the PLC later

The TwinCAT system on the XAE computer must be in the Config Mode for logging on.

Run Mode is also possible if the XAE computer simultaneously represents a control computer (XAR)

(124)

ƒ Practical part

ƒ

Hardware test

ƒ Scanning

(125)

Scan Hardware

ƒ Check Config Mode, activate Config Mode if necessary ƒ Scan 12.04.2013 23

(126)

Scan Hardware

(127)

12.04.2013 25

Freerun

ƒ In Freerun Mode, I/O can be tested without PLC program

(128)

ƒ Practical part

ƒ

Create PLC program

ƒ Generate global variables

(129)

12.04.2013 27

Add PLC project

(130)

Global Variable List

ƒ PLC project from template

ƒ Generate global variable list

(131)

12.04.2013 29

Global Variable List

(132)

Global Variable List

(133)

12.04.2013 31

Linking

(134)

Linking

(135)

12.04.2013 33

Linking

(136)

Activate

ƒ Activating the configuration

(137)

12.04.2013 35

Activate

ƒ If TwinCAT XAR is not registered, a 7-day licence can be created

(138)

Login

ƒ Logon to PLC project PLC RUN Start PLC PLC Online Login

(139)

XAE offline + PLC not in Run Mode XAE online + PLC not in Run Mode XAE offline + PLC in Run Mode

XAE online + PLC in Run Mode

(140)

Monitoring

ƒ Global variables online

Write Value

(141)

12.04.2013 39

Extending the program

ƒ Logout ƒ Create FB

(142)

Extending the program

(143)

12.04.2013 41

Extending the program

ƒ Edit FB

ƒ Toolbox: VIEW->TOOLBOX

(144)

Extending the program

ƒ Edit FB

ƒ Adapt connection with “Set output connection”

(145)

12.04.2013 43

Extending the program

ƒ Edit FB

ƒ Adapt connection with “Set output connection”

(146)

Extending the program

ƒ Call block in Main (ST) with input assistant and Auto Declare

(147)

12.04.2013 45

Extending the program

ƒ Call block in Main (ST) with input assistant and Auto Declare

(148)

Extending the program

ƒ Call block in Main (ST) with input assistant and Auto Declare ƒ Configure input and

(149)

ƒ Practical part

ƒ

Settings for automatic start of

the XAR

ƒ Activate boot project

ƒ Enable boot project start

ƒ Set TwinCAT autostart for

RUN

23.05.2012

(150)

Autostart

ƒ Boot project

ƒ Enable autostart

(151)

12.04.2013 49

Autostart

(152)

Autostart

ƒ User name and password for the control computer

(153)

Training für Umsteiger

Handling

(154)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals ƒ Slide-in 2: Variable Declaration

ƒ Practice slide-in 1: The first project ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

(155)

Version differences | Overview

23.05.2012

TwinCAT 3 | Handling 3

TwinCAT 3

Standard

Standard

ƒ Based on the Microsoft

Visual Studio

®

Shell

ƒ Integrated TwinCAT

System Manager

ƒ Integrated IEC-61131-3

3

rd

edition programming

(OOP)

ƒ Integrierte Safety PLC

TwinCAT 3

Integrated

Integrated

ƒ Integration in an existing Microsoft Visual Studio® 2010

ƒ Integrated System Manager

ƒ Integrated IEC-61131-3 3rd edition programming (OOP)

ƒ Integrierte Safety PLC ƒ C/C++ programming ƒ Matlab®/Simulink®

ƒ C# and .NET programming for non-real-time applications

ƒ Optional: Implementation of third-party software tools

(156)
(157)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals ƒ Slide-in 2: Variable Declaration

ƒ Practice slide-in 1: The first project ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

23.05.2012

(158)

Integration of the TwinCAT System Manager

ƒ Complete integration of the TwinCAT System Manager into the Microsoft Visual Studio tree.

ƒ The complete collection of project data (PLC, NC, hardware configuration) is summarised in one ‘solution’

(Projectname.sln).

ƒ Each individual project in the solution has its own process image.

ƒ Simulation of I/Os and axes.

(159)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System

ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals ƒ Slide-in 2: Variable Declaration

ƒ Practice slide-in 1: The first project ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

23.05.2012

(160)

System configuration

ƒ The tree entry system contains ƒ Licence

ƒ Real time ƒ Tasks ƒ Routing

(161)

Licence | General overview

Licensing in TwinCAT 3 is divided into two steps:

¾ Sales-related procedure

¾ Technical integration in TwinCAT XAE

Sales

Sales--related procedurerelated procedure

1. Ordering of the desired TwinCAT 3 package

Technical integration in TwinCAT XAE

Technical integration in TwinCAT XAE

2. All licences necessary for the project are listed automatically in TwinCAT XAE. This

list can also be extended manually. A licence file (Licence Request File) is generated from it.

3. The licence file is sent by email to the Beckhoff Activation Server

4. The activation server creates a valid licence file (Licence Response File), which is

imported into TwinCAT XAE

23.05.2012

TwinCAT 3 | Handling 9

Alternative: Alternative:

(162)

Licence | Diagram

(163)

Licence | Generation of the chargeable licence

ƒ In the Licence section below System in the configuration tree, the project-related licences can be viewed on the ‘Order Information’ tab or further licences can be selected for ordering on the ‘Manage Licences’ tab.

ƒ The corresponding file is generated by actuating the ‘Generate Licence Request File…’ button

ƒ The generated file can then be sent by email:

23.05.2012

TwinCAT 3 | Handling 11

The Beckhoff Licence ID is transmitted on

confirmation of the order and must be entered here.

(164)

Licence | Importing the chargeable licence

ƒ The Licence Response File is received via the same email address that was used to send the Licence Request File

ƒ This file can be read in the same section where the Request File was also generated

ƒ After linking the licence file, it is automatically copied to ‘%TwinCATDIR% \Target\License’

(165)

Licence | 7-day test licence

In TwinCAT 3 there is a possibility to generate a 7-day test licence including the required TwinCAT Functions - completely without limitations!

There are two different ways to use a test licence:

a)

a)On the local systemOn the local system

i. The ‘Order Information’ tab displays all licences necessary for the project for

which a 7-day test licence is generated

ii. If a test licence has not yet been generated, but the project is to be activated,

then a message appears upon activation that licences are missing and will now be generated. It is necessary to input a code for this:

23.05.2012

(166)

Licence | 7-day test licence | Remote system

b)

b) On a remote systemOn a remote system

i. An ADS connection must exist in order to copy the licence to the device

ii. Two tabs are displayed in the Licence section: ‘Order Information (Runtime)’

and ‘Order Information (Engineering)’. The necessary 7-day test licence can be activated and confirmed on the ‘Runtime’ tab.

(167)

Real Time Settings

ƒ Assignment of the task(s) to a core

ƒ Definition of the base time for each core

ƒ Setting of the CPU limit of the core

23.05.2012

(168)

Task Management

ƒ Central management of the task(s) for this solution

ƒ Reference of the PlcTask from the PLC to Task Management

(169)

TcCom Objects

ƒ Linking of binaries ƒ Matlab/Simulink

ƒ C++ modules in TwinCAT standard environments ƒ …

23.05.2012

(170)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System

ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals ƒ Slide-in 2: Variable Declaration

ƒ Practice slide-in 1: The first project ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

(171)

PLC programming | Overview

ƒ Several PLC projects can be managed in a solution

¾ Number of possible tasks: 65,000 (compare TwinCAT 2: 4x4)

¾ Number of possible PLC projects: limited only by the memory capacity of the automation device (compare TwinCAT 2: 4 RTS)

ƒ Programming:

¾ Standard IEC 61131-3 languages (IL, ST, FBD, LD, SFC) +CFC

¾ Use of the object-orientated extensions of IEC 61131-3, 3rd edition

¾ Call and data exchange of code developed in C/C++ and Matlab®/Simulink®

¾ Large number of import and export interfaces ¾ No direct addressing (necessary)

ƒ Commissioning/maintenance ¾ Source code upload/download ¾ Online Change

¾ Complete debugging (breakpoints, monitoring, sequence control etc.) of IEC and C/C++ code

23.05.2012

(172)

PLC programming | Editor | Declaration of variables

ƒ Choice between ‘normal’ declaration view and tabular view ƒ All changes are consistent in both views

(173)

PLC programming | Editor | Structured Text (ST)

ƒ Improved usability:

¾ Automatic completion (auto-complete)

¾ Marking of keywords associated with one another

¾ Collapsing of programming structures

23.05.2012

(174)

PLC programming | Editor | LD/FBD/IL

ƒ Just one editor for all 3 programming languages!

¾

¾ Switching between the Switching

languages without translating ¾ Online switching possible ¾ Settings e.g. for

symbol comments affect all views ¾ Mixed networks

ƒ LD

¾ Contact networks at all inputs ¾ Coils at all outputs

¾ Several blocks in a network ƒ IL

(175)

PLC programming | Libraries

ƒ Namespaces and default namespaces ƒ Internal and external objects in one library ƒ Installation of the libraries necessary!

ƒ Identification via name, company and version

ƒ Several versions of a library possible per installation

ƒ Use of several versions of a library possible within a project

23.05.2012

(176)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals

ƒ Slide-in 2: Variable Declaration ƒ Practice slide-in 1: The first project ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

(177)

Slide-in 1: EtherCAT Bus Terminals

23.05.2012

(178)

EtherCAT Coupler as link

ƒ The EtherCAT Coupler (e.g. EK1100) represents the link between the fieldbus master and the EtherCAT I/O system.

ƒ A fieldbus master can manage up to 65535 EtherCAT slaves

(179)

The EtherCAT terminals in detail

Power contacts for automatic bridging of the power potentials 23.05.2012 TwinCAT 3 | Handling 27 Symmetrical unlatching for vertical removal Screwless connection technology

Terminal block design: Terminal block design:

12 x 100 x 68 mm (W x H x D) 12 x 100 x 68 mm (W x H x D)

(180)

Further features of the EtherCAT terminals

4-wire connection technology

Leading PE contact Tongue and groove

connection

Terminal type based on the label

Digital inputs: EL1xxx

Digital outputs: EL2xxx

Analog inputs: EL3xxx

Analog outputs: EL4xxx

Communication: EL6xxx

Drive: EL7xxx

System: EL9xxx

(181)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals

ƒ Slide-in 2: Variable Declaration

ƒ Practice slide-in 1: The first project ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

23.05.2012

(182)

Slide-in 2: Variable Declaration

ƒ In order to be able to link variables from the PLC to hardware inputs or outputs, these must be specially declared

¾ The variable AnalogValuePot1 is to record a potentiometer

control value via an analog input terminal. ƒ General addressing regulation:

ƒ This results in the following declaration possibilities for the example variable

AnalogValuePot1: or Variable name AT % I Q X B 0.1 2 : BOOL INT ; *

(183)

Fixed addressing vs. automatic addressing

ƒ In comparison with fixed addressing,

a placeholder for an address to be assigned by the System Manager is inserted in

automatic addressing by adding a ‘*’:

23.05.2012

(184)

Declaration regulation for naming

a b c

Lamp AT %QX0.0 : BOOL; Switch AT %IX0.0 : BOOL;

Analog_Value AT %IB2:INT; Temperature AT %IB100 :INT;

Zähler AT %IB3 : UINT; PWM_Output AT %QB10 :INT; Naming restrictions 1. No special characters 2. No spaces 3. Permitted for separation 4. No umlauts

(185)

Overview of contents

ƒ Version differences

ƒ Visual Studio® 2010

ƒ Visual Studio® 2010 Shell

ƒ Integration of the TwinCAT System Manager

ƒ System ƒ PLC

ƒ Slide-in 1: EtherCAT Bus Terminals ƒ Slide-in 2: Variable Declaration

ƒ Practice slide-in 1: The first project

ƒ Automatic start of the controller ƒ Establishing a remote connection ƒ Own data types

ƒ Working with several tasks ƒ Backup on the target system ƒ Encrypt the project

23.05.2012

(186)

Practice slide-in 1: The first project

ƒ Starting the TwinCAT 3 engineering (XAE) - fast start via the TwinCAT Icon

(187)

Creating a new project

ƒ Generating a new project ƒ Selection of the template

ƒ TwinCAT Project

ƒ TwinCAT Project creates a new solution with System Manager tree

ƒ Enter name and specify storage location for the solution

23.05.2012

(188)

Project folder explorer

ƒ The project folder explorer manages the complete solution and contains the name that was selected when creating the project.

ƒ If there is only one project, then this has the solution name.

ƒ If there are several projects the name can simply be changed with a ‘right click’.

ƒ Further projects can be added by ‘right-clicking’ on the project folder.

ƒ Existing projects always end with *.tsp

(189)

Installation: devices compatible with real-time Ethernet

ƒ For the use of real-time

Ethernet devices as fieldbus masters, such as

9 EtherCAT

9 Realtime Ethernet

it is necessary to install an appropriate protocol for an INTEL chipset-based Ethernet controller: TwinCATÆShow Realtime Ethernet Compatible Devices 23.05.2012 TwinCAT 3 | Handling 37

(190)

Step 1: Generating a hardware configuration

ƒ You can automatically search for devices by right-clicking on Devices in the I/O menu option.

ƒ Depending on the fieldbus masters in use, these will be displayed for selection in the subsequent window.

ƒ When the selection is confirmed

with , a search will be performed for slaves connected to the selected master if is selected in the dialog box. 2 3 1 2 3 1

(191)

Testing the created configuration

ƒ The Free Run mode can be activated in order to perform an I/O check.

23.05.2012

(192)

Step 2: Creating a PLC configuration

ƒ By right-clicking on PLC, either a new TwinCAT 3 project

ƒ or an existing TwinCAT 3 (*.plcproj) or TwinCAT 2 (*.pro file) can be added

ƒ The standard PLC project or an empty PLC project can be used as the template for the new

(193)

PLC project in detail

ƒ Below the PLC Configuration a PLC project is created with the name entered previously.

ƒ On creating the project the first POU: MAIN is also created.

ƒ The PLC project is subdivided into code and instance

ƒ At the same time as the PLC project, a PLC task was created as a reference to the created task in the system task area.

23.05.2012

(194)

Step 3: IEC example ‘Blinker’

ƒ A function block FB_Blinker is now added to the already created POU MAIN.

ƒ By right-clicking on POUs a further block can now be created as a function block in ‘FUP/FBD’.

1

(195)

FB_Blinker | Add box

ƒ Depending on the selected language, the ‘Toolbox’ contains elements for inserting into the block:

ƒ The first box is pulled here into the first network by drag & drop.

23.05.2012

TwinCAT 3 | Handling 43

ƒ A total of 3 boxes are required, which are inserted one after the other

(196)

FB_Blinker | Structure of the FB

ƒ The blinker is to be realised by means of an AND condition and two

series-connected timer blocks of the type TON, to which an instance name will also be assigned in the next step

(197)

FB_Blinker | Instancing

ƒ Typing the implementation name for a timer opens the selection help:

ƒ If the instance name is now issued by selecting the ‘???’ above the box, the declaration help for creating the instance opens:

ƒ If you confirm the entries here, then the instance is created in the selected object ‘FB_Blinker’ in the local variable class ‘VAR’.

ƒ The second box is instanced in exactly the same way.

23.05.2012

(198)

FB_Blinker | Instancing

ƒ The first box in the chain becomes the AND gate which, inserted as a function, requires no instance formation:

ƒ The first input of the AND gate should be connected to the external variable ‘bStart’. ƒ As soon as this is entered in place of ‘???’, the declaration help opens again.

ƒ VAR_INPUT is selected here as the memory location (Scope) ƒ The type of variable (type) is

recognised automatically on the basis of the block.

(199)

FB_Blinker | Instancing

ƒ The second input of the AND gate is connected to the output Q of the second timing element T2 and negated by right-clicking on the input in front of the box:

ƒ The runtime is specified via the PT inputs of timing elements T1 and T2, which are declared as input variables of the FB_Blinker

ƒ On creating the ‘tZeit’ variables, the declaration help opens again, via which the variables are created in the VAR_INPUT area.

23.05.2012

(200)

FB_Blinker | Instancing

ƒ The generated pulse is output from the FB_Blinker via the variable ‘bBlinkimpuls’ by declaration as VAR_OUTPUT.

ƒ The value is tapped by means of adding an ‘Insert Assignment’ by right-clicking in front of the ‘IN’ input of T2:

References

Related documents

A backward elimination multiple regression model analysis was used to examine first how well a set of variables (variables used in previous studies, namely the

Such a collegiate cul- ture, like honors cultures everywhere, is best achieved by open and trusting relationships of the students with each other and the instructor, discussions

This second VCL architecture has a configuration with blades assigned to a tightly coupled HPC cluster environment or to a large overlay (virtual) cloud that has

Specific performance standards will insure that students will meet their education goals in the Culinary Arts Program.. The instructional program must reflect the principles of

The information flows required for the demand activation or de-activation of CFNA by an authorized MS, where the serving system does not provide the optional courtesy call to

For those patients aged under 65 years both the SF-36 and NHP suggest significant differences, with lower health- related quality of life compared with norms in the

When the user credentials are correct the Session Web Service returns the session ID in the SOAP header and one of the return parameters of the Session Web Services is the