PLC Programming with RSLogix 5000

PLC Programming with RSLogix 5000

W r r i i t t i i n g t t h e P r r o g r r a m

Ladder View

Open the Controller Organizer, expand the “Tasks” folder, and expand the “Main

Program” folder.

Click on “Main Routine” and you should see this.

Setting Up An Overall Control Rung

Typically, a program will start with some kind of overall or master control rung. This rung will define a bit that must be on for the entire system to operate, and we include bits that we know must be true for the whole system to run.

42

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

In this project, we certainly want the E-Stop to be part of this logic. Our E-Stop (or, emergency stop) pushbutton switch is wired in such a way that the input must be on for the system to operate.

You can add a rung by right-clicking on the rung number and selecting “Add Rung” from the dropdown menu.

You can also press CTRL-R.

We want to use the E-Stop input in this rung. Find the XIC (examine if closed) button in the User menu.

tool

You can insert the instruction in a couple of ways. Simply clicking on the XIC icon will add it to the rung.

You can also click, hold and drag the tool to the spot in the rung where you want it inserted.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

43

Click and drag it toward the new rung you just created. You will see that as you get near the rung, a green dot will appear. Green dots represent possible landing points for your instruction.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

44

Release the mouse button and your screen should look like this.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

45

Press the enter key on your keyboard. A dropdown menu appears above the instruction.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

46

Open the dropdown and your screen now looks like this.

Notice that all the tag groups from our I/O are now showing.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

47

From the I/O list, we see that the E-Stop switch is wired to the last position on the input card, giving it an address of Local:2:I.Data.15. We want to find that tag in this window.

Expand the tag group Local:2:I, then expand the tag group Local:2:I.Data.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

48

Click on bit 15 in the box to assign that address to the instruction.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

49

Click and drag the OTE (output energize) tool button the new rung. Place it on the marker at the right.

from the User menu down to

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

50

The screen looks like this.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

51

Click on the blue box (the tag name field) above the instruction. Type the phrase

“SystemEnable” into the box and press enter.

Since this is a tag name, there can be no spaces or special characters in the name.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

52

This is a new tag for this program, so we have to define it. Right-click on the blue tag name field.

From the dropdown menu, choose “New System Enable”.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

53

The “New Tag” dialog box appears.

The tag we are defining here is simply a bit, so we can accept the default values in the dialog box. In fact, we really don’t need to add a description, as the tag name itself is pretty self-explanatory.

Click “OK”.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

54

We know from the Project Scope that the system must stop if there is a fault. We are not sure of the details of all those faults yet, but we do know that we will summarize those faults somewhere in the program. It will result in a bit. We will use the address tag

“SystemFault” for that bit. We also know that we want the “SystemEnable” to be on if we do not have a fault.

Bear with me here and it will make sense. Click and drag the XIO (examine if open) tool button from the User menu down to the new rung. Place it just to the right of the

E-stop input. Double-click on the tag filed and type “SystemFault” in the box.

It should look like this:

Right-click on the tag name and define the tag (you may also press CTRL-W to get to the “New Tag” dialog box). By the way, if you forget to define that tag, RSLogix 5000 will remind you when you accept the rung edits.

Let’s see what we have. The logic of the rung works just like an electrical circuit. If the

E-Stop is cleared and there is not a System Fault, the System Enable bit will be on.

That is exactly what we want. We will work out the fault logic later.

55

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

We need to accept the current rung. Right-click on the rung number (0) and this dropdown appears.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

56

Choose “Accept Pending Rung Edits”.

We have completed the first rung in the program.

You may wonder why the SystemFault instruction is highlighted green. This is because the value of the SystemFault tag is 0. Since the instruction is an XIC, or Examine If

Closed, the instruction is true. Therefore, the instruction is highlighted.

You should note that these colors are highly configurable. In fact, I have seen many different color schemes. Just keep in mind that you may look at someone else’s laptop and find blue, for example, has been configured to highlight a bit that is true.

Starting a Batch Cycle

The Project Scope said that the operator may start a batch by pressing the “Start Batch” pushbutton on his console. Let’s start with that input.

57

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Right-click on the last rung and choose “Add Rung”. Click and drag the XIC (examine if closed) tool button from the User menu to the left side of the new rung.

Click on the tag name field above the instruction and navigate through the tag groups until you find the input Local:2:I.Data.0. This is the “Start Batch PB1” pushbutton.

Click and drag the OTE (output energize) tool button from the User menu down to the new rung. Place it on the marker at the right. We are creating a new tag that indicates the system is currently batching. Label this tag “SystemBatching”. Right-click on the tag, select “New SystemBatching” and accept the defaults.

If the operator chooses, he may stop the batch. We will make use of the “Stop Batch” pushbutton. Click and drag the XIO (examine if open) tool button from the User menu down to the new rung. Navigate through the tag groups until you find the input

Local:2:I.Data.1. This is the “Stop Batch PB2” pushbutton.

We don’t want the operator to be able to start a batch if the System Enable bit is not on.

We will add that by dragging the XIC (examine if closed) tool button side of the new rung.

to the left

RSLogix 5000 lets us quickly assign a tag to this bit by dragging the bit name from another rung.

Click, hold and drag the tag name “SystemEnable” from the OTE in Rung 0. As you drag the tag name box, you will see gray rectangles appear, indicating that these are potential places to assign the tag. As the cursor gets nearer to a target, that target icon changes to a green oval.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

58

Release the mouse button when the cursor is near the first instruction in the rung.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

59

Here is what we have so far:

This rung we are creating will work much like a traditional motor starter circuit that uses a contact from the motor starter wired in parallel with the start button to hold in the coil.

In the PLC, the “contact” is an XIO with the same tag as the “coil”, which is

“SystemEnable”.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

60

We need to “wire the contact” in parallel with the start button. We do this with a branch instruction. Drag the Branch tool button

System Enable bit and the Start Batch bit.

and place it on the marker between the

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

61

Click on the blue section of the branch and drag it to the target to the right of the Start

Batch PB1 instruction.

As you are dragging, it looks like this.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

62

Release the mouse button and the branch will appear around the Start Batch bit.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

63

Click and drag the XIC (examine if closed) tool button left side of the new branch.

from the User menu to the

We want this instruction to be tagged “SystemBatching”, just like the OTE in this rung.

There is a quick way to do that. Just click and drag the “SystemBatching” tag name from the OTE in this rung to the new instruction.

This is called a latching rung. If the SystemEnable bit is on, the SystemBatching bit can be latched by momentarily pressing the Start Batch pushbutton. The SystemBatching bit will stay on and the rung will remain latched until the Stop Batch pushbutton is pressed or the SystemEnable bit goes off.

Thinking ahead, though, we know that the system will stop the batch automatically after it has pumped all the finished product to the filling lines. We are not sure how we will know that yet, but we know we need a bit to unlatch the rung.

Click and drag the XIO (examine if open) tool button from the User menu down to the marker just in front of the SystemBatching OTE instruction. Type in the tag

“BatchComplete” and define the tag (CTRL-W).

64

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Right-click on the rung number and verify the rung. It should appear like this.

Notice how the rung has become too long to be contained on one line, so RSLogix is putting the OTE instruction below and re-routing the connecting line. It is accurate, but a little confusing.

You can get around this by a couple of ways. You can set the “Zoom” factor under the

“View” menu to get the rung to appear on one line.

65

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

You can also hide the Controller Organizer by pressing “ALT-0”. That is what we will do here. We don’t have a real need to see the Controller Organizer right now, anyway.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

66

Batching Steps

As you recall from the project scope, there are a number of steps needed to create the finished product. They are:

1. Adding City water

2. Adding chemical QR

3. Adding chemical KM

4. Blending the mixture with the agitator

5. Pumping the finished product to the filling lines

Step 1 – Adding City Water

We need to initiate Step 1. Before we do that, though, we need to add another permissive bit. We will tag that bit “SystemReady”.

We know that if the system is enabled but not currently batching, it is ready to begin a batch. We need insert a new rung and create a “SystemBatching” and “SystemReady” bit.

Add a new rung and program it as shown in Rung 2.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

67

You can see how Rung 2 should look in the picture below. The “SystemReady” bit will be on when the system is enabled, but not batching.

To actually initiate the batch and hold the batch in Step 1, we are going to use the

Output Latch (OTL) instruction. This instruction works in conjunction with the Output

Unlatch (OTU) instruction. The instructions will work on the same bit address, but are typically found on different rungs.

The batch will be started when the operator pushes the Start Batch button. We will latch that bit and label it Step 1.

Insert a new rung at the bottom of the ladder. We need an XIC for the SystemReady bit and an XIC for the Start Batch pushbutton at the beginning of the new rung.

Click and drag the XIC (examine if closed) tool button from the User menu to the left side of the new branch. Drag the “SystemBatching” tag from Rung 2 to the new instruction.

68

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

To save some typing, you can copy and paste instructions. Highlight the Start Batch instruction in Rung 1 by clicking on the XIC icon.

Press CTRL-C.

Click on the rung number for Rung 3.

Press CTRL-V. The instruction is duplicated on Rung 3.

Click and drag the OTL (output latch) tool button from the User menu to the right side of the new branch. Type in the tag name “BatchStep1” and define the new tag.

However, what if the button is pressed if the system is already batching and in another step? To prevent that from happening, we will make sure that the only way the system can enter Step 1 is if it is not in another step already.

69

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Add a series of XIO instructions and tag them BatchStep2, BatchStep3, BatchStep4 and

BatchStep5. Define all the new tags Type in the appropriate descriptors. Verify the rung.

You may wonder why we chose not to use the OTL output latch instruction in Rung 1.

Many times, it is a matter of personal choice; sometimes a “traditional” latching rung is better than using an OTL. In Rung 1, we were able to keep all the logic affecting the

SystemBatching bit on one rung. This makes it easier to read and a little more condensed. Some people view a traditional latch as a bit safer. It’s your call, though.

The Tag Database

In looking at Rung 3, we see that some descriptions are a bit lacking. The

“SystemBatching” tag name explains what the bit does, but the “Batch Step” tag names don’t tell us much. We need to add some descriptions.

70

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

You remember the actions for each Batch Step:

1. Adding City water

2. Adding chemical QR

3. Adding chemical KM

4. Blending the mixture with the agitator

5. Pumping the finished product to the filling lines.

We can right-click on the “BatchStep1” tag in the OTE and choose “Edit BatchStep1” properties. We can then add the text “Adding City Water” to the description box, as is shown below.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

71

The result is this:

Since we have three more tags to define, let’s take a look at the tag database.

First, though, we need to know that RSLogix 5000 has different categories for tags.

Rockwell calls this attribute of a tag Data Scope.

There are controller tags, or global tags, that can be used by all the tasks and programs in the PLC.

There are program tags, or local tags, that can be used only by an individual program.

When tags are created as we have done, this is the default.

Let’s take a look at the tags we have so far in the Tag Monitor.

Press ALT-0 so the Controller Organizer comes back into view.

72

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Double-click on “Controller Tags” under Controller BATCHING. These are the tag groups that were assigned when we added our I/O.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

73

Double-click on “Program Tags” under Tasks > Main Program. Here are the tags we created as we wrote the program.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

74

Hide the controller organizer (ALT-0) and we can see the descriptions.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

75

Let’s add the rest of the batch step descriptions.

Click on the “Edit Tags” tab at the bottom.

You’ll notice that some of the fields in the table are different.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

76

Select the “Description” field for BatchStep2 and type in the description.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

77

Click on the description field for each batch step and add the respective description.

One note, though; use care when you are editing tags in this table. Many times, there is no undo available.

Analog Inputs

Before we continue with Step 1, we need to scale the analog cards for the Mixing Tank

Scales and the Ultrasonic Level Sensor.

There are a couple of ways to scale a value we get from an analog input in RSLogix

5000. We can scale the value within the program, or we can do the scaling right in the card.

There are advantages and disadvantages to both methods. Scaling in the card is simple and straightforward, but once the card is configured, the configuration cannot be changed unless the PLC is taken offline. This is not good for processes that must run continuously.

78

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Scaling in the program is more difficult, but adjustments to the scaling algorithm can be made while the PLC is still running.

In our case, as in many batching applications, the process does not have to run continuously. For example, when the mixing tank is full, we could shut down the PLC and manually run the pump that empties the tank. This “window” would give us more than enough time to re-configure the analog card.

To configure our 1756-IF8 analog input card, we need to know what signal type we have coming from our sensors, the range of the signals we get from our sensors and the engineering units for each sensor.

Let’s start with the scales.

Setting up the Analog Input Card to Calculate Tank Weight

Scales are for these types of applications usually consist of a standalone unit that is calibrated by the manufacturer of the scales. The unit usually has a display that shows the actual weight and an output that can be fed to a PLC. Let’s assume that the output of our unit has been calibrated for 0-10 VDC. Zero volts equals 0 pounds, and 10 volts equals 2000 pounds.

Now we know the signal type is DC voltage, the range is 0-10 and the engineering units are pounds.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

79

Right-click on the 1756-IF8 card in the Controller Organizer and choose “Properties”.

Click on the “Configuration” tab and you will see this.

You’ll see that Channel 0, which is our Scales channel, is selected.

Click on the dropdown menu for “Input Range” and select “0V to 10V”.

Change the “Low Signal” field to 0.

Change the “High Engineering” field to 2000.

Change the “Low Engineering” field to 0.

That is all we really need to do. However, we are going to take advantage of the fact that there is a filter available. This filter smoothes input transitions.

Set the “Digital Filter” field to 1000 ms.

80

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Click “Apply” and we are done with the scales.

Setting up the Analog Input Card to Calculate Tank Level

Like the scales, the ultrasonic level sensor is calibrated to a 0 to 10VDC signal. Zero volts indicate the tank is empty. Ten volts indicates the tank is at its “full “ mark, hopefully a safe distance from its actual maximum capacity.

The engineering unit used for the tank level is percentage.

81

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Select channel 1 on the card.

Click on the dropdown menu for “Input Range” and select “0V to 10V”.

Change the “Low Signal” field to 0.

Change the “High Engineering” field to 100.

Change the “Low Engineering” field to 0.

Again, that is all we really need to do, but we will set the “Digital Filter” field to 1000 ms.

82

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Click “Apply”.

Back to Batching – Step 1

Double-click on the “MainRoutine” in the Controller Organizer, and then hide the organizer.

Scroll down and add a new rung at the bottom of the ladder.

We will open the city water valve in this rung, so we want to make sure that it is still safe and desirable to open the valve. That is, make sure that there are no faults, the E-Stop button has not been pressed and the Stop Batch pushbutton has not been pressed.

Using an XIC with the SystemBatching bit will confirm all of that.

Insert an XIC. We could drag the tag “SystemBatching” from Rung 3, but let’s add it by using the dropdown tag menu on the instruction.

Double-click on the tag name field above the instruction. At this point, you could type the tag name and press enter to assign the tag to this instruction.

83

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Let’s use the dropdown, though. Click on the arrow in the dropdown header and you see this.

Scroll down until you find the “SystemBatching” tag. Select it and press enter.

RSLogix gives you a number of ways to assign a tag name. Use whatever is easiest for the particular situation.

Since we only want to open this valve and add city water in Step 1, insert an XIC with the tag “BatchStep1”.

Insert an OTE for the city water valve (Local:3:O.Data.1).

Remember that we want to put 1275 lbs. of water in the Mixing Tank. We will use the

LEQ (Less than or Equal To) instruction to accomplish that.

84

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Scroll to the right in the Language Element toolbar until you see the “Compare” tab.

Click on it.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

85

Click and drag the LEQ tool button to the marker just to the left of the OTE.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

86

Source A in the instruction is the Tank Weight. Click on the blue tag field and scroll through the tags until you find Local:1:I.Ch0Data (Liquid Weight in Mixing Tank Scales).

Press enter.

Source B is our setpoint, which as you recall from the Project Scope is 1275 lbs. Enter

1275 for Source B.

The LEQ instruction will remain true as long as the tank weight does not exceed 1275 lbs.

After the correct amount of city water has been added, we need to proceed to Step 2.

87

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

We will make use of the fact that we know the system is currently in Step 1, but the

Mixing Tank has enough water (1275 lbs) to go to the next step.

We will use the OTU (Output Unlatch) instruction to turn off the bit we latched in Rung 3.

Rung 5 works like this:

The XIC instruction “BatchStep1” is on. The Mixing Tank weight has reached the setpoint of 1275, so the GEQ (Greater Than or Equal To) instruction is also true. As a result, the bit “BatchStep1” is unlatched (turned off) and “BatchStep2” is latched (turned on).

Take a moment to make sure you understand how as the weight in the tank rises past

1275, the City Water valve is turned off and the system transitions to Step 2.

88

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Step 2 – Adding Chemical KM

Step 2 will be similar to Step 1, so rather than creating new rungs from scratch, we are going to copy and paste the rungs from Step 1.

Click on the rung number for Rung 4. Hold the SHIFT key and click on the rung number for Rung 5. A green bar surrounds both rung number blocks.

Press CTRL-C.

Press CTRL-V. You now have new rungs, 6 and 7.

We will start with rung 6.

Change “BatchStep1” to “BatchStep2” (in this instance, just double-click on the tag name and change the “1” to “2” and press enter).

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

89

We will be looking for a setpoint of 1275 + 390, since there is already 1275 lbs. of water in the Mixing Tank and we need to add 390 lbs. of QR. Change Source B in the LEQ instruction to 1665.

Refer to your I/O list spreadsheet and note that the QR automatic valve is addressed as

Local:3:O.Data.3. Assign that to the OTE.

In Rung 7, change “BatchStep1” to “BatchStep2”.

Change Source B in the GEQ instruction to 1665.

Change the OTU (Output Unlatch) instruction from “BatchStep1” to “BatchStep2”.

Change the OTL (Output Latch) instruction from “BatchStep2” to “BatchStep3”.

It should look like this.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

90

There is a major process difference between adding City Water and adding QR – the

QR chemical needs to be pumped. This means that not only do we have to open a valve, but we also have to turn on a pump.

First, we want to make sure the valve is being instructed to open, so we will use an XIC from pump AV-QR in the logic. Next, we will wait to turn on the pump until the valve is verified to be open by limit switch LS-QR2. As a failsafe, we will look at limit switch LS-

QR1 to make sure it is not indicating the valve is closed.

Right-click on Rung 6 and choose “Add Rung”.

So that you can learn a bit more about ASCII editing, we will construct the entire rung from the ASCII command line.

Double-click on Rung 7. The ASCII string input box appears. Type in the following string:

XIC Local:3:O.Data.3 XIO Local:2:I.Data.4 XIC Local:2:I.Data.5 OTE Local:3:O.Data.4

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

91

Press enter and the instructions appear.

OK, maybe that wasn’t the best application for the ASCII editor, but at least now you know it can be done.

Step 3 – Adding Chemical KM

Step 3 will have the same logic as Step 2, so will cut and paste to create new rungs.

Click on Rung 6, hold down the SHIFT key and click on Rung 8 to select the new rungs.

Press CTRL-C. Click on the last rung and press CTRL-V.

Change all the tag names for XIO and XIC instructions to match the new step.

We will be looking for a setpoint of 1665 + 173, since there is already 1665 lbs. of water in the Mixing Tank and we need to add 173 lbs. of KM. Change Source B in the LEQ instruction to 1838.

92

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Change Source B in the GEQ instruction to 1838.

Change the latch and unlatch outputs to increment the system to Step 4.

It should look like this after you have made the changes and verified the rungs.

Step 4 – Blending

After all the ingredients are in the Mixing Tank, we have to run the Agitator for 3 minutes.

We will set up a timer to run for 3 minutes. When the timer is done, we will increment the system to Step 5. That will turn off the Agitator.

Start by inserting a new rung at the bottom.

Insert an XIC instruction with the address of B3:0/2.

Insert an XIC instruction with the address B3:0/13.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

93

Click the “Timer/Counter” tab on the Language Element menu. Click and drag the TON tool button down to the right side of the new rung.

This type of timer is called a Timer On Delay. As soon as the instructions preceding it are true, it will begin timing. The Enable bit (EN) will turn on. After it reaches its Preset value, the Done bit (DN) will turn on.

First, we have to assign a tag name to the timer. Double-click on the “Timer” field in the instruction. Type “AgitatorRunTime” for the tag name.

Define the new timer tag name, as you cannot assign presets until you do this.

The time base for the TON instruction is always 1 msec.

We want to time for 3 minutes, or 180 seconds, so we will enter a preset of 180000.

Double-click on the Preset field and type 180000. Press enter.

Leave the accumulated value at 0, as this will be changed as the timer begins timing.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

94

The completed rung looks like this.

To run the Agitator, insert a new rung at the bottom.

Click on the “User” tab of the tool button menu and drag an XIC instruction to the first marker of the new rung. We will use the Enable bit (EN) of the timer for the tag.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

95

To assign a timer’s enable bit, double-click on the tag name field for the new XIC instruction and navigate to the EN (enable) bit of the timer.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

96

Add an OTE instruction for the Mixing Tank Agitator.

The enable bit of a timer is on only when the timer is enabled. In Rung 12, for example, if the SystemBatching bit turns off, or the Batch Step 4 bit turns off, the timer will no longer be enabled. Consequently, its enable bit, AgitatorRunTime.EN will turn off.

We will turn off the timer by incrementing the system to the next step when the timer is done.

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

97

Insert a new rung at the bottom and drag an XIC to the first marker. We will assign the

Done bit (DN) of the timer to this instruction. It is formatted just like the Enable bit, except you use .DN as the suffix. Tag this instruction as AgitatorRunTime.DN.

We will use the same method to increment the system to Step 5 that we have used previously. Drag an OTU instruction to the last marker in the rung. Tag the instruction to be Step 4, which is BatchStep4.

Insert a new branch around the OTU by dragging a Branch tool button to the marker in front of the output. Grab the right leg of the branch and move it to the marker after the output.

Insert an OTL instruction on the bottom of the branch and tag it as BatchStep5.

Now, when the timer is done and AgitatorRunTime.DN turns on, it will unlatch Step 4 and start Step 5.

98

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Step 5 – Pump to Filling Lines

Since this step involves a pump, it will be similar to Step 3. Let’s save ourselves some typing and copy all of Step 3.

Click on Rung 9. Hold down the SHIFT key and click on Rung 11.

Press CTRL-C.

Click on the last rung. Press CTRL-V.

In Rung 15, change BatchStep4 to BatchStep5.

Change the tag of the output instruction to Local:3:O.Data.13.

We want to pump until the Mixing tank is empty.

We will use the Ultrasonic Level Sensor to determine if the tank has liquid in it. We will use a GEQ instruction to accomplish this.

Double-click on the “LEQ” text in the LEQ instruction. Type GEQ (for Greater than or equal to) in that space. Change Source A of the instruction to Local:1:I.Ch1Data. This is the address of the scaled level sensor.

We may be tempted to put a value of 0 into Source B, but that could be risky. First, pumping the tank dry might be hard on the pump. Second, because of drift in the level sensor, we might never get a reading of zero in some instances.

The Process engineers have told us that emptying the tank to 3% is desirable. Put a 3 in for the value of Source B.

Change Rung 16 to show the correct valve, limit switches and pump addresses.

Since this is the last step in the batching process, we will use Rung 17 to increment out of Step 5 and complete the batching cycle.

Change the first XIC in Rung 17 to BatchStep5.

Copy the GEQ instruction from Rung 16. Click on the instruction, press CTRL-C and click on the GEQ instruction in Rung 18. Press CTRL-V.

Delete the other GEQ from Rung 17 (the one that references the tank weight).

Change the remaining GEQ in Rung 17 to a LEQ.

99

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Change the OTU instruction’s tag from BatchStep3 to BatchStep5.

Right-click on the OTL (L) instruction in the bottom branch. Choose “Change Instruction

Type” and make it an OTE. Change the tag to BatchComplete. This is the “batch complete” bit.

The screen should look like this.

When the system enters Step 5, the Mixing Tank will be nearly full. The GEQ instruction will be true and open the Mixing Tank valve.

When the valve has been opened and verified by the limit switches, the pump will run.

When the level in the tank drops to 3%, the valve will close and the Mixing Tank pump will stop.

Simultaneously, the BatchStep5 bit will be unlatched and the BatchComplete OTE instruction will be turned on. It will trip the latch in Rung 1 and turn off the

SystemBatching bit.

100

PLC Programming with RSLogix 5000

Copyright

 2009 Modern Media engineer-and-technician.com

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project