Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TwinCAT 3
1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation
1988
S1000
PLC/NC on
PC (DOS)
1988 1993
S1000 S2000
PLC/NC on PLC/NC/CNC
PC (DOS) on PC
PC-Hardware
Feldbus
Base I/O TwinSAFE PLC Control Control Connectivity
(PID)
TwinCAT-
Software
integration of PLC, Motion and HMI into one software on one CPU:
minimised hardware
faster cycle times due to no hardware interfaces
reduced interface complexity
better diagnosis
PC Control offers an “open” control system
abstraction as a principle
functions in software & independent from hardware
scalable performance and cost by selection of standard CPUs
powerful operating systems add IT functions to automation solutions
automation and IT world share the same benefits:
performance increase
cost decrease
1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation
Architecture (XAA)
Engineering (XAE)
System Manager
PLC
Motion Control
C/C++ programming
Matlab® integration
C#/.NET programming
Runtime (XAR)
PC System
TwinCAT 3 Runtime
Real-time Kernel
TcCOM
TcCOM
TcCOM
TcCOM
PLC
PLC Safety
PLC NC
PLC CPLC
Module
eXtended
Automation Runtime (XAR)
TcCOM
TcCOM
TcCOM
TcCOM
Fieldbus
– I/O
for PLC programmers and users of – PLC
IEC 61131 Object-
– MC
existing modules – NC
oriented
extensions
– CNC
configuring, setting up and diagnosis – Safety
– others
TwinCAT 3 Runtime
– MC oriented
– NC extensions
code generation
debugging
upload of TC modules
System configuration
PLC configuration
I/O configuration
Programming:
languages of the IEC 61131-3 (IL, ST, FBD, LD, SFC) + CFC
usage of the object-oriented extensions of the 3rd edition of the IEC 61131
call and data exchange of modules written in C/C++ and Matlab®/Simulink®
multiple import and export interfaces
no direct addressing necessary
Commissioning/maintenance:
source code up- and download
online change
full debugging functionality (breakpoints, monitoring, flow control,…)
call of a method
Benefits:
more flexibility in used technique (stepper, servo drive,…)
more flexibility in changes to the products
shorter time of delivery and development time
shorter time for commissioning because of the lack of
mechanical parts
decreasing costs
+
PLC
Pos Ctrl Limit
Layer
- +
+
SP Velo Preset Scale & Limit
Pos Meas.
Fieldbus
Layer
Drives
Layer
Functionality
Application areas
image processing
robotics
measurement technology
…
Matlab®/Simulink® integration
well-known in the scientific and measurement environment
great variety of toolboxes (e.g. Fuzzy)
creation, simulation and optimisation of control circuits
debug interface between Simulink® and TwinCAT
Code generation
design in Simulink®
automatic generation of C code by the Simulink CoderTM
compilation with Visual Studio® C Compiler
parameterisation in the TwinCAT System Manager
download and execution in the TwinCAT 3 Runtime
benefits:
efficient engineering with higher abstraction level
widely accepted
“Garbage collection” takes care on memory.
could now be handled as part of one integrated solution
restrictions:
Garbage collector is not suitable for real-time applications.
HMI/
Windows processes
PLC module
C++ module
Real-time Code
TcCOM
TcCOM
Task PLC Call C++
administration of runtime modules (with Module
TcCOM
Task
PLC
NC
TwinCAT Object Manager)
TcCOM
TcCOM
Task PLC
C++ Call PLC
C
defined interfaces (e.g. TwinCAT Module Module
TcCOM
Component Object Model –TcCOM) PLC
Simulink ®
TcCOM
TcCOM
Task PLC
CNC PLC
Simulink ®
Call Module
TcCOM
PLC
PLC
Task
TcCOM
Task PLC
Safety
TwinCAT 3 Runtime
Fieldbus
Module Description
easy to use
State Machine
included state machine
ITComObject Interface
Contexts
Data Areas Data Area
Categories Pointers
ADS Port
INIT
Parameter
IP PI
PREOP
Parameter
PS SP
SAFEOP
SO OS
OP
L2 Shared Cache
System Memory
Result:
TwinCAT Multicore technology increases PLC power, linear
related to the number of CPU cores
PC Control enables future CPU development for automation
applications
TwinCAT 3 | eXtended Automation Technology 50
TwinCAT 3
Contents
1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation
1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation
Module Description
easy to use
State Machine
included state machine
ITComObject Interface
Contexts
Data Areas Data Area
Categories Pointers
ADS Port
INIT
Parameter
IP PI
PREOP
Parameter
PS SP
SAFEOP
SO OS
OP
1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation
Online –
http://twincat3.infosys.beckhoff.com/
MS Help
MS Help
MS Help
MS Help
or:
www.beckhoff.com/TwinCAT3
www.Beckhoff.com
Select ‘Download’
Beckhoff
Downloading TwinCAT 3
The name of the Install file will include the Version and Build number
Beckhoff
Installing TwinCAT 3
Click ‘Yes’
Beckhoff
Installing TwinCAT 3
Click ‘Next’
Beckhoff
Installing TwinCAT 3
Select ‘Custom’
Click ‘Next’
Beckhoff
Installing TwinCAT 3
By default TwinCAT will install the Shell for Visual Studio 2010
Select your environment and click ‘Next’
Beckhoff
Installing TwinCAT 3
Installation in progress
Beckhoff
Installing TwinCAT 3
Click ‘Finish’
Beckhoff
Installing TwinCAT 3
The following article describes how to install the TwinCAT3 documentation. Cause TwinCAT3 is
using the Visual Studio 2010 shell as a workbench, its helpfile is based on the new Microsoft Help
System (MHS) replacing the existing HTML/CHM helpfiles. MHS is an end-to-end help system for
content which is either served from an online source or installed locally. This system enables users
to view help-content via their favorite web browser or with a software called “Microsoft Help
Viewer”.
2. System requirements
3. Installation
Please note that the installation has separate setup files for x64 and x86 systems.
URL:
http://download.beckhoff.com/download/Software/TwinCAT/TwinCAT3/InfoSystem/
X86: TC3-InfoSys-x86-en.exe
X64: TC3-InfoSys-x64-en.exe
Beckhoff Automation GmbH, Eiserstraße 5, 33415 Verl Tel: 05246 / 963-0, Fax 05246/ 963-198
Execute the corresponding Setup file with Administrator rights by performing the following steps:
When the setup is finished, you can open the TwinCAT3 documentation directly from within
TwinCAT XAE.
As alternative open the menu „Help“ and select „View Help“, which will open the Microsoft Help
Viewer.
Beckhoff Automation GmbH, Eiserstraße 5, 33415 Verl Tel: 05246 / 963-0, Fax 05246/ 963-198
4. Updating documentation
You can update the documentation’s content directly from within TwinCAT XAE. Please perform the
following steps to update the documentation:
The system will automatically check for updates and will notify you if an update is available.
Please make sure that your IT infrastructure (Firewall, Proxy-Server, etc.) allows the system to
connect to http://twincat3.infosys.beckhoff.com.
If an update is available, click on the corresponding button to update the documentation’s
content and confirm with “Yes” to trust our files.
Beckhoff Automation GmbH, Eiserstraße 5, 33415 Verl Tel: 05246 / 963-0, Fax 05246/ 963-198
TwinCAT News
Agenda
TwinCAT 3
Deliverables
Naming
Pricing
Ordering
Licensing
Availability
1/7/2013 1
TwinCAT3: Product information (sales)
Deliverables Products: Overview
Deliverables
1/7/2013 2
TwinCAT3: Product information (sales)
Deliverables Products: Overview
1/7/2013 3
TwinCAT3: Product information (sales)
Deliverables Products: Engineering
Setup “TwinCAT3-Full”
Setup “TwinCAT3-XAE”
1/7/2013 4
TwinCAT3: Product information (sales)
Deliverables Products: Engineering Setup
07.01.2013 5
TwinCAT3: Product information (sales)
Deliverables Products: Trial versions
Trial versions:
TwinCAT3:
07.01.2013 6
TwinCAT3: Product information (sales)
TwinCAT3: Naming
Naming
1/7/2013 7
TwinCAT3: Product information (sales)
TwinCAT3: Naming Engineering
Content:
Plug-In Systemmanager
Plug-In PLC-Editor
Royalty-free VS2010 shell
just container – nothing to implement C/C++/C#
Price:
Royalty-free, full-featured base package
7 day time-limited runtime
repeatable by customer without Beckhoff activity
Note:
Engineering tools are not free in general
Fees i.e. required for:
CAM Design Tool, ECAD Import /
SimulationManager / Scope++ / Valve Diagram
TwinCAT2: Keep well-known level from TwinCAT2 like levels IO / PLC / NC-PTP / NCI / CNC
1/7/2013 9
TwinCAT3: Product information (sales)
TwinCAT3: Naming Functions
„EL/KL1xxx“System
„EL/KL3xxx“Measurement
TF 5000 NCPTP „EL/KL4xxx“Control
„EL/KL5xxx“Motion
TF 5xxx
1/7/2013 10
TwinCAT3: Product information (sales)
TwinCAT3: Naming
TX abbb-cdpp-vvvv
T TwinCAT
X Base System
C=TwinCAT3 Run-time
F= Function
E=Engineering
Pricing
1/7/2013 12
TwinCAT3: Product information (sales)
TwinCAT3: Pricing - Platforms
1/7/2013 13
TwinCAT3: Product information (sales)
TwinCAT3: Price according to product and platform
1/7/2013 14
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
Licensing
1/7/2013 15
TwinCAT3: Product information (sales)
TwinCAT3: Licensing – Handling: where to find
TwinCAT3:
07.01.2013 16
TwinCAT3: Product information (sales)
TwinCAT3: Licensing - Trial
Enter valid
security
code will
enable „OK“
07.01.2013 17
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
07.01.2013 18
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
or
07.01.2013 19
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
Communication:
By email only (no longer by phone / by fax)
07.01.2013 20
TwinCAT3: Product information (sales)
TwinCAT3: Licensing – certificate with „TC3 License ID“
07.01.2013 21
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 22
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 23
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 24
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 25
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
Optional (green)
Customer
information
Will be included
into License
Response File
07.01.2013 26
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
1. Step:
Generate
License Req File
1
07.01.2013 27
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 28
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 29
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 30
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
Activate
License Response
File...
07.01.2013 31
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
Activate
License Response
File...
...results in valid
licenses
07.01.2013 32
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 33
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
Connection to
remote device will
automatic add license
Remote licenses Local licenses
dialog for remote device
07.01.2013 34
TwinCAT3: Product information (sales)
TwinCAT3: Licensing
TwinCAT3:
07.01.2013 35
TwinCAT3: Product information (sales)
TwinCAT3: Ordering
Current thinking:
Order number for „clean image“ (basic CX-device without any TwinCAT)
07.01.2013 36
TwinCAT 3
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
Starting a new project
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Multiple CPU Cores
TWINCAT 3
Beckhoff TwinCAT 3
Multiple CPU Cores
Beckhoff TwinCAT 3
Multiple CPU Cores
Beckhoff TwinCAT 3
Multiple CPU Cores
It is also possible to set the base time for task that will run
on this core.
The CPU Limit when sharing the core with Windows is 80%
Beckhoff TwinCAT 3
Multiple CPU Cores
Beckhoff TwinCAT 3
CPU Core Isolation
Beckhoff TwinCAT 3
Multiple CPU Cores
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Visual Studio Shell
TWINCAT 3
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell
It is also possible to grab the ‘Solution Explorer’ from the bottom and
separate it from the group
Beckhoff TwinCAT 3
Visual Studio Shell
The panes on the left, right, and bottom are ‘Dockable’ and
can be ‘Pinned’ in place
Here the ‘Toolbox’ is Docked and Hidden (middle)
When the mouse crosses over the Title that pane is shown
(right)
To ‘Pin’ the pane click on the ‘Push Pin’ symbol (left)
Beckhoff TwinCAT 3
Visual Studio Shell
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
The four dots (circled below) are a handle that can be used
to move the toolbar by clicking and dragging
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Build
Build Selection
(Shift+F6): Compiles the
current Project
Build Solution (F6):
Compiles all Projects
within the Solution
Cancel (Ctrl+Break): Cancels
the current compile
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Debug
Start (F5)
Break All (Ctrl+Alt+Break)
Stop Debugging (Shift+F5)
Restart (Ctrl+Shift+F5)
Show Next Statement
(Alt+Num*)
Step Into (F11)
Step Over (F10)
Step Out (Shift+F11)
Hexadecimal Display
Show Threads in Source
Breakpoints (Ctrl+Alt+B)
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
TwinCAT PLC
Active PLC Project – PLC Runtimes can be selected here
Login
Force Values
Start Unforce Values
Stop Write Values
Logout Reset Cold
Step Into Reset Origin
Step Over
Step Out
Flow Control
Single Cycle
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
TwinCAT XAE Base
Activate Configuration
Restart TwinCAT System
Restart TwinCAT (Config Mode)
Reload Devices
Scan
Toggle Free Run State
Show Online Data
Show Sub Items
Choose Target System - Remote Targets can be selected form here
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
Customize
From here existing Tool
bars can be modified or
New Tool Bars can be
created
This allows for the
programmer to tailor the
programming
environment to their
exact needs
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Visual Studio allows for the user to create their own custom
Short Cut Keys
Most of the common TwinCAT 2 short cut keys already exist
in TwinCAT 3 however Ctrl+F7 to ‘Write Values’ does not
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
If using TwinCAT Extended with Visual Studio Professional, the
‘Shortcut currently used by:’ window will notify the user that this
keyboard shortcut is already mapped to the ‘Build.Compile’
command
If using TwinCAT Standard without Visual Studio then this keyboard
shortcut is not currently being used
Ultimately it is up to the user to decide which shortcuts will perform
what commands
When the Assign button is clicked the shortcut keys will be mapped
to the command
If the short cut keys were already used by another command the
previous command will be removed
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
Use the Reset button to set all keyboard shortcuts back to default.
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Scanning Hardware
TWINCAT 3
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
Adding Hardware
Right-click on ‘Devices’
Select ‘Scan’
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
Adding Hardware
Press ‘Yes’ to ‘Activate Free Run’, this will allow for the
testing/updating of hardware without using a PLC program.
Beckhoff TwinCAT 3
Adding Hardware
Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Testing IO
3rd party devices may not be found, click OK to acknowledge the HINT
Note: Configuration files from 3rd party vendors should be place in the appropriate
fieldbus folder under C:\ TwinCAT \ IO \
Beckhoff
Testing IO
Click Yes to scan for boxes. TwinCAT will now attempt to search for IO devices and
drives on all fieldbus networks.
Beckhoff
Testing IO
TwinCAT will find all devices inside the PC that can be used as a fieldbus
controller. Select all fieldbus controllers you wish to use and click OK
Note: If you are expecting an EtherCAT device that is not listed, but instead have a
RT-Ethernet device, then check the cabling from the PC to the first EtherCAT
device on the network
Beckhoff
Testing IO
Double click on the EtherCAT controller then, the select the Online tab
Verify all devices are in OP
The output now displays the status as a 1 and the output is energized
Beckhoff
Testing IO
In the ‘Set Value Dialog’ window you can use the ‘1’ button next to ‘Bool:’ or type a
‘1’ in the ‘Dec:’ box and click ‘OK’
Beckhoff
Testing IO
Expand the EL3002 then expand AI Standard Channel 1 and select Value
Select the Online tab and the value can be monitored
Beckhoff
Testing IO
Beckhoff TwinCAT 3
Activating the Configuration
TWINCAT 3
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
Activating the Configuration
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Adding the PLC Control
TWINCAT 3
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
In the ‘Solution
Explorer’ you can see
that the PLC Project
has been added with
the minimum
amount of objects
required for the PLC
to operate.
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
The ‘References’
folder holds the
libraries to be used
by the Run-Time.
The libraries seen
here are included by
default.
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
Beckhoff TwinCAT 3
Adding the PLC Control
Machine1 Instance
will hold the variable
of the PLC that are
given %I and %Q
addresses.
The variables will be
linked to and from
here to other
locations in the
Solution Explorer.
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Adding Code
TWINCAT 3
Beckhoff TwinCAT 3
Adding Code
In the ‘Solution
Explorer’ under the
‘PLC’ double-click on
‘Main’ to open it.
Beckhoff TwinCAT 3
Adding Code
Beckhoff TwinCAT 3
Adding Code
Beckhoff TwinCAT 3
Adding Code
Beckhoff TwinCAT 3
Adding Code
Beckhoff TwinCAT 3
Adding Code
Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Variables
Variable Types
Declarations
Variable Scope
Initial Values
Constants
Beckhoff
What is a Variable?
Beckhoff
Variables
In accordance with IEC 61131-3 a variable name must adhere to the following rules
1. The variable must begin with a Letter or an Underscore
2. The variable can be followed by Letters, Underscores, or Numbers
No distinction is made between Uppercase and Lowercase Letters
Keywords are identifiers specified by IEC61131-3. They are thus fixed components
of the syntax and therefore may not be used for other purposes.
Examples
Standard operators AND, OR, NOT…
Standard types BOOL, INT, REAL...
Custom Types TYPE, STRUCT
Block types FUNCTION, FUNCTION_BLOCK, PROGRAM
Beckhoff
Comments
The comments are delimited by character strings with (* or *) at the beginning and
at the end. Comments may be placed wherever spaces are also permitted.
Exception: within string literals.
(*Digital Input*)
bStart AT %IX0.0 :BOOL;(*Machine Start*)
(*Analog Input*)
TempK1 AT %IW10 (*Byte 10-11*) :WORD;
bStart AT %IX0.0 :BOOL; // Machine Start
(* bStop at %IX0.0 : BOOL; (*Machine Stop*) *)
Beckhoff
Comments
If comments are placed on the line above or after the variable, then the comment
will appear in the tooltip when hoovering the mouse over the variable name.
Beckhoff
Variable Size
Constants
$<2 Hex values> ASCII Code
$0D CR
$R $r CR
$L $l Line Feed
$N $n New Line
$T $t Tab
Beckhoff
String data type
It is possible when declaring a variable to link the name with an address that must
be explicitly specified.
For the allocation of inputs and outputs of the hardware the incomplete location is
to be carried out with I* and Q*
Beckhoff
Declaring a Variable
Examples:
IX10.7 IX10.6 IX10.5 IX10.4 IX10.3 IX10.2 IX10.1 IX10.0 Din0 AT%IX10.0 : BOOL;
IB10
Keywords
Keywords
VAR_GLOBAL ..
VAR ..
END_VAR
END_VAR
VAR_CONFIG ..
VAR_INPUT ..
END_VAR
END_VAR
VAR_IN_OUT ..
END_VAR
VAR_OUTPUT ..
END_VAR
Beckhoff
Variable Scope
Global Variables can be read and written to from anywhere in the PLC program
Local Variables can only be written to from within the POU where they are defined
The local variable of any POU can be read by first accessing the POU instance that
the variable is defined in and then using the ‘.’ to access the local variables defined
within that POU
Local variables cannot be written to from another POU
Beckhoff
Initial Values
Beckhoff TwinCAT 3
Data Type Conversions
TWINCAT 3
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
myOtherVar := datatype_to_datatype(myVar);
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
Data Type Conversion
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Addressing Variables
TWINCAT 3
Beckhoff TwinCAT 3
Addressed Variables
Beckhoff TwinCAT 3
POU Addressed Variables
Beckhoff TwinCAT 3
GVL Addressed Variables
Beckhoff TwinCAT 3
GVL Addressed Variables
Beckhoff TwinCAT 3
GVL Addressed Variables
Beckhoff TwinCAT 3
GVL Addressed Variables
Beckhoff TwinCAT 3
Addressed Variables ‚Instance‘
ADDRESSED VARIABLES
‚INSTANCE‘
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
Linking Variables
Double click on
GVL_IO.xStart
On the ‘Variable’ tab click
‘Linked to…’ to open the
Attach Variable window
Beckhoff TwinCAT 3
Linking Variables
The filter settings on the right side will narrow the results
Beckhoff TwinCAT 3
Linking Variables
Select the first Input under the EL1008 and click ‘OK’
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
Linking Variables
Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Lamp Test
Beckhoff
Lamp Test – Power Rail
Note: Not all cards use and/or pass the power rail.
Beckhoff
Lamp Test – Digital Input
The push button will be wired from Connection Point 2 on the EL1002 through the
push button, and then back to Connection Point 1 on the EL1002.
When the contacts are closed power is sent from the positive connection to the
input.
Beckhoff
Lamp Test – Digital Output
The LED will be wired from Connection Point 3 on the EL2002 through the LED,
and then back to Connection Point 1 on the EL2002.
When the output is turned on, the LED will illuminate.
Beckhoff
Lamp Test – Coupler Power
In the PLC the variables are declared with addresses so that they may be linked to
the hardware
When the code is run, xLight1 will have the same value as xSwitch1
Beckhoff
Lamp Test – FLOW
Power passes from the supply through the power rail and to the Push Button, when
the button is pressed power is supplied to the input
Beckhoff
Lamp Test – FLOW
When the EtherCAT update happens the status of the input will be given to the
EtherCAT packet
Beckhoff
Lamp Test – FLOW
The EtherCAT card in the PC will pass the data directly to the PCs memory where it
can be read by TwinCAT
Beckhoff
Lamp Test – FLOW
TwinCAT will then pass the data from the PLC Instance
back to the I/O Configuration
Beckhoff
Lamp Test – FLOW
The EtherCAT card in the PC will read the data directly from the PCs memory and
send out the EtherCAT packet over the network.
Beckhoff
Lamp Test – FLOW
When the data reaches the Output card the output will be energized and the LED
will illuminate.
Beckhoff
Lamp Test – FLOW
PB
Input Card
I/O Update
I/O Configuration
PLC Instance
PLC Code
PLC Instance
I/O Configuration
I/O Update
Output Card
LED
Beckhoff
Lamp Test – FLOW
When a variable is Forced inside the PLC, the Force is applied and then the PLC
Code is allowed to run as it normally would. The Force is then applied again at the
end of the PLC Scan.
Here y has been Forced to a value of 1
x is assigned a value of y + 1 or 2
Beckhoff
Lamp Test – Forces in the PLC
The hardware shows the data type needed for the PLC variable to be linked to it.
Beckhoff
Analog Test
Add the PLC variables for the Analog Input and Output
Beckhoff
Analog Test
If there are no errors, the variables will be place into the Instance
Beckhoff
Analog Test
Note: If you hover the mouse of the variable, the tooltip will display the full path
including the channel number.
Beckhoff
Analog Test
Note: If you hover the mouse of the variable, the tooltip will display the full path
including the channel number.
Beckhoff
Analog Test
After the variables have been Linked, from the TwinCAT select ‘Activate
Configuration’
Beckhoff
Analog Test
Beckhoff TwinCAT 3
PLC Languages IEC61131-3 3rd Edition
TWINCAT 3
Beckhoff TwinCAT 3
PLC Languages
ST – Structured Text
FBD – Function Block Diagram
LD – Ladder Diagram
SFC – Sequential Function Chart
IL – Instruction List
Beckhoff TwinCAT 3
PLC Languages – Structured Text
Beckhoff TwinCAT 3
PLC Languages – Function Block Diagram
Beckhoff TwinCAT 3
PLC Languages – Ladder Diagram
Beckhoff TwinCAT 3
PLC Languages
Beckhoff TwinCAT 3
PLC Languages – Instruction List
Beckhoff TwinCAT 3
PLC Languages Continuos Function Chart
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Languages Samples
TWINCAT 3
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
Languages Samples
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
CASE Instruction
TWINCAT 3
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
After the step is executed the code will continue after the
END_CASE
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
CASE Instruction
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
TWINCAT 3
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
TWINCAT 3
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Iterations with Loops
TWINCAT 3
Beckhoff TwinCAT 3
Iterations with Loops - FOR
Beckhoff TwinCAT 3
Iterations with Loops - FOR
Beckhoff TwinCAT 3
Iterations with Loops - FOR
Beckhoff TwinCAT 3
Iterations with Loops - FOR
Beckhoff TwinCAT 3
Iterations with Loops - FOR
Beckhoff TwinCAT 3
Iterations with Loops - FOR
The start and end of the ‘FOR’ loop must be either literal
values or must be defined as a ‘CONSTANT’
The value to skip by can be a standard variable
Beckhoff TwinCAT 3
Iterations with Loops - FOR
Beckhoff TwinCAT 3
Iterations with Loops - While
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
LIMIT Function
TWINCAT 3
Beckhoff TwinCAT 3
LIMIT Function
Beckhoff TwinCAT 3
LIMIT Function
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Logging in to the PLC
TWINCAT 3
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Logging in to the PLC
Beckhoff TwinCAT 3
Making Changes to the Code
TWINCAT 3
Beckhoff TwinCAT 3
Making changes to the Code
Beckhoff TwinCAT 3
Making changes to the Code
Beckhoff TwinCAT 3
Making changes to the Code
Beckhoff TwinCAT 3
Making changes to the Code
Beckhoff TwinCAT 3
Making changes to the Code
Beckhoff TwinCAT 3
Making changes to the Code
Beckhoff TwinCAT 3
Making changes to the Code
Program PRG
Called by a task: (one program can call another)
Calls: Programs, Funtion Blocks, and Functions
Local variable: static, i.e. the local data are available again in the next cycle.
Inputs: usually 0, but VAR_INPUT possible
Outputs: usually 0, but VAR_OUTPUT possible
Transfer by reference: VAR_IN_OUT possible
Monitoring: Local data are immediately visible in the online mode of the PLC control
Use: Main programs, Main, Manual, Automatic, Unwind, Rewind, Sorter, etc.
Programs
ST FBD IL LD
New Automation Technology
Beckhoff Training
Beckhoff
Calling Programs
A Function is a re-useable piece of code that will process the defined inputs and
return a single result
AND, OR, SQRT, SIN, COS, GT, LE are all examples of Functions
The programmer can also create their own Functions that normally involve more
complicated tasks, such as converting a temperature value from Celsius to
Fahrenheit or scaling an analog input value from 0-32767 to 0-10
Note: Functions have no memory space and therefore they do not retain any values
from one PLC scan to the next. Each function starts new each PLC scan.
Beckhoff
Functions
Function: FUN
Called by Programs, Function Blocks and other Functions
Calls: Functions
Local variable: temporary, i.e. the local data are available only for the
processing time of the function. Afterwards this data area is used by other
functions.
Inputs: 1,2,3........ VAR_INPUT
Outputs: precisely 1!, but structure variable possible. The name of the output
is the name of the function.
Transfer by reference: 1,2,3........ VAR_IN_OUT ,
Monitoring: In the online mode of the PLC control only “???” are visible for the
local variables, since this data area is used by all functions in the cycle and
monitoring (debug) takes place only at the cycle limits. Remedy: program
development with breakpoints
Use: algorithms where the result is available after a run. Scaling, comparison,
etc.
Beckhoff
Functions
ST FBD
IL LD
New Automation Technology
Beckhoff Training
Beckhoff
Adding a new Function
Declaration
Code
Use
Beckhoff
Parts of a Function : Declaration
Write to the name of the Function to return the result of the function
Beckhoff
Use of a Function
Declaration
Code
Use
Beckhoff
Parts of a Function : Declaration
Beckhoff TwinCAT 3
Linear scaling with a ratio
TWINCAT 3
Beckhoff TwinCAT 3
Linear scaling with a ratio
Assignment:
Create a function that will scale a value between
0 and 32767 to a value between 0.0 and 100.0
Thoughts:
Because both scales start at 0 we can simply divide the
maximum scale-to value by the maximum scale-from
value 100.0/32767
This will give us a ratio that we can multiply by the input
and it will give us the scaled value
Beckhoff TwinCAT 3
Linear scaling with a ratio
Beckhoff TwinCAT 3
Linear scaling with a ratio
Answer
Beckhoff TwinCAT 3
Linear scaling with a ratio
Declaration
Beckhoff TwinCAT 3
Linear scaling with a ratio
Code
Beckhoff TwinCAT 3
Linear scaling with a ratio
Use
Beckhoff TwinCAT 3
TwinCAT 3
Beckhoff TwinCAT 3
Linear scaling using an equation
TWINCAT 3
Beckhoff TwinCAT 3
Linear scaling using an equation
Assignment
Create a function that will scale a value between any
two numbers to a value between any two other
numbers
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
This is similar to converting temperature from one scale
to another. The numbers can go both positive and
negative. For any given value on 1 scale there is exactly
1 possible value on the other scale
32 degrees F = 0 degress C
212 degress F = 100 degrees C
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
Think of the Celsius scale as the X-Axis and the
Fahrenheit scale as the Y-Axis
The formula to convert from Celsius to Fahrenheit is:
TempF = 9/5 * TempC + 32
The +32 is the offset of the line,
because it does not cross the
Y-Axis at 0
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
The 9/5 comes from the step required to get from one
position on the line to the next
For each increase of 9 degrees Fahrenheit. You must
increase 5 degrees in Celsius
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
An increase on the Y-Axis is referred to as a Rise, an
increase on the X-Axis is called a Run
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
So we have a Rise of 9 and a Run of 5. This can be
calculated using 2 known positions 100,212 and 0,32
The difference in the values will give us the change in
Step.
212-32 / 100-0 = 180/100 = 9/5
Step = (y2-y1) / (x2-x1)
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
Because the Step is actually a ratio it is referred to as the
Slope of the Line, in the formula we will use the letter
m.
The formula needed to do our conversion is
y = mx + b
where:
m = (y2-y1) / (x2-x1)
x = value to be converted (TempC)
b = 32, the Y-Intercept
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
y = 9/5 * TempC + 32
TempF = 9/5 * TempC + 32
Beckhoff TwinCAT 3
Linear scaling using an equation
Thoughts
Using this formula we can now convert from any scale to
any other scale
y=mx+b
m=(y2-y1)/(x2-x1)
b=y1-(x1*m)
Beckhoff TwinCAT 3
Linear scaling using an equation
Answer
Beckhoff TwinCAT 3
Linear scaling using an equation
Declaration
Beckhoff TwinCAT 3
Linear scaling using an equation
Code
Beckhoff TwinCAT 3
Linear scaling using an equation
Use
Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Function Blocks
A Function Block is a re-useable piece of code that can have multiple inputs and
multiple outputs. Function Blocks are instantiated, therefore each time a Function
Block is used it must be assigned a unique instance name. Each instance receives
its own space in memory and therefore will retain its values from one PLC scan to
the next.
TON, CTU, R_Trig, FB_FileOpen, ADSREAD, these are just a few examples of
Function Blocks
The programmer can also create their own Function Blocks to perform a variety of
tasks.
Beckhoff
Function Block
Function block FB
Called by: Programs or other FBs
Calls: Funtion Blocks, Functions
Local variable: static, i.e. the local data are available again in the next cycle. Each
FB call has its own local data.
Inputs: 0,1,2,3…VAR_INPUT
Outputs: 0,1,2,3.. VAR_OUTPUT
Transfer by reference: 0,1,2,3.. VAR_IN_OUT
Monitoring: In the online mode of the PLC control the instance of the call concerned
must first be specified. The local data are then visible for each call.
Use: multiple-used modules, each of which requires its own data area. Timers,
Counters, Axis Commands, Alarms, etc.
Beckhoff
Function Block
ST FBD
IL LD
New Automation Technology
Beckhoff Training
Beckhoff
Adding a new Function Block
Declaration
Code
Use
Beckhoff
Parts of a Function Block : Declaration
Also notice that fbTON.Q is passed into fbTOF, this will cause the two timers to
toggle based on the values of tTimeOff and tTimeOn
Finally the output of fbTOF is passed to bPulse. bPulse is the output of FB_Pulse
This could have been done with the following
bPulse := fbTOF.Q;
Beckhoff
Parts of a Function Block: Use
Beckhoff TwinCAT 3
Library Manager
TWINCAT 3
Beckhoff TwinCAT 3
Beckhoff
Libraries
Libraries contain Functions and Function Blocks that can be used within a program.
TwinCAT includes many libraries for many common tasks.
Libraries can be written by the programmer and re-used on multiple projects.
The Functions and Function Blocks in the libraries cannot be opened from the PLC
program that is using them.
All Libraries are pre-compiled.
Library Manager
The Library Manager can be accessed in the Solution Explorer under the PLC
Project
Beckhoff TwinCAT 3
Library Manager
By Default the Library Manager contains the Standard and System Libraries from
TwinCAT 2 (Note: These libraries have been converted to work within TwinCAT 3)
Tc3_Interfaces and Tc3_Module are additional libraries that can be used for
communicating with TcCom objects and other new features in TwinCAT 3
Note: Tc3_Module is required in order to be able to compile a project
Beckhoff TwinCAT 3
Library Manager - Versions
Managed Libraries
In general the libraries are added to the library manager with an specific version.
(e.g. v3.2.0.0)
The project will always use this set of libraries although newer versions of some
libraries could exist in the library repository. The project can automatically use the
newest version of a library too.
To use libraries unmanaged, Click on a library in the Library Manager, select the
Properties button at the top of the library manager, and set the version to 'Newest
version always'.
In this dialog it is also possible to specify another specific version.
Beckhoff TwinCAT 3
Library Manager - Versions
Managed Libraries
Select a Library and Click Properties
Beckhoff TwinCAT 3
Library Manager - Versions
Managed Libraries
Specific Versions or Newest Version always can be selected here
Beckhoff TwinCAT 3
Library Manager – Adding a Library
Beckhoff TwinCAT 3
Library Manager – Adding a Library
Beckhoff TwinCAT 3
Library Manager – Adding a Library
When Display all versions is checked, the library manager will show previous
versions of the libraries (if there are any).
Beckhoff TwinCAT 3
Library Manager – Adding a Library
From the Library Repository it is possible to add additional folder locations, and
copy library files into the default folder
Beckhoff TwinCAT 3
Library Manager – Adding a Library
Beckhoff TwinCAT 3
Library Manager – Adding a Library
Beckhoff TwinCAT 3
Library Manager – Adding a Library
The ‘Find’ button will allow for searching for an item inside of all libraries
Beckhoff TwinCAT 3
Library Manager – Adding a Library
Beckhoff TwinCAT 3
Library Manager – Adding a Library
The ‘Details’ button will provide specific information about the selected item.
Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Flow Control
Flow control allows you to see which lines of code are being executed
In the below sample we can see that lines 2 and 5 are being executed, as indicated
by the green highlights
Go To Definition
Find All References
Find
Beckhoff
Go To Definition
This will open the file where the declaration is and Highlight the Variable
If a Variable is defined in more than one location, the search tool will find the
correct definition based on the use of the variable
Beckhoff
Go To Definition
This can also be used on the instance and/or the implementation of a Function
Block
The Definition of fbTOF in the Code window is on Line 12 in the local declaration
window.
Beckhoff
Go To Definition
Using ‘Find All References’ will open a new window displaying the search results
Beckhoff
Find All References
Using ‘Find All References’ will open a new window displaying the search results
This window will display the declaration of the variable and also where the variable
is read and written in the program
Beckhoff
Find All References
The results can be filtered using the ‘Scope’ drop down list
Beckhoff
Find All References
Double-Clicking on a result in the ‘Cross Reference List’ will open the code and
Highlight the text
Beckhoff
Find
You can type in part of a variable name and press the ‘Enter’ key
Each time you press the ‘Enter’ key the next result will be Highlighted
Using the Find tool in this manner will only search the current file
Beckhoff
Find
Using the Icon will open the ‘Find and Replace’ window
Beckhoff
Find
Using the Icon will open the ‘Find and Replace’ window
The ‘Look in:’ drop down list will allow for searching of more than just the current file
New Automation Technology
Beckhoff Training
Beckhoff
Boot Project
The TwinCAT Boot Project is used on a production machine as the PLC code to be
run when TwinCAT starts.
The Boot Project in TwinCAT3 is Automatically created when the Configuration is
“Activated”
The default location for the Boot Project is C:\TwinCAT\3.1\Boot
Beckhoff
Boot Project
The “Autostart” for the boot project can be found by selecting the name of the PLC
Project in the “Solution Explorer”
Beckhoff
Boot Project
Before activating the configuration the folder is empty, after a “Blank Configuration”
has been added the follow files and folders are created.
Beckhoff
Boot Project
Adding a PLC project and then Activating the Configuration provides the following
Beckhoff
Boot Project
A Right-Click on the Project Name in the Solution Explorer will provide a context
menu that allows for “Activate Boot Project…” this way you can create a boot
project without effecting the I/O configuration.
There is also the option to Enable and Disable the Autostart of the boot project from
here
Beckhoff
Boot Project - Encryption
The option to Encrypt the boot project exists in a drop down list and can be
accessed by selecting the project name in the solution explorer
Beckhoff
Boot Project - Encryption
The Boot folder holds a zip file that contains the files to recreate the project, all of
these files can be opened by adding them as an existing item.
The PLC folder contains the information of the actual Boot Project.
Beckhoff
Boot Project - Encryption
Removing the PLC folder from C:\TwinCAT\3.1\Boot will remove the boot project.
If Encryption is enabled, these are the files that are encrypted.
Encryption is done with Standard AES encryption.
An encrypted boot project can only be run on its Target System; therefore moving
an encrypted Boot folder from one CX to another will no longer function.
New Automation Technology
TwinCAT 3 Scope
Due to its integration into Visual Studio, it is possible to use TwinCAT Projects and
Scope View projects in a single solution
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Lab
TwinCAT 3 Scope
Scope History – Scope 1
• New style
• 2 Components View and Server
• Long time records
• Auto scaling
• More trigger functionality
• Constant development
TwinCAT 3 Scope
Scope History – Scope 2
Scope 2 View
TwinCAT Scope 2 Visual Studio + TwinCAT 3
= TwinCAT 3 Scope:
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Lab
TwinCAT 3 Scope
Installation
What if you do not have Visual Studio but want to use the Scope?
OS
Windows XP, Windows XP Embedded, Windows Embedded Standard 2009,
Windows 7
.Net Framework
The .NET Framework 4.0 is required
TwinCAT
Minimum is TwinCAT 3 ADS
TwinCAT 3 Scope
Installation
Custom – Options for TF3300 Scope Server (2KB) and/or TE130X Scope View
(3KB)
TwinCAT 3 Scope
Licensing
Licensing for Scope View is the same as all other TC3 Functions
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Lab
TwinCAT 3 Scope
Features
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Lab
TwinCAT 3 Scope
General Scope Features
Start Record
Stop Record
Stop Display
Restart Display
Start Subsave
Stop Subsave
Execute Report
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Level
Scope Details
Lab
TwinCAT 3 Scope
Product Level
Scope View
is a TwinCAT engineering product and supplies the graphic interface for the
configuration of recordings and the display of signal curves. The View is
available in different product levels, Base and Professional
Scope Server
is a TwinCAT 3 function and supplies the software for the data recording,
which is installed on distributed target devices or on the local target device.
The Server sends the recorded data to the View
Note: Both components must be available in the system in order to be able to use the
Scope.
TwinCAT 3 Scope
View vs Server
The TwinCAT Scope View communicates over ADS with the Scope Servers
distributed in the system. The local Server, which is located with the View on a
system, can be used for the recording of local variables. However, it is also used
whenever saved Scope data files are opened in the View. The View displays the
signal curves and is used for the configuration of recordings.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Configuration
Lab
TwinCAT 3 Scope
Configuration
Not only are signal curves represented in the TwinCAT Scope View; recording
configurations are also created. The architecture is reflected in the tree structure
within the Measurement Project in the Solution Explorer.
Chart:
Several charts can exist in parallel in a Scope. They are the actual display area in
the view and provide the time base. Each chart has its own toolbar for changing the
display. The color and axis settings can be made in the Property window.
Axis:
A chart can have several axes. An axis provides the
range of values for the connected channels.
Amongst others, the automatic or free scaling can
be set in the Property window.
Cursor:
Cursors are hierarchically assigned to the charts. X
and Y cursors can be added within a chart. In the
Cursor Tool window you can see amongst other
things the current values of the signal/cursor
interface and also differences to other cursors. Any
desired number of X and Y cursors can be set.
TwinCAT 3 Scope
Configuration
Trigger:
Triggers are assigned to the Scopes in the tree structure of the Scope View. The
trigger action, e.g. Stop Record, can be set in the Property window of the trigger
group. The underlying triggers can be logically linked to a trigger condition. The
variable selection also takes place here in the Property window.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Window
Lab
TwinCAT 3 Scope
Window
Solution Explorer
Display of the project structure within a solution.
TwinCAT 3 Scope
Window
Cursor
Display of the values present at the X/Y-cursor.
TwinCAT 3 Scope
Window
Error List
List of errors, warnings and messages. Each scope project lists the generated
messages independently here. The messages for the respectively selected
Scope can be deleted via the context menu item "Clear Error List".
TwinCAT 3 Scope
Window
Target Browser
With the target browser you can be add Scope configuration channels via their
symbol names.
TwinCAT 3 Scope
Window
Properties
The settings of the respective element that is marked
in the Solution Explorer can be modified here.
TwinCAT 3 Scope
Window
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Project Types
Lab
TwinCAT 3 Scope
Project Types
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Scope Menu
Lab
TwinCAT 3 Scope
Scope Menu
Target Browser
Opens the target browser for variable
selection from local or remote servers
Cursor Window
Opens the cursor window.
TwinCAT 3 Scope
Scope Menu
New Chart
Creates a new chart within the Scope.
New Axis
Creates a new axis within the chart. If the
selected element is not a chart, then a new
chart is additionally created.
Delete
Deletes the element currently selected in the
Solution Explorer.
TwinCAT 3 Scope
Scope Menu
Export to CSV
Export data to a CSV file
Export to Binary
Export data to a Binary file
TwinCAT 3 Scope
Scope Menu
Save Data
After stopping the recording, the current data
including the configuration can be saved in a
.svd file.
The generated Scope data file (.svd) can be
added directly to the Measurement Project or
saved in a directory of your choice via the
directory selection dialog.
TwinCAT 3 Scope
Scope Menu
Scope Messages
Some frequently occurring message boxes in
the scope are equipped with a checkbox
"Remember my answer and don't ask again!"
so that the question is not repeated the next
time. This makes the handling of the program
individually adjustable for each user. If a
message box has been deactivated, it can be
activated again here.
TwinCAT 3 Scope
Scope Menu
Options...
Opens the Visual Studio Options window and
selects the Scope entry.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Toolbar
Lab
TwinCAT 3 Scope
Toolbar
The default Measurement toolbar includes commands to Start and Stop recording.
Other commands can be added by selecting the down arrow and then customize.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Properties
Lab
TwinCAT 3 Scope
Properties
Each item in the Solution Explorer (Scope, Chart, Axis, and Channel) has it’s own
properties window.
TwinCAT 3 Scope
Properties
Ring Buffer active: the recording is not stopped; instead, the oldest data in
the memory are overwritten. The consequence is that the start time of the
recording increases. The recording is only stopped when the stop button is
actuated.
Ring Buffer inactive: the recording is stopped on reaching the end of the
recording time. The recording can be terminated prematurely via the stop
button.
TwinCAT 3 Scope
Properties
Multiple Selection
Some parameters are often
modified for several or all
elements. To do this you can mark
several elements via the Solution
Explorer and edit the settings of
all marked elements at the same
time. Data that differ between the
selected elements are
represented as empty fields.
To make multiple selections, keep
the <Ctrl> key pressed during the
selection. In the case of
successive elements you can
select the first element, keep the
<Shift> key pressed and then
select the last element in order to
mark all elements in between.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Target Browser
Lab
TwinCAT 3 Scope
Target Browser
With the target browser you can add Scope configuration channels via their symbol
names. The target browser is divided into two halves. The first shows a tree with
the first entry: ROUTES. Below that all devices registered in the System Manager
are shown. The color of the target indicates the system state: red = not reachable
(stop mode), blue = config. mode, green = system in run mode.
TwinCAT 3 Scope
Target Browser
The second half shows a detailed list of the sub items of the selected element of
the tree structure.
TwinCAT 3 Scope
Target Browser
In the list structure one or more channels can now be selected and added to the
configuration with a double click or by a right mouse click-> "Add symbol" ("Add
Subsymbols" ) or by one of the buttons in the toolbar.
In addition, selected elements can be inserted by drag & drop to any place within
the configuration.
If a folder, an Ads Bigtype or an array is selected that contains sub-symbols, the
"Add Subsymbols" option adds a channel for each sub symbol. The "Add symbol"
option inserts only one channel with the information of the selected symbol.
TwinCAT 3 Scope
Target Browser
If a target computer is selected in the tree or list structure, the connected tasks
become visible. These are marked in color: green = PLC task, blue = NC task, red
= other.
If a task is not displayed, then a selection menu can be called using the Enable
Server Ports option that displays the limitation to certain tasks.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Cursor
Lab
TwinCAT 3 Scope
Cursor
Cursor
A chart cursor can be added and changed via the cursor module.
TwinCAT 3 Scope
Cursor
The cursor module (listed in each chart element as "cursor") offers the following
setting options:
Delta Values: If several cursors are used in one direction the differences can be
displayed if Delta Types is activated.
Hex Values: Hexadecimal notation of the average values of the individual
channels.
TwinCAT 3 Scope
Cursor
Each X/Y-cursor within the cursor module offers its own setting options
Color: Color of the cursor.
Comment: A comment can be saved here.
Line Width: Line width of the cursor in pixels.
TwinCAT 3 Scope
Cursor
Status Times
The times belonging to an added X-cursor
are displayed here in three formats.
Absolute Position: Corresponds to the
actually registered time.
Record Position: Time value of the cursor
since the beginning of the recording.
Chart Position: Time value of the cursor
within the recording.
TwinCAT 3 Scope
Cursor
Channel
The average values of the individual
channels are displayed with the respective
X-cursor in the Channel field. The
displayed average values are, like the
display, compromised to pixel width. You
can zoom into the recording in order to
indicate the intermediate values.
TwinCAT 3 Scope
Cursor
Axis
The values of the Y-cursors on the
respective axes are indicated in the lowest
field.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Trigger
Lab
TwinCAT 3 Scope
Trigger
Trigger groups and trigger sets can be added via the trigger context menu.
Right-Click on ‘Trigger’ and select ‘New Trigger Group’
TwinCAT 3 Scope
Trigger
Trigger Action
Start Record: If this option is selected, the start record condition in the Scope
settings should be set to trigger start. Otherwise the Scope would start recording as
usual. With setting this action, therefore, a question box appears that carries out
this setting if necessary. If you actuate the record button in the menu bar, the
Scope connects itself as usual to the servers involved and starts to sift through the
connected channels, but without starting the actual recording. The recording begins
with the trigger time of the last trigger set condition.
TwinCAT 3 Scope
Trigger
Trigger Action
Stop Record: If the stop action is selected, the Scope should be operated in the
ring buffer mode. With setting this action, therefore, a question box appears that
carries out this setting if necessary. In the field below you can specify whether a
fixed time range should appear in the recording before and/or after the trigger
event. If pre-trigger is selected, trigger events before the expiry of this time are
ignored. If post-trigger is active, the recording runs for the specified time after
receipt of the trigger event.
TwinCAT 3 Scope
Trigger
Trigger Action
Stop Display: The stop display action stops all Scope charts that are in live mode
at the point of triggering. With the trigger position you can select how many percent
of the display shown (display width) are to be located before or behind the trigger
event (in the example: positive 0-crossing of the green signal at 10% of 2.5 s = 0.25
s). If the trigger condition is fulfilled again, the display jumps to this new event.
Pause can be actuated in the chart in order to prevent this retriggering.
TwinCAT 3 Scope
Trigger
Trigger Action
Restart Display: All charts paused due to a Stop Display trigger are resumed on
fulfilment of the trigger condition.
TwinCAT 3 Scope
Trigger
Trigger Action
Start Subsave: On the occurrence of this trigger event a background recording is
started with the current configuration. This sub save always runs in the ring buffer
mode (independent of the settings in the Scope settings). It is possible to start up to
5 sub saves simultaneously (via one or more trigger events). The maximum
memory capacity of the sub save can be specified in the 'Record Time' field. This
recording duration may also be longer than the recording duration of the basic
configuration (in this case ring buffer operation should also be selected).
TwinCAT 3 Scope
Trigger
Trigger Action
Stop Subsave: Following the Stop Subsave trigger event, the oldest sub save is
stopped and transferred to the View in the background. From here it is saved in a
.svd file via the specified path. The generated file name consists of the name of the
Scope in the basic configuration and an ID composed of the date and time, in
alphanumeric order.
TwinCAT 3 Scope
Trigger
As soon as a trigger set is triggered, the icon in the Solution Explorer changes from
to
All trigger sets remain set until the entire trigger group has triggered.
TwinCAT 3 Scope
Trigger
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Exporting Data
Lab
TwinCAT 3 Scope
Exporting Data
Recorded data can be saved in a scope data file (.svd). Alternatively data can be
exported in .csv, .txt or a binary format after stopping the current recording.
Right-Click on ‘Scope’ and select ‘Export to CSV’ or ‘Export to Binary’
TwinCAT 3 Scope
Exporting Data
Export to CSV:
Text export in order to be able to use the Scope data in other programs as well.
The generated file is held in the table format. The rows are separated by lines and
the columns by tabulators. The first rows contain information about the recording,
such as Scope name or start and the end time of the recording.
TwinCAT 3 Scope
Exporting Data
Afterwards a definition range with the acquisition data follows for each channel.
TwinCAT 3 Scope
Exporting Data
Finally a list with the recorded data follows for each channel. First the time value as
an offset of the start record time, then the corresponding data value.
TwinCAT 3 Scope
Exporting Data
Export to Binary:
The binary data format is based on the text format, but contains no separators.
Instead the byte lengths of all variable data types (such as character strings) are
contained in the corresponding headers. All times are specified in the file time
format: 1tick = 100ns; origin is 1/1/1601 0h.
TwinCAT 3 Scope
Agenda
Scope History
Installation
Features
General Features
Product Levels
Scope Details
.Net API
Lab
TwinCAT 3 Scope
.Net API
Requirements
The ScopeViewControl requires .NET Framework 4.0.
Click on the project with the right mouse button and select "Properties".
The target framework ".NET Framework 4" must be selected under
"Application".
The ".NET Framework 4 Client Profile" is not supported.
Scope History
Installation
Features
General Features
Product Levels
Scope Details
Lab
TwinCAT 3 Scope
Lab
In order to allow a fast startup and to simplify work with the TwinCAT 3 Scope
software oscilloscope, the first steps are briefly described. We have consciously
avoided dealing with every detail. For example, trigger-controlled recordings and
the creation of reports are not subjects of this documentation.
TwinCAT 3 Scope
Lab
1. Installation:
For basic understanding is important to know that a Scope Server is always
installed with a Scope View, since otherwise no saved data can be displayed locally
in the View. Conversely, the Scope component installation can also install the
Server without View on a target device.
2. Licensing:
Regardless of whether the Scope View was installed by its own setup or by the
TwinCAT 3 XAE setup, the initially activated license is "Base" for View and Server.
You can find out here which functions are enabled with which license key.
TwinCAT 3 Scope
Lab
3. New project:
The Scope View can be selected under Beckhoff in the Windows Start Menu.
TwinCAT 3 Scope
Lab
The Visual Studio opens in its shell or in a full version if installed. You can choose
between various templates. For this demo please select ‘Measurement Scope
Project’ and click ‘OK’
TwinCAT 3 Scope
Lab
In the Solution Explorer the starting point for the new Scope configuration
assembles itself automatically.
TwinCAT 3 Scope
Lab
4. Selection of channels:
Variables or channels now have to be added to the generated configuration. These
can be selected via the target browser. When using for the first time it is possible
that this will not be directly visible as a window in Visual Studio. The target browser
can be selected in the context menu with a right-click on the Scope node.
TwinCAT 3 Scope
Lab
Alternatively the target browser can also be selected via the Scope menu in Visual
Studio. Once the target browser has opened, the window can be docked in any
position in the user interface. It is possible to select the desired variables by
browsing into the respective target system.
TwinCAT 3 Scope
Lab
The selected channels are assigned to the last-selected axis. In this case only one
axis is present.
TwinCAT 3 Scope
Lab
5. Recording:
Prior to a recording the basic recording settings must be made in the Scope
Properties. Standard is a ten-minute recording which is started manually and
automatically stopped after the respective time. The settings for all hierarchical
levels – Scope, Charts, Axis and Channel – as well as for trigger and cursor can be
made in the standard Property window of Visual Studio. A simple click on the
corresponding element in the Solution Explorer is sufficient, provided that the
Property window has already been opened first under View in Visual Studio.
TwinCAT 3 Scope
Lab
If the standard settings are left as they are, the recording can be started. To this
end the Scope toolbar must be opened when using for the first time.
In Visual Studio > View > Toolbars > TwinCAT Measurement.
The recording is started by clicking on the icon with the red recording symbol.
TwinCAT 3 Scope
Lab
Beckhoff TwinCAT 3
Remote Connections
TWINCAT 3
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
On the ‘TwinCAT Project’ tab there are now tabs for both
‘Local’ and ‘Target’
On the ‘Settings (Target)’ tab, the ‘Auto Boot’ and ‘Auto
Logon’ settings can be changed
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3
Remote Connections
Beckhoff TwinCAT 3