In our previous blog (MagneMotion Blog Part 6: Track Recovery Considerations), we discussed the best way to startup your MagneMotion system or recover your routing system after a stop or a fault condition. In this blog we’ll discuss an important MagneMotion tool for controlling your system — the Traffic Light
What are Traffic Lights?
In a MagneMotion track, traffic lights are simply defined points on your track that can either be set to Green to allow vehicles to pass through or set to Red to prevent any vehicle from passing that point (there is no yellow light in a MagneMotion traffic light).
As you can imagine, as MagneMotion systems get increasingly large and complex, traffic lights are an important tool in directing the flow of vehicles throughout your system to make sure they arrive in a timely fashion.
Traffic Light Uses
1. Completely Blocking off a Section of Track
Traffic lights can be used to block off a section of track where it wouldn’t be safe or smart to move a vehicle. For example, if there is a segment of your track that lifts out of position, traffic lights can be positioned on either end of the track to make sure no vehicles can move from it while it is not in position
2. Controlling Traffic Flow
If your track has any branches off sections of track that experience high throughput of vehicles, any vehicles trying to leave that branch might get stuck waiting for an opportunity to move. A traffic light placed right before that branch can be used to create a break in a line of vehicles
3.Traffic Jam Prevention
You might find that your track has one or more places where having too many vehicles can cause a full-on traffic jam — causing your whole line to get backed up and stuck. Adding traffic lights before any of these choke points can ensure that your line never gets into unrecoverable situations.
Note how none of these vehicles will be able to leave this loop of track.
NC Host Control
A good tool to familiarize yourself with traffic light operation is MagneMotion’s NC Host tool (The NC Host download can be found here.)
To create a traffic light In NC Host, go to the Traffic Light tab under Host Commands. Then, enter a path and position for the traffic light and hit Create
Once the light has been created, you can change its state between red and green by entering the traffic light’s ID by the TL ID entry and press the nearby green and red button to change the color.
If you press the Traffic Lights button in the Launch Status Windows section, you can pull up an image showing the status of the traffic lights in your system.
If you are planning on using a PLC to control your traffic lights, the first thing to do is to make sure that the MagneMotion device handler was properly configured within Application Code Manager (for information on how to set up a project through Application Code Manager see MagneMotion Guide Part 3: Controlling a System with a PLC).
Since traffic light controls are not a part of the default AOIs that are included in the ICT library, first in Application Code Manager, right click the MagneMotion device handler and select Add New.
In the wizard that pops up, type “raM_Opr_MM” in the filter box. You should see the Asynchronous Motion category that contains three AOIs for managing traffic lights. One by one, add the three traffic light AOIs to your project.
Once this is done, you can generate the new controller to create a MagneMotion device handler that is capable of controlling traffic lights.
If you want to update the MagneMotion device handler in an existing program, you can export the MagneMotion program (raM_Dvc_DH_MM) in from your newly generated project and re-import it in to your existing program along with the traffic light AOIs that you want to use. Note that it is not enough to just import the traffic light AOIs since Application Code Manager also has to modify the MagneMotion device handler to support traffic lights
Now that the PLC program is set up, the next step is to update the Node Controller to allow PLC controlled traffic lights.
In the MagneMotion Configurator tool pull up your Node Controller configuration file. Under PLC EthernNet/IP, click the box for Enable Traffic Lights and fill out the Maximum Traffic Light ID value.
Once the new configuration file is uploaded to the Node Controller in the PLC tags, make sure that the traffic light arrays are the right size. Once that’s done you should be all set to use your PLC to control the traffic light
Creating Traffic Lights
To create a traffic light from the PLC, you have to make use of the Create Traffic Light AOI.
Setting this AOI up is simple. First, create an instance of the AOI raM_Opr_MM_CreateTrafficLight in your program and put the Hndl tag from the device handler into the Ref_Handle input. Next, populate the Cfg_PathID and Cfg_Position tags for your traffic light (the position value should be the distance in mm from the start of your path to the traffic light position).
Toggling bCreateTrafficLight in the above code will command the PLC to send a message to the Node Controller to create a traffic light. Note that you do not define what the ID of the new traffic light will be; the Node Controller simply assigns it the next available ID. It is usually a good idea to store the Sts_TrafficLightId returned by the AOI so that you can use the traffic light later.
Setting Traffic Lights
The Set Traffic Light AOI is used to send messages to the Node Controller to change the color of a traffic light.
To use this AOI, create an instance of it and add the Device Handler Hndl tag. Then, just set the ID of the traffic light you wish to set, the color you want to set the traffic light (0 is Green, 1 is Red), and run the AOI.
Toggling bSetTrafficLightGreen in the above code will command the PLC to send a message to the traffic light created earlier to change it green.
Deleting Traffic Lights
Traffic lights will be deleted whenever the path they are on is reset. This means that it is important to include logic to recreate your traffic lights in your track startup logic.
You can do this by triggering a command to create traffic lights into whatever sequence you use to reset paths. However, a useful tactic can also be to check the status of the path the traffic light is on and triggering a creation command whenever the path becomes Operational
If you are planning on using traffic lights to restrict movement of vehicles to areas where machinery might collide with a vehicle, make sure to verify that the traffic lights have been created before sending any vehicle commands. Information on existing traffic lights can be found in the MMI_traffic_light_status controller tag.
If you want to delete a traffic light, there is an AOI similar to the Set Traffic Light AOI that can be used basically the same way.
Topics to look forward to in this series:
- MagneMotion Blog Part 8: Simulation
Learn more about DMC's MagneMotion expertise and contact us for your next project.