Tc3 trainingexercises rc1b

56 1 0
Tc3 trainingexercises rc1b

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

46 NC-PTP Exercise 5: Creating simple PTP Move Program ..... Click File >> Save All PLC Exercise 2: Creating PLC project and Declaring Global Variables Right click on PLC icon, select “A

Trang 1

Contents

PLC Exercise 1: Creating XAE Project and IO Configuration 3

PLC Exercise 2: Creating PLC project and Declaring Global Variables 7

PLC Exercise 3: Linking the Variables and Activate Configuration 9

PLC Exercise 4: Downloading and Running PLC project 11

PLC Exercise 5: Creating Function Block (FB_Blinker) 11

PLC Exercise 5a: Adding a Latching Circuit using Ladder Diagram (Digital) 14

PLC Exercise 6: Creating Function (F_Scale) 15

PLC Exercise 7: Configuring Auto Start of the Control Unit 17

PLC Exercise 8: Working with several Tasks 17

PLC Exercise 9: Troubleshooting PLC program using Scope 20

PLC Exercise 10: Creating Persistent Data 24

PLC Exercise 11: Uploading Source Code 25

PLC Exercise 12: Reading System Date and Time 26

PLC Exercise 13: STRING function (Delete, Concat, Len, Sizeof) 28

PLC Exercise 14: STRUCTURE and EXTEND 29

PLC Exercise 15: ALIAS 30

PLC Exercise 16: ENUMERATION 31

PLC Exercise 17: UNION 32

PLC Exercise 18: ARRAY 34

PLC Exercise 19: CASE statement 35

PLC Exercise 20: FOR loop 36

PLC Exercise 21: Creating a simple Visualisation page 37

NC-PTP Exercise 1: Setting up Stepper Axis (EL7031) 38

NC-PTP Exercise 2: Setting up Servo Axis (EL7201-9014) 41

NC-PTP Exercise 3: Commissioning the Motor with NC 44

NC-PTP Exercise 4: Creating NC Scope to monitor Axis 46

NC-PTP Exercise 5: Creating simple PTP Move Program 48

Trang 2

TwinCAT XAE User Interface

Trang 3

PLC Exercise 1: Creating XAE Project and IO Configuration

Disclaimer: The steps given here serve as an example from using CX5130-0135 from Beckhoff Automation For other Beckhoff PC-based controller, the device interfaces may varies depending on the hardware setup/architecture

the System TaskBar

Select TwinCAT XAE (TcXaeShell)

File >> New >> Project

(XML Format)” template

Enter your desired Project Name Eg Tc3PlcExercise

Explorer

On the General Tab, click on

[Choose Target]

Trang 6

12 Scan I/O Devices

Right click on I/O Devices, select

“Scan”

depending on hardware used

Select “Device1 [EtherCAT]”

only

connected IO boxes (eg

EtherCAT coupler, IO terminals)

Click [YES]

I/O check

Trang 7

17) Now Test all individual I/O points

Digital Input Term2(EL1014) Channel 1 ~ 4, Input Switch S1 ~ S4 Digital Output Term3(EL2014) DIG Outputs, Channel 1 ~ 4, Output LED Lamp H1 ~ 4 Analog Input Term6(EL3102) Channel 1 ~ 2, Value Potentiometer P1, P2 Analog Output Term7(EL4102) Channel 1 ~ 2, Output Voltmeter A1, A2

18) Save the Solution File Click File >> Save All

PLC Exercise 2: Creating PLC project and Declaring Global Variables

Right click on PLC icon, select “Add New Item”

Template”

Enter the name: Plc1

Trang 8

3 Create a Global Variable List (GVLs)

Right click on the GVLs folder, Select Add >> Global Variable

bSwitch1 AT %I*: BOOL; bSwitch2 AT %I*: BOOL; bSwitch3 AT %I*: BOOL; bSwitch4 AT %I*: BOOL;

nResistor1 AT %I*: INT; nResistor2 AT %I*: INT; //Analog Output

nVoltmeter1 AT %Q*: INT; nVoltmeter2 AT %Q*: INT; END_VAR

Declare global variables for I/O Save the Solution file

Click FILE >> Save All

Click Build >> Build Solution

Ensure there’s no error before proceeding to next step

Trang 9

PLC Exercise 3: Linking the Variables and Activate Configuration

Right click on the Channel1 Input of EL1014

select “Change Link”

Refer to the table below for the actual mapping between IO channels and PLC IO vars Tips: Use the “Search” function to filter out relevant IO

variables

Click TWINCAT >> Activate Configuration

Enter the Security code if prompted

Mapping between PLC Variables and I/O process image

bLed1 Term3(EL2014), DIG Output, Channel 1, Output LED H1 bLed2 Term3(EL2014), DIG Output, Channel 2, Output LED H2

Trang 10

Tips 1# An Output byte can be declare and use for linking to 8-ch Output terminal eg EL2008 Note: “All Types” and “Continuous” checkbox is used.

Tips 2# Use “Change Multi-Link ” for efficient Variables linking

Tips 3# Option to possibly create a structure from mapped Process data of a IO terminal

Trang 11

PLC Exercise 4: Downloading and Running PLC project

Click PLC >> Login

Start

monitor the online value Test and check that the IO links are correct

pressing the Push Button Output can be triggered by

“Write Values” in Prepared

Value column

Click PLC >> Logout

PLC Exercise 5: Creating Function Block (FB_Blinker)

under POUs folder Right click on the POUs

folder, select Add >> POU

Trang 12

2 Name: FB_Blinker Type : Function block Implementation Lang: FBD

the network rung

accordingly

Trang 13

5 Create a Program Name: Digital Type : Program

Implementation Lang: FBD

Digital Program using Input Assistant [F2] Optional:

Instantiate fbBlinker2 with a different delay time and

Trang 14

PLC Exercise 5a: Adding a Latching Circuit using Ladder Diagram (Digital)

Logic

Select FBD/LD/IL >> View >> View as Ladder Logic

and “Insert Network”

the Latching Circuit as shown

on the FB_Blinker to bStartBlink

Login and test the program

Trang 15

PLC Exercise 6: Creating Function (F_Scale)

folder

Right click on the POUs folder,

select Add >> POU

Trang 16

4 Create a Program Name: Analog Type : Program

Implementation Lang: ST

Program using Input Assistant

Login to PLC and test F_Scale Optional: set Breakpoint to monitor temporary variable in the function

Tips 1# Breakpoints are generally used for finding errors in the program You can set breakpoints at certain positions in the program in order to force an execution stop there and observe the variable values Take note that all Outputs are turned off when the program has been stopped by breakpoint

Trang 17

PLC Exercise 7: Configuring Auto Start of the Control Unit

System Run Mode

In the Settings tab, check “Run Mode (Enable)” radio button Then, click “Apply” button

make sure that “Autostart Boot Project” is checked Then, “Activate Boot Project”

PLC Exercise 8: Working with several Tasks

select Add >> Referenced Task

Trang 18

2 Create a new task name:

referenced task “FastTask”, select Add >> Existing item Choose the FastProg within the Input Assistance

Trang 19

6 Adjust the Priority and Cycle Ticks

Then “Activate Configuration”

same counter logic

bStartCnt and monitor online the Counter values in both MAIN and FastProg using WatchList

PLC >> Windows >> Watch1

Tips 1# A separate Task is normally used for Communication or Motion or Fast Sampling function

Tips 2# Be careful of multi-task data access synchronization in PLC When the same data is accessed by multiple tasks, the tasks may access the same data simultaneously, depending on the task/realtime configuration If the data is written by at least one of the tasks, the data may have an inconsistent state during or after a change To prevent this, all concurrent accesses must be synchronized so that only one task at a time can access the shared data

Trang 20

PLC Exercise 9: Troubleshooting PLC program using Scope

select Add >> New Project

Wizard” template

Trang 21

4 Choose “Variables”

IO.bSwitch1 IO.bLED1

Analog.fScaledValue …etc

Trang 22

7 Choose “YT Chart”

Trang 23

10 Start Recording

Trang 24

PLC Exercise 10: Creating Persistent Data

Modify the Variable

Declaration for MAIN program

Code the program

program

Start and Stop the counting Remember the last value of nCounter

Switch Off power to Training Kit and wait till PWR Led is off Then, switch On power to Training Kit and wait till TC Led

Trang 25

PLC Exercise 11: Uploading Source Code

solution file, close the solution

file now Click FILE >> Close Solution

To upload the Source code,

click File >> Open >> Open Project From Target

Runtime System

“UploadProj” on Desktop and

[Select Folder]

Trang 26

4 The complete Project has been uploaded

PLC Exercise 12: Reading System Date and Time

Trang 27

Open action “Act_ReadTime” Write the codes

Trang 28

6 Call the action in the MAIN Program

Login PLC and test

ACT_ReadTime by Write Value bEnable to TRUE

Check the ACT_ReadTIme result against the System Time on Windows System Taskbar

PLC Exercise 13: STRING function (Delete, Concat, Len, Sizeof)

Trang 29

PLC Exercise 14: STRUCTURE and EXTEND

Trang 31

Login PLC and check the result Hint: remove ‘strict’ attribute

Trang 33

Login PLC and check the result Write value into the Union Eg 5, 255, 256, 4096

Trang 34

FOR i := LOWER_BOUND(aData,1) TO UPPER_BOUND(aData,1) DO nSum := nSum + aData[i];

Trang 35

6 Build Solution

PLC Login and check the result

PLC Exercise 19: CASE statement

bVar1 := NOT bVar1;

Write the Codes in the action Act_CaseStm

Trang 36

END_VAR

program

PLC Login and check the result by changing the value of nVar

PLC Exercise 20: FOR loop

Trang 37

5 Build Solution

PLC Login and check the result by set nVar1 to 1

nErg result is 32

PLC Exercise 21: Creating a simple Visualisation page

the VISU folder

Visualisation library Check the “Active” button and press [OPEN]

Trang 38

3 From the Toolbox,

Drag-and-Drop the PushSwitch and Lamp symbol into the

NC-PTP Exercise 1: Setting up Stepper Axis (EL7031)

The data given here serve as an example for a stepper motor type AS1010-0000 from Beckhoff Automation running on 24V DC power supply setting For other motors the values may vary, depending on the application

Trang 39

2 Adaptation of current and voltage

Search for EL7031 terminal under I/O Devices

Adapt the motor setting and cannot be changed However, the base frequency

Trang 40

The maximum velocity can be calculated from the base frequency and the motor frequency

Reference Velo.: 3600deg/s Maximum Velo.: 3600deg/s

The dead time compensation

can be adjusted on the Time Compensation tab of

Axis1_ENC

It should theoretically be 3 cycles of the NC cycle time, although in practice 4 cycles are preferable

Therefore, the settings of the

parameters Time

Compensation Mode Encoder

should be ‚ON (with velocity)‘

and Encoder Delay in Cycles

‘4’ frequency 7

Calculation of the scaling factor

with encoder, 4-fold evaluation:

SF = distance per revolution / (increments x 4) = 360° / (1024 x 4) = “Axis1_Enc” and tab “Parameter in the NC The value is calculated with the formulas specified below EL7031 is without encoder The internal counter is use for position feedback

Scaling Factor Numerator: 0.028125

Trang 41

8 Position Lag Monitoring

The position lag monitoring function checks whether the current position lag of an axis has exceed the limit value The position lag is the difference between the set value (control value) and the actual value reported back If the terminal parameters are set inadequately, the position lag monitoring function may report an error when the axis is moved During

commissioning, it may therefore be advisable to increase the limits of the Position lag monitoring slightly

In order to pass through any resonances that may occur as quickly as possible, the ramps for the acceleration time and the deceleration time should

NC-PTP Exercise 2: Setting up Servo Axis (EL7201-9014)

The data given here serve as an example for a servo-motor type AM8111-0F10 from Beckhoff Automation running on 24V DC power supply setting For other motors the values may vary, depending on the application

The EL72x1 Servo Axis is automatically added to Axis_2 during the scan in previous exercise

Several parameters have to be set before the motor can be started up The values can be found in EL72x1 manual

Trang 42

1 Under I/O devices, find the EL72x1-xxx terminal that have been scanned in by the

Parameters”, change Feed Constant to 360 degree Click [Set NC Parameters]

All required parameters are adjusted automatically The setting only becomes active once the configuration is activated

Change the display unit under Settings to degree

Trang 43

5

Reference Velocity = (Motor Max Velo / 60sec) * Distance

Reference Velocity

The maximum permitted velocity is calculated based on the maximum motor speed and the distance

The dead time compensation

can be adjusted on the Time Compensation tab of

Axis2_ENC It should be theoretically be 3 cycles of the NC cycle time, although in practice 4 cycles are preferable

Default setting for EL72x1-xxx is 20 single-turn bits

Trang 44

8 Scaling Output

Enter the value 32 in the Parameter tab for the drive

settings under Output Scaling (Velocity)

Solution File

• Activate Configuration

NC-PTP Exercise 3: Commissioning the Motor with NC

button

Trang 45

3 Press the Function key to manually jog the motor

F9: Home (DO NOT USE!!)

the axis via Functions tab • Select as Reversing

Sequence as the start type

• Enter the required Target Position2, e.g 12000°

• Enter the required Target Velocity, e.g 1200°/s

• Enter the required Target Position1, e.g 0°

• Enter the required Idle Time, e.g 2 s

• Select Start

The motor now turns to pos 2, remains there for 2 sec and return to pos 1 This is

repeated until Stop is pressed

commissioning steps for Axis_2

Optional:

Try out other Start Mode Eg

Trang 46

NC-PTP Exercise 4: Creating NC Scope to monitor Axis

Measurement Project File >> New >> Project

DataPool [Hint: use SHIFT to

Trang 47

3 Go to the Properties Window

Change the Target system to the name of the CX/IPC

Optional:

Try changing the Kv factor and also try changing the

Trang 48

NC-PTP Exercise 5: Creating simple PTP Move Program

Trang 49

4 Select “Tc2_Mc2.lib” Click

Declare the I/O structure variables between NC and PLC

2

Trang 51

Create Instance of MC Function Block and MCOutputs

Write the FB_Axis codes ReadStatus() action updates the type ST_AxisStatus and has to called at the beginning of

“Status” output indicates operational readiness of the axis

Axis has to be ready before executing other MC commands

Trang 52

MC_Stop stops an axis with a defined braking ramp and locks it against other motion position to an absolute target position and monitors the axis movement over the whole travel path

“Done” output is set once the target position has been reached

Trang 53

16 Create a new Data Unit Type

Declare the following variable in the MAIN program

19 fbAxis1( stAxis:= GVL.Axis1); fbTon1(PT:= T#2S);

(* move axis using a state machine *) CASE eState OF

E_MoveState.INIT :

Code the Forward/Reverse Sequence program in the Main

Trang 55

(* axis error requires reset*)

Try adding STOP state to stop the running Axis

online for download

Ngày đăng: 30/03/2024, 14:44

Tài liệu cùng người dùng

Tài liệu liên quan