13. PLCS and Networking

 

 

Figure 22.1 - A Communication Example

 

 

 

13.1 Open Network Types

 

13.1.1 Devicenet

 

Devicenet has become one of the most widely supported control networks. It is an open standard, so components from a variety of manufacturers can be used together in the same control system. It is supported and promoted by the Open Devicenet Vendors Association (ODVA) (see http://www.odva.org). This group includes members from all of the major controls manufacturers.

 

This network has been designed to be noise resistant and robust. One major change for the control engineer is that the PLC chassis can be eliminated and the network can be connected directly to the sensors and actuators. This will reduce the total amount of wiring by moving I/O points closer to the application point. This can also simplify the connection of complex devices, such as HMIs. Two way communications inputs and outputs allow diagnosis of network problems from the main controller.

 

Devicenet covers all seven layers of the OSI standard. The protocol has a limited number of network address, with very small data packets. But this also helps limit network traffic and ensure responsiveness. The length of the network cables will limit the maximum speed of the network. The basic features of are listed below.

• A single bus cable that delivers data and power.

• Up to 64 nodes on the network.

• Data packet size of 0-8 bytes.

• Lengths of 500m/250m/100m for speeds of 125kbps/250kbps/500kbps respectively.

• Devices can be added/removed while power is on.

• Based on the CANbus (Controller Area Network) protocol for OSI levels 1 and 2.

• Addressing includes peer-to-peer, multicast, master/slave, polling or change of state.

 

An example of a Devicenet network is shown in Figure 22.16. The dark black lines are the network cable. Terminators are required at the ends of the network cable to reduce electrical noise. In this case the PC would probably be running some sort of software based PLC program. The computer would have a card that can communicate with Devicenet devices. The ’FlexIO rack’ is a miniature rack that can hold various types of input and output modules. Power taps (or tees) split the signal to small side branches. In this case one of the taps connects a power supply, to provide the 24Vdc supply to the network. Another two taps are used to connect a ’smart sensor’ and another ’FlexIO rack’. The ’Smart sensor’ uses power from the network, and contains enough logic so that it is one node on the network. The network uses ’thin trunk line’ and ’thick trunk line’ which may limit network performance.

 

Figure 22.16 - A Devicenet Network

 

The network cable is important for delivering power and data. Figure 22.17 shows a basic cable with two wires for data and two wires for the power. The cable is also shielded to reduce the effects of electrical noise. The two basic types are thick and thin trunk line. The cables may come with a variety of connections to devices.

• bare wires

• unsealed screw connector

• sealed mini connector

• sealed micro connector

• vampire taps

 

Figure 22.17 - Shielded Network Cable

 

Some of the design issues for this network include;

• Power supplies are directly connected to the network power lines.

• Length to speed is 156m/78m/39m to 125Kbps/250Kbps/500Kbps respectively.

• A single drop is limited to 6m.

• Each node on the network will have its own address between 0 and 63.

 

If a PLC-5 was to be connected to Devicenet a scanner card would need to be placed in the rack. The ladder logic in Figure 22.18 would communicate with the sensors through a scanner card in slot 3. The read and write blocks would read and write the Devicenet input values to integer memory from ’N7:40’ to ’N7:59’. The outputs would be copied from the integer memory between ’N7:20’ to ’N7:39’. The ladder logic to process inputs and outputs would need to examine and set bits in integer memory.

 

Figure 22.18 - Communicating with Devicenet Inputs and Outputs

 

On an Allen Bradley Softlogix PLC the I/O will be copied into blocks of integer memory. These blocks are selected by the user in setup software. The ladder logic would then using integer memory for inputs and outputs, as shown in Figure 22.19. Here the inputs are copied into N9 integer memory, and the outputs are set by copying the N10 block of memory back to the outputs.

 

Figure 22.19 - Devicenet Inputs and Outputs in Software Based PLCs

 

 

13.1.2 CANbus

 

The CANbus (Controller Area Network bus) standard is part of the Devicenet standard. Integrated circuits are now sold by many of the major vendors (Motorola, Intel, etc.) that support some, or all, of the standard on a single chip. This section will discuss many of the technical details of the standard.

 

CANbus covers the first two layers of the OSI model. The network has a bus topology and uses bit wise resolution for collisions on the network (i.e., the lower the network identifier, the higher the priority for sending). A data frame is shown in Figure 22.20. The frame is like a long serial byte, like that seen in Figure 22.3. The frame begins with a start bit. This is then followed with a message identifier. For Devicenet this is a 5 bit address code (for up to 64 nodes) and a 6 bit command code. The ’ready to receive it’ bit will be set by the receiving machine. (Note: both the sender and listener share the same wire.) If the receiving machine does not set this bit the remainder of the message is aborted, and the message is resent later. While sending the first few bits, the sender monitors the bits to ensure that the bits send are heard the same way. If the bits do not agree, then another node on the network has tried to write a message at the same time - there was a collision. The two devices then wait a period of time, based on their identifier and then start to resend. The second node will then detect the message, and wait until it is done. The next 6 bits indicate the number of bytes to be sent, from 0 to 8. This is followed by two sets of bits for CRC (Cyclic Redundancy Check) error checking, this is a checksum of earlier bits. The next bit ’ACK slot’ is set by the receiving node if the data was received correctly. If there was a CRC error this bit would not be set, and the message would be resent. The remaining bits end the transmission. The ’end of frame’ bits are equivalent to stop bits. There must be a delay of at least 3 bits before the next message begins.

 

Figure 22.20 - A CANbus Data Frame

 

Because of the bitwise arbitration, the address with the lowest identifier will get the highest priority, and be able to send messages faster when there is a conflict. As a result the controller is normally put at address ’0’. And, lower priority devices are put near the end of the address range.

 

 

13.1.3 Controlnet

 

Controlnet is complimentary to Devicenet. It is also supported by a consortium of companies, (http://www.controlnet.org) and it conducts some projects in cooperation with the Devicenet group. The standard is designed for communication between controllers, and permits more complex messages than Devicenet. It is not suitable for communication with individual sensors and actuators, or with devices off the factory floor.

 

Controlnet is more complicated method than Devicenet. Some of the key features of this network include,

• Multiple controllers and I/O on one network

• Deterministic

• Data rates up to 5Mbps

• Multiple topologies (bus, star, tree)

• Multiple media (coax, fiber, etc.)

• Up to 99 nodes with addresses, up to 48 without a repeater

• Data packets up to 510 bytes

• Unlimited I/O points

• Maximum length examples

1000m with coax at 5Mbps - 2 nodes

250m with coax at 5Mbps - 48 nodes

5000m with coax at 5Mbps with repeaters

3000m with fiber at 5Mbps

30Km with fiber at 5Mbps and repeaters

• 5 repeaters in series, 48 segments in parallel

• Devices powered individually (no network power)

• Devices can be removed while network is active

 

This control network is unique because it supports a real-time messaging scheme called Concurrent Time Domain Multiple Access (CTDMA). The network has a scheduled (high priority) and unscheduled (low priority) update. When collisions are detected, the system will wait a time of at least 2ms, for unscheduled messages. But, scheduled messages will be passed sooner, during a special time window.

 

 

13.1.4 Profibus

 

Another control network that is popular in europe, but also available world wide. It is also promoted by a consortium of companies (http://www.profibus.com). General features include;

• A token passing between up to three masters

• Maximum of 126 nodes

• Straight bus topology

• Length from 9600m/9.6Kbps with 7 repeaters to 500m/12Mbps with 4 repeaters

• With fiber optic cable lengths can be over 80Km

• 2 data lines and shield

• Power needed at each station

• Uses RS-485, ethernet, fiber optics, etc.

• 2048 bits of I/O per network frame

 

 

13.2 Proprietary Networks

 

13.2.0.1 - Data Highway

 

Allen-Bradley has developed the Data Highway II (DH+) network for passing data and programs between PLCs and to computers. This bus network allows up to 64 PLCs to be connected with a single twisted pair in a shielded cable. Token passing is used to control traffic on the network. Computers can also be connected to the DH+ network, with a network card to download programs and monitor the PLC. The network will support data rates of 57.6Kbps and 230 Kbps

 

The DH+ basic data frame is shown in Figure 22.22. The frame is byte oriented. The first byte is the ’DLE’ or delimiter byte, which is always $10. When this byte is received the PLC will interpret the next byte as a command. The ’SOH’ identifies the message as a DH+ message. The next byte indicates the destination station - each node one the network must have a unique number. This is followed by the ’DLE’ and ’STX’ bytes that identify the start of the data. The data follows, and its’ length is determined by the command type - this will be discussed later. This is then followed by a ’DLE’ and ’ETX’ pair that mark the end of the message. The last byte transmitted is a checksum to determine the correctness of the message.

 

Figure 22.22 - The Basic DH+ Data Frame

 

The general structure for the data is shown in Figure 22.23. This packet will change for different commands. The first two bytes indicate the destination, ’DST’, and source, ’SRC’, for the message. The next byte is the command, ’CMD’, which will determine the action to be taken. Sometimes, the function, ’FNC’, will be needed to modify the command. The transaction, ’TNS’, field is a unique message identifier. The two address, ’ADDR’, bytes identify a target memory location. The ’DATA’ fields contain the information to be passed. Finally, the ’SIZE’ of the data field is transmitted.

 

Figure 22.23 - Data Filed Values

 

Examples of commands are shown in Figure 22.24. These focus on moving memory and status information between the PLC, and remote programming software, and other PLCs. More details can be found in the Allen-Bradley DH+ manuals.

 

Figure 22.24 - DH+ Commands for a PLC-5 (all numbers are hexadecimal)

 

The ladder logic in Figure 22.25 can be used to copy data from the memory of one PLC to another. Unlike other networking schemes, there are no ’login’ procedures. In this example the first MSG instruction will write the message from the local memory ’N7:20’ - ’N7:39’ to the remote PLC-5 (node 2) into its memory from ’N7:40’ to ’N7:59’. The second ’MSG’ instruction will copy the memory from the remote PLC-5 memory ’N7:40’ to ’N7:59’ to the remote PLC-5 memory ’N7:20’ to ’N7:39’. This transfer will require many scans of ladder logic, so the ’EN’ bits will prevent a read or write instruction from restarting until the previous ’MSG’ instruction is complete.

 

Figure 22.25 - Ladder Logic for Reading and Writing to PLC Memory

 

The DH+ data packets can be transmitted over other data links, including ethernet and RS-232.

 

 

 

13.3 Practice Problems

 

1. Explain why networks are important in manufacturing controls.

 

ans. These networks allow us to pass data between devices so that individually controlled systems can be integrated into a more complex manufacturing facility. An example might be a serial connection to a PLC so that SPC data can be collected as product is made, or recipes downloaded as they are needed.

 

2. We will use a PLC to control a cereal box filling machine. For single runs the quantities of cereal types are controlled using timers. There are 6 different timers that control flow, and these result in different ratios of product. The values for the timer presets will be downloaded from another PLC using the DH+ network. Write the ladder logic for the PLC.

 

 

3. a) We are developing ladder logic for an oven to be used in a baking facility. A PLC is controlling the temperature of an oven using an analog voltage output. The oven must be started with a push button and can be stopped at any time with a stop push button. A recipe is used to control the times at each temperature (this is written into the PLC memory by another PLC). When idle, the output voltage should be 0V, and during heating the output voltages, in sequence, are 5V, 7.5V, 9V. The timer preset values, in sequence, are in N7:0, N7:1, N7:2. When the oven is on, a value of 1 should be stored in N7:3, and when the oven is off, a value of 0 should be stored in N7:3. Draw a state diagram and write the ladder logic for this station.

 

b) We are using a PLC as a master controller in a baking facility. It will update recipes in remote PLCs using DH+. The master station is #1, the remote stations are #2 and #3. When an operator pushes one of three buttons, it will change the recipes in two remote PLCs if both of the remote PLCs are idle. While the remote PLCs are running they will change words in their internal memories (N7:3=0 means idle and N7:3=1 means active). The new recipe values will be written to the remote PLCs using DH+. The table below shows the values for each PLC. Write the ladder logic for the master controller.

 

 

 

 

 

4. A controls network is to be 1500m long. Suggest three different types of networks that would meet the specifications.

 

(ans. Controlnet, Profibus, Ethernet with multiple subnets)

 

5 How many data bytes (maximum) could be transferred in one second with DH+?

 

(ans. the maximum transfer rate is 230 Kbps, with 11 bits per byte (1start+8data+2+stop) for 20909 bytes per second. Each memory write packet contains 17 overhead bytes, and as many as 2000 data bytes. Therefore as many as 20909*2000/(2000+17) = 20732 bytes could be transmitted per second. Note that this is ideal, the actual maximum rates would be actually be a fraction of this value.)

 

 

 

13.4 Laboratory - Devicenet

 

Purpose:

To be introduced to a software based PLC, interfacing with devices using devicenet and practical sensors.

 

Overview:

In previous coursework you have used PLC-5 processors. The software based PLC is very similar. The most noticeable difference is that Inputs and Outputs will appear in integer memory instead of the normal I:1 and O:0 blocks of memory.

The program to be developed for this laboratory should......

 

Pre-Lab:

1. Develop the ladder logic for the system described in the Overview.

 

In-Lab:

1. Follow the Softplc and Devicenet tutorial.

2. Implement a control system to .....

 

Submit (individually):

1. Program listings and prelab design work.

 

 

13.5 Tutorial - SoftPLC and Devicenet

 

Objective: By the end of this tutorial you should be able to do the major steps required to connect a devicenet network and program a SoftPLC to control it. It will end with the connection and programming of a Panelview 550 display.

 

1. Gather the components below. These will be used to build the Devicenet for the rest of the tutorial. When finding components the labels on the back are a good source of information. The information on the front of the devices is not normally useful.

- A PC with a PCIDS devicenet scanner card and software installed

- Devicenet Flex I/O rack on a din rail including,

24VDC adapter 1794-ADN

Relay output 1794-DWB

24Vdc source input 1794-IV16

24Vdc sink input 1794-IB16

- a Sola 24Vdc power supply with a power cable attached

- a Sola 24Vdc power supply with a power tap (1485T-P2T5-T5) attached

- a devicenet capable photoswitch (42GNP-9000-QD)

- 2 normal photoswitches (42GRP-9000-QD)

- 4 Devicenet cable mini connector to wires (1485R-P3M5-C)

- a light stack with red/amber/green

- a central terminal Devicebox (1485P-P4T5-T5)

- 3 network taps

- a stop pushbutton

- 2 terminator resistors

- thick wire trunk line

- wires for connection

- Panelview 550 touch screen display

 

2. Wire up the network below (note: we will add more of the components later).

 

 

3. Start the “RS Networx for Devicenet” software. When it starts it might show a diagram of previously programmed devices on the network. We need to get a current list of devices on the network. To do this pick “Selection” “Online”. This will scan the devices on the network and get their current configurations. After this the diagram on the screen will be current.

 

4. Next, we want to map the data from each of the Devicenet nodes to a location in the SoftPLC memory. Double click on the PCIDS card on the screen. Click on the “scanlist” tab (you may have to upload parameters). Make sure that all of the devices appear on the scanlist. Use the “Input” and “Output” tabs to map these devices to specific input and output memory. Notice that this is organized in words (16bits). You will want to make a note of these values, because you will use these when programming the PLC. When done select “Apply” and then “OK”. Exit the program and save the changes. At this point a file has been set up that tells the SoftPLC what devices are on the Devicenet, and what to do with them.

 

5. Move the pointer to the bottom right of the screen. You will see a black dot near the time. Click twice on this (Note: when the SoftPLC is running this will be green). A screen entitled “Softlogix 5 Status Monitor” will popup. Click on “Config” and then “Start SoftLogix 5”. The SoftPLC should now be running. Click “OK” to dismiss the screens.

 

6. Start the “RS-Logix SL5 English” software (Note the ‘SL’). Start a “New Project”, the programming window should appear. You should now be ready to tell the SoftPLC that you will be using devicenet. Double click on “Processor Status” and on the pop-up window scroll across and select the “Dnet” tab. For the output file enter “9”, for the input file enter “10”, for the diagnostic file enter “11”. Dismiss the window and look at the memory locations under data files, there should now be I/O words there under N9, N10, N11. The input and output memory set in the RSNetworx program will be put in this memory.

 

7. Write a simple ladder logic program to read to smart optical sensor and output a value to the relay card. If you need help finding which inputs are which, try running a simple or empty program, and watching the memory.

 

8. Connect the other photooptical sensors and the light stack to the Flex I/O rack and write a more sophistocated program.

 

9. Connect the PanelView display, and reconfigure the devicenet network. Use the Panel Builder software to create a visual interface, and then download it to the touchscreen. Write ladder logic that uses it for input and output.