Chapter 4 :Getting it all Working

After creating the application and writing the program, the next step may be to find out why it does not work as intended. The issue may be due to the M221 Logic Controller, an incorrectly written program or the field wiring or devices.

SoMachine Basic provides a number of tools to help with faultfinding the M221 Logic Controller and the Application.

This Chapter Covers These Topics:
i. Visual Clues
ii. Looking at the Program
iii. Searching for Things
iv. Replacing Things
v. Looking at Values
vi. Changing Values
vii. Forcing

i.Visual Clues

LEDs
The LEDs provide a visual indication of the status of the M221 Logic Controller. They can show when the program is not running, and combinations can sometimes give an indication why. They also give an indication of the state of various parts of the M221.

f1

PWR LED
The first LED shows the state of the power supply to the M221 controller. If the PWR LED is off then the 24V power supply to the M221 is not working. The first thing to check would be the wiring and the power supply itself.

If the PWR LED is not on there is no point looking for any other problems as this must be resolved first.

During normal operation this LED should be permanently ON.

RUN LED
The next LED to look at is the RUN LED. If this is permanently on then the program is running and any fault is likely to be in the program itself.

If the RUN LED is blinking slowly (and the ERR LED is off) then the M221 is in Stop mode. This can be for several reasons but the first thing to check is the RUN/STOP switch on the front of the M221. This switch must be up for the program to run. If the switch is up then the SoMachine Basic software must be used to put the M221 controller in Run. Alternatively, changing the RUN/STOP switch down to the STOP position and then back up to RUN will set the controller in run mode.

If the RUN LED is off, there is no application in the M221 Logic Controller. During normal operation this LED should be permanently ON.

ERR LED
The ERR LED can indicate various faults in the M221 Logic Controller.

If it is permanently on, this indicates an exception in the M221 which has caused it to stop. The program cannot be run and no communication with the M221 is possible. To recover, the firmware must be reloaded into the M221.

If the ERR LED is flashing, this indicates that the M221 has a valid application but there is an internal error. If the Run LED is on, then the program in RAM is not the same as the stored program. This typically occurs when an on-line modification has been made and not saved to the M221. If the Run LED is off, then this indicates an internal error. Limited communication is allowed to resolve the error but the program cannot be run.

A single flash when power is applied to the M221 indicates that there is no application loaded into the controller. Full communication with the controller is possible in order to download an application.

During normal operation this LED should be permanently OFF.

SD LED
The SD LED indicates when the M221 Logic Controller is accessing the SD card. This will usually be during a firmware upgrade or data transfer.

During normal operation this LED should be permanently OFF.

BAT LED
The BAT LED indicates the state of the battery. A slow flash indicates that the battery is low. When the LED is permanently on, this indicates that the battery is flat.

During normal operation this LED should be permanently OFF.

SL LED
The SL LED indicates when the M221 Logic Controller is communicating via the Serial Port. If the M221 has more than one serial port, there will be two LEDs labelled SL1 and SL2 giving indication for ports 1 and 2.

During normal operation the state of this LED will depend on the application.

Exercise - LED status

1. If SoMachine Basic is not running, start it and open the Conveyor Control Application.

2. Make an online modification and observe the effect on the LEDs.

i. Connect to the M221 Logic Controller and ensure that the program in the controller is the same as the program in SoMachine Basic.
ii. Make a small change to a ladder rung. This can be any change such as changing a normally open contact to normally closed or changing the address of an object.
iii. Click off the rung and when the message appears asking if the change is to be permanent, click the No button.
iv. Observe the effect on the LEDs.

3. Remove the battery.
i. Power off the M221 controller and remove the battery from the unit.
ii. Apply power to the M221 Controller and observe the effect on the LEDs.
iii. Remove the power for at least 30 seconds, insert the battery, apply power to the M221 and observe the effect on the LEDs.

ii.Looking at the Program

Displaying Values on a Rung
When SoMachine Basic is connected to the M221, the values of objects are displayed on rungs. If an output does not turn on when expected, the logic can be checked and the cause determined.

The colouring of the contacts will indicate power flow. Green colouring shows when a contact will allow power to flow and a contact that is not coloured will not allow power flow.

f2

The state shown under each object also gives the state of the contact or coil, showing whether it is true or false.

Note:
The True/False indication shows the state of the input, not the state of the coil or contact. The green colouring shows the state of the contact. This can be confusing for inverted contacts and coils but a green colour will always signify power or on.

Analysing a Rung

f3

In the above example the outputs controls conveyor 2 which is not running. Looking at the displayed values on the rung, %M100 which is the Run Relay is shown as true so the conveyor should be running. However, %M107 which is Conveyor 3 fault is also shown as true and no power will be allowed through this normally closed contact.

Even though there is no fault on conveyor 2, the fact that another conveyor has developed a fault will also stop this one. The program has been designed to behave this way. This method of analysing a rung can be helpful to determine why something is not happening as expected, especially when it is being prevented by something in another part of the program.

Exercise - Values in Rungs

1. If SoMachine Basic is not running, start it and open the Conveyor Control Application.

2. Investigate why the fault light is flashing.
i. Display the Fault Light rung located in the Fault Handling POU.
ii. Identify the part of the rung that is causing the fault light to flash.

f4

This leg contains %S6 which is the system bit cycling with a 1 second interval. This is in series with %M120 the normally closed contact is false which is causing the fault light to flash.

f5

The symbol for this is VS_OK.

iii. Display the VS OK rung located in the Speed Monitoring POU.

f6

The VS_OK object is turned on when the speed is not low and not high. Looking at the state of the two contacts, the VS_LOW contact is true so the low speed means that the speed is not OK.

f7

iv. Display the VS Low rung located in the Speed Monitoring POU.

f8

The Run Relay (%M100) is true so the error must be in the comparison. The variable speed low setpoint (VS_VO_SP) is 400 but the actual speed of conveyor 1 (C1_SPD) is equal to one. The comparison is successful and the low speed turns on.

f9

The conveyor is either not running or there is no signal from the device monitoring the conveyor speed.

(In this case, the signal is not connected)

iii.Searching for Things

Using the Search
The previous method of navigating around the project is possible if the rungs have been given meaningful names of the project is familiar. If not then the object must be searched for.

The search function in SoMachine Basic makes finding things easy. At the moment it only works on rung names or descriptions so when programming, make sure meaningful rung names and descriptions are entered. The search will not work for symbols.

f10

f11

To start a search, go to the Programming tab and select Tools in the Programming Tree. Near the bottom under Software Objects, select Search and Replace.

In the section that opens at the bottom of the screen, type the required search into the Find dialog box and click the Search button (Pressing the return key will not work). A list of matching descriptions will be displayed. The wildcard is not required as the list will include all descriptions that contain the matching string.

The search can only be used to search the code.

Using what has been Found

After the search has produced a list of matching items, these can be used to navigate around the application.
f12

Clicking an item in the list will go to the rung where that object has been programmed and place the cursor on the object.

iv.Replacing Things

Using Replace
When something has been found, the replace may be used to a piece of text in a description to something. For example, if all descriptions contained the word "fault" and this needs to be changed to "malfunction", enter the word malfunction into the replace dialog box and click the Replace button (once again, pressing the return key will not work).

f13

This function can only be used for replacing ALL instances of a string.

Exercise - Searching for Things

1. If SoMachine Basic is not running, start it and open the Conveyor Control Application.

2. Search for objects associated with faults.
i. Click the Programming Tab.
ii. Click the Tools Tab in the Programming Tree.
iii. Select Search and Replace under Software Objects
iv. In the Find dialog box enter the word fault and click the Search button.

f14

3. Navigate using the search.
i. Click one of the items in the search results and observe the effect on the ladder rungs displayed.
ii. Select the first item in the list.
iii. Select the second item in the list and observe the effect on the ladder rungs displayed. The rung should not change but the cursor will move to the next object.
iv. Click the third item in the list.
v. Select other items to see other parts of the conveyor fault programming.

4. Replacing items.
i. In the Find dialog box enter the word malfunction and click the Replace Button. Note that all instances of "fault" have been replaced with "malfunction".

f13-1

ii. Confirm this by clicking the Search button. SoMachine Basic will search for all occurrences of the word "fault" as this is still in the search box. The result will be the message "No search results available" as they have all been replaced.

v.Looking at Values

Animation Tables

If the values of many objects need to be viewed at the same time then animation tables provide a way of doing this.
f15

Animation tables allow multiple objects to be displayed in a single table along with their values. Multiple animation tables can be created and saved for different debugging sessions.

How to Create an Animation Table
To create an animation table, go to the Tools tab of the Programming tree. Right- click Animation tables and select Add new animation table from the menu.

f16

An empty animation table will be created where new objects can be added.

f17

In the entry box, enter either the symbol or address of an object and click the Add
button.

f18

If the object is found, the value will be displayed if known. If the object is not found, a red box will be displayed indicating an error.

f19

Changing the Display Format

The format of values displayed in animation tables can be changed to help when displaying data in different addressing formats. The allowable display formats are:

Decimal (65)
Hexadecimal (0041)
Binary (0000000001000001)
ASCII (A)

Right-click a value displayed in an animation table and a list of display formats will be listed in the pop-up menu. Choose the appropriate format for the data displayed.

f20

Exercise - Animation Tables
1. If SoMachine Basic is not running, start it and open the Conveyor Control Application.

2. Create an animation table.
i. Go to the Tools tab of the Programming tree. Right-click Animation tables and select Add new animation table from the menu.

f16-1

ii. In the entry box enter the object %M100. Click the Add button.
f17-1

iii. Add the following objects to the animation table:

VS_HI_SP
C1_SPD
VS_LO_SP

This table will allow the speed check to be carried out very quickly. If the system is running, the actual speed should be between the low and high setpoints.

f15

The order of the objects in the table has been carefully chosen so that when everything is running correctly, the analogue values decrease from top to bottom. If they do not, this indicates a problem.

3. Rename the animation table to indicate its purpose.
i. In the Programming tree, right-click the animation table Animation table_0 and select Rename animation table from the menu.

f21

ii. Change the name to Speed Monitoring.
f22

4. Save the application.

vi.Changing Values

Modifying a Value
In some cases, values in animation tables can be changed as well as viewed.

Most word values can be changed using the SoMachine Basic animation tables. Click the value displayed and a dialog box will open allowing the value to be changed.

f23

Note:
If the program writes a value to an object, the value of that object may still be changed using an animation table but the next time the program logic is solved, the value will be overwritten.

Fixing a Value
Sometimes it can be helpful to fix a value so that it does not change. This is particularly true for the logical sections of a program where states can change quickly making it difficult to see what is happening. This can also be useful for testing something that does not happen very often.

Setting a digital object such as an input, output or coil to a fixed state is known as forcing.

Forcing objects removes them from program control and can cause unexpected and uncontrolled operation of machinery or the process.

f24

vii.Forcing

How to Force an Object
Objects can only be forced from an animation so the first step is to create an animation table which contains the object(s) to be forced. The animation table can also contain other objects to be monitored to see the effect of the force.

f25

Click the force column of the animation table and a drop-down box will appear, giving the choices Force to 0, Force to 1 or Not Forced. Select either Force to 0 or Force to 1 depending on the desired state.

f26

How to Remove Forces
The Not Forced option in the animation table can be used to remove the force for a single object. Click the Force column in the animation table and select Not Forced from the menu.

If the object is not in an animation table or there are multiple objects to be unforced, these must be added to an animation table in order to unforce them.

When looking at a section of program, forced items can be identified by the letter 'F' displayed underneath the coil or contact, in front of the True/False state.

Exercise - Forcing
1. If SoMachine Basic is not running, start it and open the Conveyor Control Application.

2. Create an animation table
i. Create an animation table containing the following objects:

START_BUTTON
STOP_BUTTON
C1_RUN
C2_RUN
C3_RUN
C2_FLT

3. Using Force to control the application.
i. Click Not Forced in the Force column for the START_BUTTON symbol. This will select the object and allow it to be forced.
f25-1

ii. Drop down the selection box and select Force to 1 from the menu.
f27

The process will start and the outputs controlling the conveyors will turn on (%I0.2, %I0.3 and %I0.4).

iii. Drop down the selection box for the START_BUTTON object force and select Not forced from the menu.

The object will display the value 0 as the input is not on but the outputs will remain on as they have been latched by an internal contact.
iv. Select the STOP_BUTTON object, drop down the selection box and select Force to 1 from the menu.

The shutdown sequence will operate until all the outputs are off.
v. Drop down the selection box and select Not forced from the menu.

4. Forcing an object on to test the output.
i. Drop down the selection box for the C1_RUN object force and select
Force to 1 from the menu.

The output for conveyor 1 (%I0.2) will come on.
ii. Drop down the selection box for the C2_RUN object force and select
Force to 1 from the menu.

The output for conveyor 2 (%I0.3) will come on.
iii. Drop down the selection box for the C3_RUN object force and select
Force to 1 from the menu.

The output for conveyor 3 (%I0.4) will come on.

Note:
This process allows outputs field wiring and output devices to be tested without running the application.

5. Remove all forces from the program.
i. For each item that is forced, drop down the force dialog box in the animation table and choose the Not Forced item from the menu.

6. Forcing an object to a fixed state.
i. Force the START_BUTTON object on to start the process. The outputs controlling the conveyors will turn on (%I0.2, %I0.3 and
%I0.4).
ii. Set the START_BUTTON object to Not forced.
iii. Force the C2_RUN object to 1. There will be no visible difference on the front of the M221 as the output is already on.
iv. Display the Conv 2 rung in the Control POU.

f28

Notice that the display shows the letter F in front of the value indicating that the output is forced.
v. Select the STOP_BUTTON object and force it to 1.

As before, the stop sequence will operate but one output will remain on. This will be the forced output %Q0.3.

vi. Start the process again in the same way, then force the C3_FLT object to 1.

This should stop the faulty conveyor (conveyor 3) and all conveyors feeding it. Note that the output for conveyor 2 stays on.

Note:
This shows how an object can be forced with no visible effect outside the programming software and leave equipment in a dangerous state unable to stop when required.