54

ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

  • Upload
    others

  • View
    30

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

ENGI-6855

Industrial Control And Instrumentation

LABORATORY ASSIGNMENTS

updated on

November 20, 2018

1 LABORATORY ASSIGNMENT

1.1 Introduction

In this lab one will learn how to set up Arduino PLC and program it inte-grating inputs such as push buttons and toggle switches. You will refreshyour knowledge of Ladder Diagrams and latching (seal-in) operation.

1.2 Hardware

Arduino Uno 1USB cable 1NO push button 2LED 1SPDT toggle switch 31/4W resistors

1.3 OpenPLC Server & Arduino

OpenPLC program is intended to emulate a PLC on a PC. This virtualPLC uses the OpenPLC Software Stack to execute IEC 61131-3 programsand reply to MODBUS/TCP requests. Programs can be created using thePLCopen editor and then uploaded to this virtual PLC.

The OpenPLC has di�erent hardware layers to support physical devices.For instance, there is a hardware layer for the Arduino, which makes theOpenPLC controls its IO pins.

1

Page 2: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

1.3.1 TASK

1. Open Arduino IDE and test the connection by uploading a blink testfrom provided examples.

2. Upload the �rmware 'OpenPLC_UNO_fw.ino' and note the pinoutcon�guration in the program's header.

3. In cygwin, start OpenPLC server; the server will be created on port8080. 'cd ~/OpenPLC_v2' and 'node server_win.js'

4. Navigate to 'PCLopen_Editor' folder in C: directory and open the pro-gram by running 'PCLopen Editor.lnk'. Then open 'Hello_World.xml'and generate ST program 'Hello_World.st'

5. Open your favourite web browser and navigate to localhost:8080, andupload 'Hello_World.st'

6. Connect a NO push button to pin #2 and LED to #7. Use the on-board 5VDC and GND and do not forget to apply a pull down 1kresistor at pin #2 to condition the case when the switch is open. Aswell, do not forget to apply a current limiting resistor of at least 330ohms to the LED circuit.

7. Demonstrate to your TA. Then change the ST program to 5sec(5000ms) TOFF delay and demonstrate to your TA.

8. Analyze the ST �le and provide some explanation of the code.

1.4 Room Light Control

1.4.1 TASK [10%]

Wire a single toggle switch to control the LED without using Arduino/PLC.Note you do not need to use pull down/up resistors but you still need acurrent limiting resistor for the LED (~330 ohms)

Provide schematics of the circuit.

1.4.2 TASK [10%]

Wire a pair of toggle switches to control the LED without using Ar-duino/PLC. This simulates a room light control with two wall switches.

Provide schematics of the circuit.DEMONSTRATE to your TA!

2

Page 3: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

1.4.3 TASK [10%]

Interface a single toggle switch to Arduino and control the LED. Note you donot need to use a pull down resistor as you did in the case of NO push button;simply connect NO contact to +5V and NC contact to ground reference.

Provide the interface schematics and the Ladder Diagram from thePLCopen Editor.

1.4.4 TASK [10%]

Interface two toggle switches and control the LED to simulate a room lightcontrol with two wall switches.

Provide the interface schematics and the Ladder Diagram from thePLCopen Editor.

1.4.5 TASK [10%]

Interface three toggle switches and control the LED to simulate a room lightcontrol with three wall switches.

Provide the interface schematics and the Ladder Diagram from thePLCopen Editor.

Also provide a truth table of three inputs and one output.DEMONSTRATE to your TA!

1.5 Boolean Logic

A simple combinational logic can be implemented using wiring the inputswitches (sensors) a certain way. Parallel combination represents OR func-tion whereas Series combination represents AND function.

1.5.1 TASK [10%]

Wire two NO push buttons in AND and OR combination to control theLED. DO NOT use the Arduino/PLC!

Provide schematics of both circuits and a truth table for both.

1.5.2 TASK [10%]

Now interface the two push buttons and the LED to your Arduino. Replicatethe AND and OR function using the Ladder Diagram programming. Noteyou need to use the pull down resistors this time!

3

Page 4: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Provide schematics of the I/O interface to the board, the LD program foreach function and the truth tables. Do they match the above truth tables?

1.5.3 TASK [10%]

Reprogram the previous task to implement the following functions:NOT(X) AND YNOT(X) OR YProvide the LD program for both and the corresponding truth tables.

What will need to change if we use a NC push button for X if we want topreserve the function?

1.5.4 TASK [10%]

Reprogram to implement the following functions:NOT( NOT(X) AND NOT(Y))NOT( NOT(X) OR NOT(Y))Provide the LD program for both and the corresponding truth tables.

Compare the truth tables with ones for AND and OR function, comment onany similarities.

1.5.5 TASK [10%]

Finally program a latching function that follows this Boolean equation:OUT = (OUT OR X) AND NOT(Y)Demonstrate to your TA's.

1.6 Conclude your report

4

Page 5: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

2 LABORATORY ASSIGNMENT

2.1 Introduction

This lab covers the fundamentals of timers and state based design. Timersare frequently used in process industries as well as objects of daily use suchas ovens, washers, dryers etc. We will use two timers, ON Delay (TON) andOFF Delay (TOF). At the end, the basic latching circuit will be made 'childproof' to prevent accidental startup of an equipment by a 'curious monkey'.

2.2 Hardware

Arduino Uno 1USB cable 1NO push button 2LED 11/4W resistors

2.3 History of a Timer Switch

Combining a clock with a switch can enable a large variety of time controlledsystems. Lighthouses often used a long vertical well to enable the weight runmirror spinner, based on the escapement mechanism of a clock. When theweight reached the bottom, a switch was thrown to indicate the lighthousekeeper to windup the system again.

Combining a regular clock with a switch was revolutionary but not ofmuch use until an automatically windup clocks were introduced. The me-chanical clock based timers operated with minimum delays of several seconds,were bulky and some did not last long due to mechanical wear.

Active components such as op amps and semiconductors in general en-abled timers to realize a range of delays from sub-second to hours or daysin one tiny device. PLC's implement the delays in software and are moreversatile in programming complex timing algorithms.

2.4 On Delay (TON) timer:

On-delay timer will wait after being energized before closing its NO contacts.When the timer is de-energized, the contacts return to their normal state.

5

Page 6: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

2.4.1 TASK [10%]

Interface a single push button to Arduino PLC with LED as output andintroduce a TON timer preset to 2 seconds. Provide the ladder diagram.

� Push the button for 5 seconds and then release. Use oscilloscope toacquire input-output timing diagram (single shot mode). Attach tothe report.

� Push and quick release the button (< 1 sec). Use oscilloscope to acquireinput-output timing diagram and attach to the report.

2.5 O� Delay (TOF) timer

O�-delay timer provides a time delay when de-energized. For example, a 5sec o�-delay timer would close its NO contacts immediately when energized,however after being de-energized, the NO contacts would remain closed for5 more seconds before returning to their normal state.

2.5.1 TASK [10%]

Change the timer to TOF preset to 3 seconds, provide LD program.

� Push and quick release the button (< 1 sec) and acquire the timingdiagram. Attach scope screen.

� Push-release-push the button in a rapid sequence (< 1 sec) and acquirethe timing diagram. Attach scope screen.

2.6 Automatic Irrigation System

Two timers can be cascaded in a loop to implement one period with outputturned ON and another period with output turned OFF. For example, agreenhouse can be automatically irrigated for 2 minutes every hour. Thereare two ways to tackle this problem: one can preset the two timers to 2minand 60min, or to 2min and 58min.

2.6.1 TASK [10%]

Design an automatic irrigation system that turns on for 2 seconds and stayso� for 5 seconds. Preset one timer to 2 seconds and the other to 5 seconds.Provide LD and a scope log.

6

Page 7: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

2.6.2 TASK [10%]

Re-design the previous system by presetting one timer to 2 seconds and theother to 7 seconds. Provide LD and a scope log.

2.7 Safe Operation of an Equipment I.

Many manufacturing processes can be dangerous to an operator and caremust be taken when designing the control of such systems. For example,a hydraulic press system prevents accidental hand injury by 'locking' bothhands on two separate switches in an enclosed well. Additional light curtaincan also be installed.

Often the two switches must be acted on simultaneously which requiresa timer as no two physical systems can occur truly at the same time. Thereis always one switch that is thrown earlier than the other. Therefore, thesimultaneous action here is understood as the two events occurring within aspeci�c time frame, say 200 milliseconds.

2.7.1 TASK [10%]

Design a START-STOP control of a press equipment using two push but-tons (momentary switches). The equipment starts to operate only when thetwo switches are pressed 'simultaneously' and keeps running as long as theswitches are held pressed, i.e. as soon as one switch is released the equipmentstops immediately.

Design the problem using a State Diagram. The two switches are yourinputs, and the motor ON/OFF your output. Describe your states and alltransitions.

2.7.2 TASK [10%]

Convert the state diagram above into state equations.

2.7.3 TASK [10%]

Program the control problem by using the state equations above. List LD.DEMONSTRATE the function to TA's.

7

Page 8: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

2.8 Safe Operation of an Equipment II.

There are many other ways how to operate an equipment safely. Even anexisting system that uses only two switches, one for starting and the otherone for stopping the equipment, can be made more secure by programming atime-sequential code on the START switch. Only the START operation canbe adapted this way! NEVER introduce a code for the STOP operation!!!

2.8.1 TASK [10%]

Design a START-STOP control of a table saw using two push buttons (mo-mentary switches). To start the operation, press START twice in a rapidsequence (<0.5s). To turn o� the saw, press STOP.

Design the problem using a State Diagram. The two switches are yourinputs, and the motor ON/OFF your output. Describe your states and alltransitions.

2.8.2 TASK [10%]

Convert the state diagram above into state equations.

2.8.3 TASK [10%]

Program the control problem by using the state equations above. List LD.DEMONSTRATE the function to TA's.

2.9 Conclude your report

8

Page 9: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

3 LABORATORY ASSIGNMENT

3.1 Introduction

The previous lab introduced the concepts of state based design which wasthen implemented in ladder logic. There is a better way to implement thestate diagrams in PLC software by using Sequential Function Charts (SFC).SFCs mimic closely state diagrams and are thus much easier to debug andmaintain. This is the main objective of this lab to practice SFCs and applythem to the problems from the last lab.

3.2 Hardware

Arduino Uno 1USB cable 1NO push button 2LED 11/4W resistors

3.3 SFC Introduction

An SFC consist of Steps (including the initial step) represented by boxesand transitions represented by links between the steps. The transition linkmay bear a crossbar symbol that represents conditions that have to be metto advance from one step to another.

3.3.1 TASK [10%] Light Control

Program Arduino PLC to control a single light (LED) by a single switch(NO push button). Make sure the con�guration is properly set; refer to thetwo screen captures below.

3.3.2 TASK [10%] Timed Light Control

Re-design the previous problem to keep the light ON for additional 2 sec-onds after the push button is released. There is a number of ways one canintroduce timers to SFCs. We haven't learned about combining SFC andLD yet, so we will use a small trick today.

Refer to the screen capture below. Introduce a new variable T1 anddeclare it as TIME as there is no TOF/TON available in the pull down menu.(In Ladder Diagram, the proper declaration of timers was automaticallyinserted when dragging the timer box on the programming canvas.)

9

Page 10: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 1: SFC for Light Control

Modify the inline code in Step1 and the transition from Step1 to Step0as shown in the image below. Compile to ST �le but DO NOT RUN YET!You have to edit the ST �le by changing TIME declaration to TOF. Thenrun the code and DEMONSTRATE to TA's.

VAR

switch AT %IX0.0 : BOOL;

led AT %QX0.0 : BOOL;

END_VAR

VAR

T1 : TOF;

END_VAR

3.4 Safe Operation of an Equipment I.

3.4.1 TASK [40%]

Re-design the START-STOP control of a press equipment using the twopush buttons (momentary switches). The equipment starts to operate onlywhen the two switches are pressed 'simultaneously' and keeps running aslong as the switches are held pressed, i.e. as soon as one switch is releasedthe equipment stops immediately. To implement the simultaneous function,use a timer preset to 500ms.

10

Page 11: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 2: Con�g for Light Control

Redraw your state diagram and implement it in SFC. DEMONSTRATEthe function to TA's and include your SFC in the report.

3.5 Safe Operation of an Equipment II.

3.5.1 TASK [40%]

Re-design the START-STOP control of a table saw using two push buttons,i.e. START and STOP momentary switches. To start the operation, pressSTART twice in a rapid sequence (<0.5s). To turn o� the saw, press STOP.

Redraw your state diagram and implement it in SFC. DEMONSTRATEthe function to TA's and include your SFC in the report.

NOTE: In SFC, a timer initiated in one step is reset upon a transition toanother step. Try to log the intermediate timer count, which you use wheninitiating a second timer.

3.6 Conclude your report

11

Page 12: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 3: SFC for Timed Light Control

12

Page 13: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

4 LABORATORY ASSIGNMENT

4.1 Introduction

This lab starts using a conveyor belt system that can simulate many appli-cations such as automatic door or bottle �lling line. You will learn how touse counters and how to generate a sequence of pulses to control a steppermotor.

4.2 Hardware

Arduino Uno 1USB cable 1OTEX Process Model 1power supply 1DB25 LPT cable 1DB25 breakout terminal 1jump-wires N

4.3 Counter - Introduction

There are two standard functions available in LD programming, up-counterand down-counter. The up-counter can be used to signal when a count hasreached a preset value. There are three inputs: CU represents the main pulseinput and only considers its raising edge to advance the counter, R representsthe reset input, and PV stands for preset value (INT). The Q output is sethigh when (CV==PV) and can be actually used to reset the counter itself.The CV is the actual value of the counter (INT). Below declaration showsthe up-counter block input and output data type. The down counter followssimilar principles.

(BOOL:CU, BOOL:R, INT:PV) => (BOOL:Q, INT:CV)

4.3.1 TASK OTEX Board Test

Test both push buttons and all four LED's on board. Implement the follow-ing program (use a block copy function to speed up your development). DONOT USE THE 'GND' PIN, use #25 pin for ground reference instead!

Demonstrate to your TA's, they will also record the serial number of yourOTEX board. Explain what function was just implemented.

13

Page 14: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 4: OTEX board test

4.3.2 TASK [10%] Up-Counter Test

Re-design the previous program to set the LED output when the counterreaches number 2 and then resets itself (plus the LED) when the counterreaches number 4.

Modify the program to use the CT.Q output variable directly to resetitself. List the program.

4.3.3 TASK [10%] LEDs cycling

Alter the previous program to cycle the four LEDs in clock wise directionaccording to the listing below.

How would you modify the program to change the direction to counter-clockwise?

4.3.4 TASK [10%] Timer - Counter Combination 1

Modify the previous program to cycle the four LEDs in clock wise directionevery 0.1 second. Note the timer resetting is using an intermediate variablewhich is updated at the end of program! Provide scope trace for two LED's.

14

Page 15: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 5: Up-Counter Use

4.3.5 TASK [10%] Timer - Counter Combination 2

Extend the program so it latches the LED cycling in CW direction whenyellow PB is acted on and in CCW direction when red PB is acted on.Provide the program and demonstrate to TA's.

4.3.6 TASK [10%] Timer - Counter Combination 3

Finally modify the above program to rotate the LED's in the following fash-ion: 1, 1-2, 2, 2-3, 3, 3-4, 4, 4-1 and so on. Provide the program anddemonstrate to TA's.

4.4 Stepper Motor

4.4.1 TASK [10%] Stepper Motor Control

In Hardware, make these connections before you start programming:

15

Page 16: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Arduino Parallel Port terminals function

#7 #2 stepper#8 #4 stepper#12 #3 stepper#13 #5 stepperGND #25 GND#2 #10 push button#3 #11 push button#4 #12 limit sensor#5 #13 limit sensor

Upload 'stepper_full.xml' 9 and test the ST code on your board. Youshould have the motor running and the belt moving. Make sure the outputsare con�gured the way shown in the table below:

A1 local bool %QX0.0A2 local bool %QX0.1A3 local bool %QX0.2A4 local bool %QX0.3

Analyze the code and draw the timing diagram for four stepper lines.

4.4.2 TASK [10%] Reversible Mode

Select the stepper mode you �nd more e�cient and modify its programto allow Clockwise and Counter Clockwise direction. Use one of the pushbuttons to move in CW direction and the other to move in CCW direction.Demonstrate to your TA's, list the code.

4.5 Photoelectric Sensor

4.5.1 TASK [10%] Oscillating Belt

Program an application of �at bed grinder where the workpiece moves left-right constantly. Position a mark/sticker on the belt in between the twolimit sensors and move the mark in between. Demonstrate to your TA's.

4.5.2 TASK [20%] Automatic Door Control

Program a control system to operate a shop sliding door using the belt-conveyor system. Here is the description:

16

Page 17: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

� To open the sliding door, a �oor mat switch on either side must beacted on; if not engaged, the door will close after 5 seconds.

� The mark on the belt will simulate the door travelling between twolimit sensors.

� After expiration of the time delay, door closing latches until the�CLOSED� position is reached.

� If the �oor mat switch is acted on again while the door closes, doorimmediately opens again.

Provide the code and demonstrate to TA's.

4.6 Conclude your report

17

Page 18: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

5 LABORATORY ASSIGNMENT

5.1 Introduction

This lab follows up the previous two labs and employs again the conveyorbelt system. Last week a complete process simulating an automatic door wasdeveloped in Ladder Diagram. Everyone would agree that the complexity ofthis approach was di�cult to deal with and maintain. Correspondingly theTA's including the instructor were often puzzled by your control algorithm.We can do better than that.

The objective of this lab is two fold. A new programming language,Function Block Diagram (FBD), is practised alongside of prototyping own'subroutines' to hide the complexity into the background. The unifying codewill be in FBD whereas the subroutines will be implemented in SFC thatwill result in a highly 'readable' code.

5.2 Hardware

Arduino Uno 1USB cable 1OTEX Process Model 1power supply 1DB25 LPT cable 1DB25 breakout terminal 1jump-wires N

5.3 FBD

FBD programming approach is nothing new since we already used snippetsin your previous LD programs such as timer blocks, counter blocks, set-reset�ip-�ops etc. Basically the LD's contacts will be represented by (input)variables in FBD, and LD's output coils will be represented by (output)variables.

5.3.1 TASK [10%] FBD programming

In Hardware, make these connections before you start programming:

18

Page 19: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Arduino Parallel Port terminals function

#7 #6 led0#8 #7 led1#12 #8 led2#13 #9 led3GND #25 GND#2 #10 push button#3 #11 push button#4 #12 limit sensor#5 #13 limit sensor

Load the Hello_World.xml into your PLC editor and delete 'My_Program'.Recreate the Program 'My_Program', however, select the FBD language thistime. Note, if you name your program di�erently you have to visit the taskcon�guration and select the right program type under Instances.

Simply connect two local variables linked to inputs %IX0.0 (Yellow PushButton) and %IX0.1 (Red Push Button) to another local variable linked tooutput %QX0.0 (LED0) via AND function.

Run the code and provide the FBD program with the variable declarationtable.

5.3.2 TASK [10%] FBD and SFC programming

Modify the FBD program, however, �rst prototype the subrutine - SFCfunction block. Create a FUNCTION BLOCK that will be implemented inSFC according to the screenshot in 10 and fuse it with the FBD program asshown in 11

While having the FBD program highlighted, create a new 'FunctionBlock' and select the SFC language (large 'plus' sign in the bottom rightcorner).

De�ne all Input, Output and other local variables as needed. In theaction boxes associated with some steps (states), use [S] for setting and [R]for resetting a [Variable].

Test the code and explain what function was implemented. Discuss theadvantage of using the FBD/SFC code with reference to implementing thesame function in FBD language only.

5.3.3 TASK [10%] FBD/SFC programming with a Timer

SFC's transitions often rely on using timers. We did an experiment on safestarting of an equipment in Lab 4 which used the timer concept embedded in

19

Page 20: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

SFC. We will use a slightly di�erent approach this time which is illustratedin two screenshots, 12 and 13.

Test the code and explain what function was implemented. Discuss theadvantage of programming the timer outside of the SFC code with referenceto Lab 4.

5.4 Stepper Motor implementation in SFC

Stepper Motor was the part of your LD code which made your code highlyhard to read and non-transparent in Lab 6. By doing the experiment below,implementing it in SFC will simplify the code signi�cantly. First test iton the LED's, later you will rewire the connections to control the StepperMotor.

5.4.1 TASK [10%] FBD/SFC Stepper Motor Algorithm Test us-ing LED's

We are going to demonstrate the stepper motor sequence programming byblinking the four LED's. Note, in order to demonstrate the sequence slowly,the cycle time is reduced from T#50ms to T#200ms as shown in 14. Theother two screenshots in 15 and 16 illustrate the FBD and SFC code respec-tively.

Test the code and explain what function was implemented. Compare toyour Lab 6 code and discuss the advantages besides the simplicity.

5.5 Application Programming

5.5.1 TASK [50%] FBD/SFC, Timer, Stepper Motor - AutomaticDoor Control

Reprogram the Lab 6 Shop Sliding Door application using the above conceptsof FBD/SFC, Timer and the Stepper Motor Demo.

In Hardware, make these connections before you start programming:

20

Page 21: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Arduino Parallel Port terminals function

#7 #2 stepper#8 #4 stepper#12 #3 stepper#13 #5 stepperGND #25 GND#2 #10 push button#3 #11 push button#4 #12 limit sensor#5 #13 limit sensor

Provide the FBD/SFC code and demonstrate to TA's!

5.6 [10%] Conclude your report

21

Page 22: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

6 LABORATORY ASSIGNMENT

6.1 Introduction

Continuous control is a preferred type of control in many industrial processes.PLC's, although predominantly used in ON-OFF (logic) type control, canalso be used in continuous control and instrumentation. We will study athermal process using a power resistor (heater) and IC temperature sensor.

6.2 Hardware

Arduino Uno 1USB cable 110ohm 5W power resistor 1TMP36G temp sensor 1TIP121 NPN power transistor 11k resistor 1quad op amp IC 1jump-wires N

6.3 Analog Output

Analog output is via PWM on Arduino Pins #9 (%QW0.0), #10 (%QW0.1)and #11 (%QW0.2). Note you have to declare the output variable as UINT,unsigned integer (0~65535).

6.3.1 TASK [10%] Analog Output Test

Load the Hello_World.xml into your PLC editor and modify 'My_Program'in the language of your choice to cycle the output variable linked to #9(%QW0.0) through 0~65535.

Create a table showing the mean value (scope derived) and % duty cyclefor each increment by 5000, i.e. 0, 5000, . . . , 65000.

6.4 Analog Input

Analog inputs are located on Arduino Pins #A0~#A5 (%IW0.0~%IW0.5)and accept voltages between 0.0V and 5.0V. The voltage corresponding valueis mapped to UINT variable so that 0.0V corresponds to 0 and 5.0V corre-sponds to 65535.

22

Page 23: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

6.4.1 TASK [10%] Analog Input

Create a program to map input at #A0 (%IW0.0) to the output #9(%QW0.0).

Use power supply and vary the input between 0 and 5.0 volts (DO NOTEXCEED 5.0V!!! TEST THE POWER SUPPLY OUTPUT FIRST BE-FORE CONNECTING TO ARDUINO!)

Create a table for inputs 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 Volts and correspondingPWM duty cycle.

6.5 Thermal Process

A simple thermal process is developed in order to test the control algorithmin the next lab. A temperature sensor (TMP36G) is strapped to a 10 Ohmpower resistor that serves as a heater. The current through the power resistoris controlled by a power transistor TIP 121 (NPN).

6.5.1 TASK [10%] Thermal Process Validation

Consult the lecture notes and wire the NPN transistor in the power resistorcircuit. The resistor will be powered by 5.0VDC having the power supply setto limit the current to 0.3A. As well, limit the BASE current by 1k resistor.

Consult the data sheet for the temperature sensor and power the sensoralso by 5.0VDC.

A) Measure the sensor's output at ambient temperature by a voltmeter.B) Create a program to output 50% duty cycle. From the power supply

display, read the current and voltage.C) Record the temperature sensor's output voltage every 30 seconds until

a steady state temperature is reached. Using the conversion formulae fromthe data sheet, convert the voltages to temperature. Tabulate and plot thedata!

6.6 O�set and Span Adjustment

6.6.1 TASK [10%]

Based on the lecture notes, design O�set and Span (Gain) circuit using anop amp to scale the measured range of temperatures into 1.0~4.0V range.

23

Page 24: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

6.6.2 TASK [10%] Process Variable - Measurement

Implement the O&S circuit and validate your design. Input 750mV andrecord the output which shall be near 1.0V. Then input 1000mV and recordthe output which shall be near 4.0V. In case of any mismatch, re-tune yourO&S circuit. Fill the table below based on your measurements.

X: TMP36G output (O&S input) [mV] Y: O&S output [V] Temp [C] INTEGER VALUE

750 25800 30850 35900 40950 451000 50

6.7 Conclude your report

24

Page 25: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

7 LABORATORY ASSIGNMENT

7.1 Introduction

The thermal process from the previous lab will be controlled continuouslyusing Ziegler-Nichols tuning method. As the thermal process is rather slow,the open loop "reaction curve" method is selected instead of the simplerclosed loop method. Finally the control e�ciency is analyzed in terms ofrise time, settling time and overshoot.

7.2 Hardware

Arduino Uno 1USB cable 110ohm 5W power resistor 1TMP36G temp sensor 1TIP121 NPN power transistor 11k resistor 1quad op amp IC 1jump-wires N

7.3 Ziegler Nichols Introduction

The Ziegler-Nichols tuning methods aim for a quarter-amplitude dampingresponse. The open-loop tuning rules use three process characteristics: pro-cess gain, dead time, and time constant. These are determined by doing astep test and analyzing the results. Refer to the �gure 17. More informationcan be found at http://blog.opticontrols.com/archives/477

7.3.1 TASK [20%] Process Gain

Develop a PLC program to drive the heater at 10% PWM and once thetemperature is settled, change the Manipulated Variable to 50% PWM bypressing a push button (latching circuit). Provide the program printout(FBD, LD, or SFC).

Set the oscilloscope back to X-T and Y-T mode, connect the push buttonsignal to X channel and the O&S circuit output to Y channel.

Once settled at controller output (CO) of 10% PWM initiate the changeto 50% PWM by pressing the push button and wait for the Process Variable(PV) to settle out at a new value. Record the process reaction curve fromthe oscilloscope.

25

Page 26: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Calculate the process gain (G) as follows:G = {change in PV [INTEGER VALUE / UINT]} / {change in CO

[INTEGER VALUE / UINT]}

7.3.2 TASK [10%] Dead Time

Find the maximum slope on the PV response curve, refer to the �gure 17.This will be at the in�ection point (where the PV stops curving upward andbegins curving downward). Draw a line tangential to the PV response curvethrough the point of in�ection. Extend this line to intersect with the originallevel of the PV (before the step-change in CO). Take note of the time valueat this intersection.

Measure the dead time (td) as follows:td = time between the step-change in CO and the intersection described

above

7.3.3 TASK [10%] Time Constant

Calculate the value of the PV at 63% of its total change. On the PV reactioncurve, �nd the time value at which the PV reaches this level.

Measure the time constant (tau) as follows:tau = time between the end of dead time and the PV reaching 63% of

its total change

7.3.4 TASK [20%] Control Variable measurement

In order to convert the %PWM signal to voltage we need to use a low pass�lter (LPF) of gain one and corner frequency three decades below the PWMfrequency. This will provide a ripple 10−3 in magnitude with reference tothe original PWM signal magnitude, i.e. 5V * 0.001 = 5mV.

Document your RC �lter design. Test your �lter output at 0, 25%, 50%and 100% PWM, use push button to cycle through the PWM setting. Fillthe table below:

% PWM LPF output [V]

0255075100

26

Page 27: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

7.3.5 TASK [20%] P controller

Calculate settings for Controller Gain (Kc) using the Ziegler-Nichols tuningrules below.

For P control: Kc = tau / (G * td)Program your PLC to start the proportional controller upon pressing

a push button and using a setpoint of 45C (INTEGER equivalent). Listthe program (FBD, LD, or SFC). Note when the error becomes negative wecannot switch to a cooling actuator. Provide a limiter to turn any negativeerror to zero control output, 0%PWM. FBD example is shown in Figure 18.

Use oscilloscope to record the PWM signal (Voltage equivalent after LPF)and the temperature at O&S output. Provide the scope trace.

7.3.6 TASK [20%] Performance Analysis

Analyze the controller performance by extracting the Rise Time, SettlingTime, and % Over Shoot (tr, ts, %os). Cool down your thermal system tothe ambient temperature and increase the proportional gain twice the valueof previous gain (Kc' = 2 * Kc). Run the control loop the same way as aboveand extract new performance parameters tr', ts', %os'. Finally conduct thesame experiment for (Kc� = Kc / 2).

Provide the scope trace for the controlled variable in %PWM and andthe temperature as above for all three cases. Make sure the scope setting issame in all three runs. Compare the results.

7.4 Conclude your report

27

Page 28: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

8 LABORATORY ASSIGNMENT

8.1 Introduction

This lab introduces using FEM analysis in capacitive sensor design. Theobjective is to generate a calibration characteristic for two di�erent designsof capacitive micrometer / proximity meter.

8.2 Software

Ansoft Maxwell SV

8.3 Design A

8.3.1 TASK [30%] FEM Simulation

Implement Axi-Symmetrical model of proximity meter (R-Z coordinates)that has two round electrodes (copper discs) separated by air (vacuum).Use micrometer units and draw the model having both electrodes the radiusof 80um.

Simulate for capacitance at 1:1:10um spacing (10 data points). Plot thecapacitance data against the spacing parameter, and include the convergencereport for one spacing of your choice. Also include a plot of the electric �eldaround the electrode perimeter.

8.3.2 TASK [20%] Analytical Analysis

Derive analytically the capacitance and plot your data into the above graphagain.

8.4 Design B

8.4.1 TASK [30%] FEM Simulation

Implement Axi-Symmetrical model of a modi�ed proximity meter (R-Z co-ordinates) that has three electrodes separated by air (vacuum). Use microm-eter units and draw a model with these parameters:

� The signal is applied to inner disc electrode having the radii of 80um.

� A 10um wide shield ring electrode is in the same plane as the signalelectrode with a 1um gap between the two electrodes. This electrodeis grounded.

28

Page 29: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

� The other side electrode (also grounded) has 90um radius.

Simulate for capacitance at 1:1:10um spacing (10 data points). Plot thecapacitance data against the spacing parameter, and include the convergencereport for one spacing of your choice. Also include a plot of the electric �eldaround the signal electrode perimeter.

8.4.2 TASK [10%] Linearity Analysis

Plot the inverse capacitance against the spacing for Design A and Design B.Fit a linear characteristic by Least Squares and calculate the RMS error ofrepresenting the data by the linear regression. Plot the linear regression inthe same graph. Discuss the results.

8.4.3 TASK [10%] Di�erential Sensor

The air dielectric parameter varies with humidity, temperature and atmo-spheric pressure. Propose a design based on di�erential principle that willeither eliminate or suppress these e�ects.

Include a signal conditioning circuit for the di�erential sensor.

8.5 Conclude your report

29

Page 30: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

9 LABORATORY ASSIGNMENT

9.1 Introduction

This lab covers FEM analysis of Magnetic Actuators operated by DirectCurrent. The objective is to generate a calibration characteristic for twodi�erent designs of the actuators.

9.2 Software

Ansoft Maxwell SV

9.3 Clapper Armature Solenoid of Planar Geometry

Figure 19 shows a planar solenoid with a clapper armature. The stator wind-ing shown has 500 turns and has an end (return) current path (not shown)outside the core. The dimensions are w=15mm, Al1=7.5mm, Al2=45mm,Al3=7.5mm, Sl1=22.5mm, Sl2=45mm, Sl3=22.5mm, and g=2mm.

9.3.1 TASK [20%]

Use the reluctance method, assuming no leakage or fringing �uxes, to �ndthe approximate values of the vectors B and F on left side of clapper forI=2A. Repeat to �nd the vectors B and F on right side of clapper.

9.3.2 TASK [20%]

Obtain the answers with �nite-element software by using high-permeabilitymaterial (relative permeability = 2000) in the steel. Record the force andthe total energy of the system. Repeat the above for the gap varying from2mm to 0.2mm in 0.2mm increments. Tabulate the force and energy andplot the resulting characteristic.

9.3.3 TASK [10%]

Calculate the force from the energy, and plot the resulting characteristicagainst the displacement.

F =∂W

∂y=̇

∆W

∆y

30

Page 31: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

9.4 Clapper Armature Solenoid of Axisymmetric Geometry

Figure 20 shows an axisymmetric solenoid with a clapper armature. Thenumber of turns N=2000 and the current I=1A. The dimensions are g=2 mm,wa=10mm, R1=20mm, R2=30mm, R3=40mm, Z1=10mm, and Z2=30mm.

9.4.1 TASK [20%]

Use the reluctance method, assuming no leakage or fringing �uxes, to �ndthe approximate values of B and F on inside of clapper as well as on outsideof clapper.

9.4.2 TASK [20%]

Obtain the answers with �nite-element software by using high-permeabilitymaterial (relative permeability = 2000) in the steel. Repeat the above for thegap varying from 2mm to 0.2mm in 0.2mm. Plot the resulting characteristic.

9.4.3 TASK [10%]

Calculate the force from the energy, and plot the resulting characteristicagainst the displacement.

9.5 Conclude your report

31

Page 32: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 6: LED cycling using PB

32

Page 33: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 7: LED cycling using timer

33

Page 34: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 8: LED cycling using timer

34

Page 35: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 9: Stepper Motor Control - Full Step Mode

35

Page 36: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 10: FBD and SFC programming, SFC part

Figure 11: FBD and SFC programming, FBD part

36

Page 37: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 12: FBD and SFC programming with a Timer, SFC part

Figure 13: FBD and SFC programming with a Timer, FBD part

37

Page 38: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 14: Stepper Motor Demo, Task Con�guration

Figure 15: Stepper Motor Demo, FBD code

38

Page 39: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 16: Stepper Motor Demo, SFC code

Figure 17: Step Test for Z-N Tuning (by Jacques Smuts)

39

Page 40: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 18: P controller FBD program

Figure 19: Clapper Armature Solenoid of Planar Geometry

40

Page 41: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY

Figure 20: Clapper Armature Solenoid of Planar Geometry

41

Page 42: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 43: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 44: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 45: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 46: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 47: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 48: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 49: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 50: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 51: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 52: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 53: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY
Page 54: ENGI-6855 Industrial Control And Instrumentation ...masek/6855_Labs.pdf · ENGI-6855 Industrial Control And Instrumentation LABORATORY ASSIGNMENTS updated on November 20, 2018 1 LABORATORY