|
|
Ligne 82 : |
Ligne 82 : |
| {{Tuto Step | | {{Tuto Step |
| |Step_Title=<translate>Add PLC Project for tcMulti</translate> | | |Step_Title=<translate>Add PLC Project for tcMulti</translate> |
− | |Step_Content=<translate></translate> | + | |Step_Content=<translate># Right Click on PLC |
| + | # Add Existing Item |
| + | # Navigate to c:\TwinCAT\Stuga\versionControl\tcMulti\ |
| + | # Select the .plcProj file |
| + | # Select "Use original project location"</translate> |
| |Step_Picture_00=Create_a_TwinCAT_Project_from_Scratch_Annotation_2019-11-20_125825.jpg | | |Step_Picture_00=Create_a_TwinCAT_Project_from_Scratch_Annotation_2019-11-20_125825.jpg |
| |Step_Picture_01=Placing_a_TwinCAT3_Machine_Under_Source_Control_Annotation_2020-01-31_135541.jpg | | |Step_Picture_01=Placing_a_TwinCAT3_Machine_Under_Source_Control_Annotation_2020-01-31_135541.jpg |
Ligne 90 : |
Ligne 94 : |
| {{Tuto Step | | {{Tuto Step |
| |Step_Title=<translate>Add PLC Project for Reset</translate> | | |Step_Title=<translate>Add PLC Project for Reset</translate> |
− | |Step_Content=<translate>#Add Existing Item | + | |Step_Content=<translate># Right Click on PLC |
− | #Navigate to c:\TwinCAT\Stuga\versionControl\PLC_Reset\ | + | # Add Existing Item |
− | #Select the .Plcproj file | + | # Navigate to c:\TwinCAT\Stuga\versionControl\PLC_Reset\ |
− | #Select "Use original project location"{{Warning|...NOTE - This is has changed from previous tutorial}} | + | # Select the .plcProj file |
| + | # Select "Use original project location" |
| | | |
| <br /></translate> | | <br /></translate> |
Ligne 116 : |
Ligne 121 : |
| |Step_Content=<translate><br /> | | |Step_Content=<translate><br /> |
| | | |
− | #Navigate to tcMulti_6_24 project->POUs->MAIN | + | #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 | | #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) | | #Your goal is to ensure the correct machine is highlighted and the incorrect ones are commented out (in green) |
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
..._This version has been updated Jan 2020 to include Sourcetree souurce code version control and new standard directory layouts
...Beckhoff Technical help is available on 01491 410539 option 3
Étape 1 - Install Visual Studio (if required)
...This only applies if you are setting up a Beckhoff C6015 PC, where the same PC is used for the front end and back end (Saws, Routers and Ecolines).
The "CNC" standard PCs used for the front end on Flowlines and ZXs have Visual Studio already installed
- Copy the install file from g:\Design\TwinCAT3\TC31-Full-Setup.3.1.4022.16.exe to the desktop of the Beckhoff PC
- Delete the setup zip file and unzipped directory to save hard drive space
Étape 2 - 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 3 - Install Sourcetree Version control software
Instructions for download are here
Étape 4 - Clone the tc3 Multi Repo
- In Sourcetree, select tc3Multi
- Click Clone
- Change the destination folder to c:\TwinCAT\Stuga\versionControl (Create the directories if you need to)
- Click Clone - this sets up the versionControl folder
...c:\TwinCAT\Stuga\versionControl is the Standard storage location for the source code repository for the plc code. This step prepares the directory for version control
Étape 5 - Pull the Latest tc3Multi PLC code
- Click Pull Arrow
- Leave all checkboxes and click Pull button
- Exit Sourcetree
...This step "pulls" the very latest version of the PLC code from the cloud
Étape 6 - 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 7 - Add PLC Project for tcMulti
- Right Click on PLC
- Add Existing Item
- Navigate to c:\TwinCAT\Stuga\versionControl\tcMulti\
- Select the .plcProj file
- Select "Use original project location"
Étape 8 - Add PLC Project for Reset
- Right Click on PLC
- Add Existing Item
- Navigate to c:\TwinCAT\Stuga\versionControl\PLC_Reset\
- Select the .plcProj file
- Select "Use original project location"
Étape 9 - 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 11 - Add TwinSAFE project
...From Z071 there is no twinSAFE project as the Estop circuit is hard wired
Étape 12 - 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 13 - 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
Étape 14 - 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 15 - 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 16 - 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 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