vcTransportSolution

Transport solution is a single route from one transport node (vcTransportNode) to another transport node without any branches or loops. The transport solutions are enforced to be valid when they are created or modified. The solution consists of an ordered list of transport link references (vcTransportLink), starting from the Source node and ending to the Destination node.

Note: A valid transport solution conforms to these rules:

 • Transport solution can be empty i.e. contain no links. Using empty solutions is not recommended. Set the vcProduct.TransportSolution to None instead.

 • Each transport link’s Source node is the same as the previous link’s Destination node (must form a continuous one-directional path)

 • No two links have the same Source node (cannot contain branches)

 • No two links have the same Destination node (cannot contain joins or loops)

 • The Source and Destination nodes of the whole solution cannot be the same (cannot be a loop).

Properties

Name Type Access Description
Source vcTransportNode R

The transport node this route starts from.

Returns None if the solution is empty.

Destination vcTransportNode R

The transport node this route ends to.

Returns None if the solution is empty.

Links List of vcTransportLink R The list of transport links that need to be travelled to get from the Source node to the Destination node, starting from Source.

Methods

Name Return Type Parameters Description
getNextLink vcTransportLink vcTransportNode node

Returns the transport link (there can be only one) that has the given transport node as its Source.

Returns None if such link doesn’t exist in the solution i.e. the route doesn’t start from or pass through that transport node.

replaceLinks None List of vcTransportLink links Replaces the route with given links. If the given links do not form a valid transport solution, an error is raised and the previous route is preserved.

Events

Name Parameters Description
OnSolutionInvalidated

vcTransportSolution solution

Triggered when any of the transport links in this solution has been deleted from the transport system, which would make the solution either invalid or change its ends.

Note: All transport links are removed from the solution before this event is triggered. The solution parameter is always this transport solution instance.

Examples

Example. Event handler when a product arrives to node.

from vcScript import *
sim = getSimulation()
process_controller = sim.ProcessController
transport_system = process_controller.TransportSystem
nodes = transport_system.Nodes
node = nodes[1]
# Event handler when a product arrives to node
def product_arrived_handler(product, link, event_data):
  print product.ProductType.Name, 'arrived to', link.Destination.Parent.Name
  
  source_name = product.TransportSolution.Source.Parent.Name
  destination_name = product.TransportSolution.Destination.Parent.Name
  print 'The products current Transport Solution is from', source_name, 'to', destination_name
  
  next_link = product.TransportSolution.getNextLink(node)
  if next_link:
    print 'The next Transport Link for this Transport Solution is', next_link
  else:
    print 'This Transport Solution does not have any more links'
node.OnProductArriving = product_arrived_handler