Blog

MagneMotion Guide Part 9: Traffic Jam Prevention

MagneMotion Guide Part 9: Traffic Jam Prevention

Previous Installments

In my previous blog, MagneMotion Blog Part 8: Simulation, we discussed track simulation, a valuable tool MagneMotion offers to help test out MagneMotion controls before a track is even assembled.

In this blog, we’ll discuss in detail how to manage traffic in your MagneMotion systems to prevent traffic jams and optimize your track’s efficiency.

Typical Traffic Issues

There are a few typical sources of traffic jams in a MagneMotion track:

Source 1

The first, and often most frequent traffic jam, occurs when too many vehicles are sent to a branch of track. This causes the branch to overflow with vehicles and blocks off the rest of the track.

a traffic jam on a magnemotion track

Source 2

Another less frequent but problematic jam can occur when too many vehicles are trying to circulate through a central loop of track in the system. This can create a situation where no vehicles can pass through.

A traffic jam on a Magnemotion track

Source 3

The final common case occurs when vehicles need to be sent backwards on your track. When not done carefully, this can result in deadlocked vehicles that get in each other’s way.

A traffic jam on a Magnemotion Track

Below, we’ll go through a way to organize your PLC program to prevent any such traffic jams from occurring.

Step 1: Monitoring Stations

The first step is to organize how the PLC program handles calls of the Station AOI.

First, create a data type that will contain the station AOI instance along with the following information:

  • A boolean tag to enable the station
  • A boolean command to send vehicles from the station
  • A dint to store the next station vehicles will be sent to
  • A dint to store the number of vehicles headed to the station
  • A dint to define the number of vehicles allowed to go to the station at a time

Now, create an arrayed tag that will store all of this information for each station on your track.

MagneMotion arrayed tag

Keeping all of the station information in a single centralized location will make it much easier to handle any complex routing logic.

Next, you need to create some structured text logic to monitor each station for incoming vehicles.

structured text logic

By looping through the mover array in the MagneMotion device handler, you can check how many vehicles are headed to any given station. This will give you valuable insight into which sections of your track might be in danger of developing traffic jams without having to deal with the tricky logic of manually keeping track of all of the vehicles sent to a station.

Step 2: Monitoring Paths

The second step in this setup is to create a similar udt to the one you made for stations. This path udt will contain the following information:

  • A variable for the contents of a path
  • The size of the path
  • A Boolean for whether or not the path is full

Path UDT in Magnemotion

Next, you’ll create another structured text code for monitoring the contents of each path.

Structured text code for monitoring path contents.

The above code will determine how many vehicles are currently on each path, allowing you to determine which sections of your track are already filled with vehicles.

For efficiency’s sake, you can combine the path monitoring and station monitoring code into a single for loop.

Step 3: Check if a Station is Full

So now that your PLC code is monitoring the status of all your stations and paths, how do you use that information to robustly manage your MagneMotion track?

If you populate iPathSize and iNumAllowedIncoming values for your paths and stations, you can use some fairly simple logic to determine when a station is able to accept any new material.

First, create a simple for loop to determine whether any paths are filled with vehicles.

Structured text for MagneMotion loop

Next, create some complimentary logic for determining whether any stations have too many vehicles being sent to them.

Loop logic for Magnemotion track.

Note that, to check if a station is full, we must also check to see whether the path it’s on is full. This way, we will account for cases when a station is being backed up by vehicles that are going to another station.

Also note that, if a path’s size or a station’s number of allowed incoming vehicles is 0, we will assume that the station/path is not full. This allows us to ignore paths and stations that will never cause traffic issues and reduce some of the overhead in setting up your track’s program.

Step 4: Sending Vehicles

Since you have information on each station, you can use this information to check a station’s availability before you send another vehicle to it. You can do this piecemeal by just checking the bStationIsFull bit before directing vehicles to particularly problematic stations, but I find it’s usually better to integrate this check into your station logic for a more robust solution.

Station logic overview in MagneMotion

Compare the above logic to the station logic in MagneMotion Guide Part 4: Using Path and Station AOIs. Here, we will check whether the target destination is full before we send the current vehicle at this station to any destination. This way we can be confident that we won’t cause any traffic jams with the vehicles that are leaving this station.

Also note how we latch the bit for checking if the destination station is full as we send a vehicle to it. This ensures that a station will only be sent one vehicle in a single PLC scan so that we don’t send multiple vehicles to one station before it's capacity can be re-evaluated. If the station has room for multiple vehicles the bStationIsFull bit will be reset in the next scan, allowing another station to send its vehicle.

Step 5: Preventing Loop Blockage

The issue of too many vehicles stopping up a loop of track was also brought up in MagneMotion Guide Part 7: Traffic Lights. Here we will go into more detail about how to actually develop the logic to trigger traffic lights.

Traffic jam on a Magnemotion Track

Using the path information compiled in Step 2, we can easily determine how many vehicles are in the loop of track.

From here, it is fairly straightforward to set up a basic system where when the number of vehicles in the loop exceeds a set value, we turn on traffic lights at each entrance to the loop. At this point, no more vehicles will be able to enter the loop while vehicles will still be able to exit the loop freely.

Structured text code.

Step 6: Backup Permissions

If you find you need to send a vehicle in reverse direction down your track, you can also safely do this by monitoring path contents.

For example, say you have a vehicle on a branch of your track that needs to back up back onto your main loop of track before continuing along.

If you set up a traffic light on the main section of track and turn it red while there are no vehicles on the path you need to back up onto, you can be confident that you can back up your vehicle without causing a deadlock with a vehicle headed the other way.

MagneMotion track Overview

Overview

Now that your PLC program is set up to monitor paths and stations, you are ready to further develop your MagneMotion track for maximum efficiency. These station and path checks are not meant to compose an entire routing system, but they are valuable building blocks for defining your own routing system.

While only a few use cases for station and path monitoring have been shown here, the general tools these tactics provide can be used in a variety of ways and different systems to help guarantee that your track runs smoothly.

Learn more about DMC's MagneMotion expertise and contact us for your next project. 

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above: