How to create a new TwinCAT3 Project from scratch
Auteur Gareth Green | Dernière modification 12/09/2023 par Gareth Green en cours de rédaction ⧼frevu-button-review-label⧽
Difficulté
Hard Difficile
How to create a new TwinCAT3 Project from scratch
TwinCAT3, Project, New
Create_a_TwinCAT_Project_from_Scratch_Annotation_2019-11-20_145941.jpg
Introduction
...Beckhoff Technical help is available on 01491 410539 option 3
Étape 1 - Install Visual Studio / TwinCAT XAE Shell (if required)
...This now applies to all installations.
The "CNC" standard PCs used for the front end on Flowlines and ZXs have Visual Studio already installed but the TwinCAt version needs to be upgraded from 4022 to 4024
Uninstall all references to Visual Studio 2013 and Beckhoff Twincat3. If this is needed, restart the PC
Copy the install file from g:\Design\TwinCAT3\TC31-Full-Setup.3.1.4024.7.exe to the desktop of the Beckhoff PC
Run the install as Administrator
Delete the setup zip file and unzipped directory to save hard drive space
..."Specified account already exists" error will happen if the Visual Studio 2013 or Beckhoff TwinCAT is not fully uninstalled and PC restarted. Use Revo uninstaller to completely remove it
...From version 3.1.4024 onwards, is is not called visual studio, it is called "TwinCAT XAE Shell"
Étape 2 - Add the latest Device Description Table
Copy the contents of g:\design\twincat3\Beckhoff_EtherCAT_XML.zip
to
C:\TwinCAT\3.1\config\Io\EtherCAT and overwrite all the .xml files in this folder
...This allows the Beckhoff system to identify the latest version of the AX8000 drives
Étape 3 - Add Drive Manager 2 for AX8000 drives (if not installed already)
...This step needs to be done for the AX8000 drives only
Copy the Drive Manager 2 setup g:\design\TwinCAT3\TE5950-TC3-Drive-Manager-2.zip to Install Files or the desktop on the PC running Visual Studio
Close Visual Studio if it is open
Extract the Zip File
Run the Setup File
Delete the setup zip file and unzipped directory to save hard drive space
Étape 4 - Start a new project
Open Visual Studio
Click on New project
Choose TwinCAT projects->TwinCAT XAE Project (xml format)
Name is build number (no Suffix)
Location is c:\TwinCAT\Stuga\
Untick "Create Directory for solution"
This may take some time - a long delay sometimes "Rebuilding Device Description Cache"
...This creates an empty template to build your project for the machine
Étape 5 - Clone the Repository
...A Repositiory or "Repo" is a storage area for the source code versioning system. In our case we use an online system called "bitbucket"
Open Team Explorer
Clone a new Git Repository
URL to clone: https://bitbucket.org/StugaMachinery/tc3Multi
Click on the destination setup
Create a new folder under the machine build folder called "source"
Click 'Clone'
Étape 6 - Enter Git Credentials (if required)
Atlassian Username is StugaMachinery
Password is stored in the file
G:\IT Department\SourceTree BitBucket App Password.txt
...Sometimes, the password credentials are already stored and the password entry is not necessary
Étape 7 - Add The tc3Multi then PLC_Reset Project
Right click PLC
Select Add Existing Item
Navigate to the repository you have created in Step 6 c:\TwinCAT\Stuga\BuildNo\source\tc3Multi\tc3Multi.plcproj
Repeat for the PLC_Reset project
Étape 8 - Check PLC Ports 851 and 852 correct
Check that
tcMulti - Port 851
PLC_Reset - Port 852
If not you can change the port assignment by right clicking the PLC project - you will need to change one to a "spare" port 853 first
Navigate to tcMulti project->POUs->MAIN
Scroll down to the machine types. The "comment State" can be toggled on and off by right clicking next to the step number on the left
Your goal is to ensure the correct machine is highlighted and the incorrect ones are commented out (in green)
Click Save All
...Check the date next to the machine types - you will want the latest one
Étape 10 - Add TwinSAFE project
...From Z071 there is no twinSAFE project as the Estop circuit is hard wired
Étape 11 - Add the route to the Target System
If the front and back end PLCs are the same, the Target System is <Local>
If this is a separate Front End PC
From Dropdown box select the Build number (If it does not exist we will need to add a new route)
If there is a request for a platform change, click Yes
On success, the Route dropdown will not read Error
Étape 12 - Scan for Devices
Expand IO
Right click on devices, Scan
Click OK on the Hint:
Untick RT-Ethernet
Untick COM-Port
Just have the EtherCAT ports
Scan for boxes - Yes
If there is a request for New Device Type, Click Apply to All, Click Yes
If the scan does not work, a potential root casue could be missing EtherCAT drivers for the network adapter. See Updating Realtime Drivers for EtherCAT
Étape 13 - Check EtherCAT validity
Check the Devices and boxes match the expected EtherCAT setup
...Check the green lights on the etherCAT boxes for connection status. Flickering Green means it is OK
Repeat steps 7 and 8 until the physical network matches the scanned network
You may need to Right Click->scan Boxes on the second device if the EtherCAT boxes do not appear
...If the boxes do not appear in the right order, there could be an EtherCAT In /Out crossover
Étape 14 - Name all EtherCAT devices according to network
...Do not start this step until the EtherCAT network is fully verified. You will waste a lot of time if you ignore this!
Click twice on each device (not double click) to enable the device to be renamed
rename to convention
Étape 15 - Map all IO References
Using the circuit diagrams, map all the IO ref numbers to the associated IO channels
Double click a field-bus box or slice
Ensure you can see the input / Output list (may need some screen resizing
Double click an IO channel
Enter the number in the search box
Double click the associated IO Ref number from ibInputArray(inputs) or qbOutputArray(outputs)
...Click Save All regularly so you do not loose progress, as this process can take a considerable time
...Be very vigilant and ensure you only click on ibInputArray or qbOutputArray
Repeat for all IO
Étape 16 - Map Analogue Input references
Length and width sensors need to be mapped to their relevant EtherCAT boxes
Width Sensor on Machining centre is iAnalogueInputArray[0]
Length Sensor on Infeed table is iAnalogueInputArray[1]
Étape 17 - Double check all IO references with someone else
Any mistakes made will save hours if spotted here
Étape 18 - Install Drive Manager 2 Project
Note which Device number has the drive in it
Left-click on FILE. A new context menu open
Move the mouse to Add.
Left-click on New Project .
Select TwinCAT Drive manager 2 on left
Click on TwinCAT Drive manager 2 Project on right
Save with filename "[BuildNo] Drive Manager" in the folder for the project (c:\TwinCAT\Stuga\[BuildNo])
EtherCAT master will be the device that has the drive in from Step 1
Leave the basic settings, click OK
This should link up the drives set in previous steps to a Drive Manager project
Étape 19 - Add Axis Task
A smooth setup will have detected the axes and added them under the MOTION tab already.
if not, an axis task may need to be added under the MOTION tree:
Add New Item
NC/PTP Configuration
Leave the Name as default
Étape 20 - Add Axes
...This step may not be necessary if the Device scan added them automatically
If the axes do not exist under MOTION->NC Task->Axes, add them
Right Click Add axis
Name to convention nn Axis
Repeat for each axis on machine
Axis naming and configuration for different machines can be found here
Étape 21 - Map Axes
...This step may not be necessary if the Device scan added them automatically
Double click an axis
Settings tab
Click Link To IO
Connect to associated Drive
Click Link to PLC
Use the reference here to get the Axis Numbers
Repeat for each axis
...Make sure you select the correct channel number / letter is it is a dual drive
Étape 22 - Add PLC_Reset to tc3Multi Link
...An output from tcMulti needs to be set up to an input on PLC reset to allow the PLC to reset itself. This is linke a physical wire between two PLCs but just exists in the software
Expand PLC_Reset Instance to get to ibResetPLC
Double Click ibResetPLC to open the properties
Link to qbResetPLC (this is very far down the list)
Activate configuration
Étape 23 - Activate configuration
en
none
0
Draft
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #
Pas encore enregistré ? Créez un compte pour profiter de toutes les fonctionnalités du service !
Copiez-collez le code ci-dessous à intégrer sur votre page