Package org.goplanit.project
Class CustomPlanItProject
- java.lang.Object
-
- org.goplanit.project.CustomPlanItProject
-
- Direct Known Subclasses:
PlanItProject
,PlanItSimpleProject
,TntpProject
public class CustomPlanItProject extends Object
The top-level class which hosts a single project. A project can consist of multiple networks, demands and traffic assignments all based on a single configuration (user classes, modes etc.)- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected ProjectAssignmentBuilders
assignmentBuilders
The registered assignment buildersProjectDemands
demands
The registered demandsprotected long
id
unique identifier for this project across all projects in the JVMprotected InputBuilderListener
inputBuilderListener
the listener that we register on each traffic assignment component creation event for external initializationprotected PlanItProjectInput
inputs
The input container holding all traffic assignment input components and related functionality with respect to project managementProjectOdPathSets
odPathSets
The registered OD path setsprotected TreeMap<Long,OutputFormatter>
outputFormatters
The output formatter(s) registered on this projectProjectNetworks
physicalNetworks
The registered physical networksprotected IdGroupingToken
projectToken
id generation using this token will be contiguous and unique for all instances created with this token.ProjectRoutedServices
routedServices
The registered routed servicesProjectServiceNetworks
serviceNetworks
The registered service networksProjectZonings
zonings
The registered zonings
-
Constructor Summary
Constructors Constructor Description CustomPlanItProject(InputBuilderListener inputBuilderListener)
Constructor which reads in the input builder listener and instantiates the object factory classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Demands
createAndRegisterDemands(Zoning zoning, LayeredNetwork<?,?> network)
Create and register demands to the projectLayeredNetwork<?,?>
createAndRegisterInfrastructureNetwork(String infrastructureNetworkType)
Create and register an infrastructure based network on the projectInitialMacroscopicLinkSegmentCost
createAndRegisterInitialLinkSegmentCost(LayeredNetwork<?,?> network, String fileName)
Create and register initial link segment costs from a (single) file which we assume are available in the native xml/csv output format as provided in this projectInitialMacroscopicLinkSegmentCost
createAndRegisterInitialLinkSegmentCost(LayeredNetwork<?,?> network, String fileName, TimePeriod timePeriod)
Create and register initial link segment costs from a (single) file and register it to the provided time periodMacroscopicNetwork
createAndRegisterMacroscopicNetwork()
Create and register a macroscopic network on the projectOdPathSets
createAndRegisterOdPathSets(NetworkLayer networkLayer, Zoning zoning, String odPathSetInputPath)
Create and register the OD path sets as populated by the input builder through the path sourceOutputFormatter
createAndRegisterOutputFormatter(String outputFormatterType)
Create and register an output formatter instance of a given typeRoutedServices
createAndRegisterRoutedServices(ServiceNetwork serviceNetwork)
Create and register routed services to the projectServiceNetwork
createAndRegisterServiceNetwork(MacroscopicNetwork network)
Create and register service networks to the projectTrafficAssignmentConfigurator<? extends TrafficAssignment>
createAndRegisterTrafficAssignment(String trafficAssignmentType, Demands theDemands, Zoning theZoning, LayeredNetwork<?,?> theNetwork)
Create and register a traffic assignment instance of a given typeZoning
createAndRegisterZoning(LayeredNetwork<?,?> network)
Create and register the zoning system on the networkvoid
executeAllTrafficAssignments()
Execute all registered traffic assignments Top-level error recording is done in this class.protected void
executeTrafficAssignment(TrafficAssignment ta)
Execute a particular traffic assignmentList<InitialMacroscopicLinkSegmentCost>
getInitialLinkSegmentCost(LayeredNetwork<?,?> network)
Return the initial link segment costs for a networkOutputFormatter
getOutputFormatter(long id)
Retrieve an output formatter object given its idvoid
registerEligibleTrafficComponentClass(Class<? extends PlanitComponent<?>> theClazz)
Register a class that we allow to be instantiated as a concrete implementation of a traffic assignment component that can be used in PLANit
-
-
-
Field Detail
-
id
protected final long id
unique identifier for this project across all projects in the JVM
-
projectToken
protected IdGroupingToken projectToken
id generation using this token will be contiguous and unique for all instances created with this token. This token is related to the current instance of this class, i.e., the project
-
inputs
protected final PlanItProjectInput inputs
The input container holding all traffic assignment input components and related functionality with respect to project management
-
inputBuilderListener
protected final InputBuilderListener inputBuilderListener
the listener that we register on each traffic assignment component creation event for external initialization
-
assignmentBuilders
protected final ProjectAssignmentBuilders assignmentBuilders
The registered assignment builders
-
outputFormatters
protected final TreeMap<Long,OutputFormatter> outputFormatters
The output formatter(s) registered on this project
-
physicalNetworks
public final ProjectNetworks physicalNetworks
The registered physical networks
-
demands
public final ProjectDemands demands
The registered demands
-
zonings
public final ProjectZonings zonings
The registered zonings
-
odPathSets
public final ProjectOdPathSets odPathSets
The registered OD path sets
-
serviceNetworks
public final ProjectServiceNetworks serviceNetworks
The registered service networks
-
routedServices
public final ProjectRoutedServices routedServices
The registered routed services
-
-
Constructor Detail
-
CustomPlanItProject
public CustomPlanItProject(InputBuilderListener inputBuilderListener)
Constructor which reads in the input builder listener and instantiates the object factory classes. This constructor instantiates the EventManager, which must be a singleton class for the whole application.- Parameters:
inputBuilderListener
- InputBuilderListener used to read in data
-
-
Method Detail
-
executeTrafficAssignment
protected void executeTrafficAssignment(TrafficAssignment ta)
Execute a particular traffic assignment- Parameters:
ta
- TrafficAssignment to be run
-
registerEligibleTrafficComponentClass
public void registerEligibleTrafficComponentClass(Class<? extends PlanitComponent<?>> theClazz) throws PlanItException
Register a class that we allow to be instantiated as a concrete implementation of a traffic assignment component that can be used in PLANit- Parameters:
theClazz
- the class that we want to mark as eligible from an outside source- Throws:
PlanItException
- thrown if class cannot be registered
-
createAndRegisterInfrastructureNetwork
public LayeredNetwork<?,?> createAndRegisterInfrastructureNetwork(String infrastructureNetworkType) throws PlanItException
Create and register an infrastructure based network on the project- Parameters:
infrastructureNetworkType
- name of infrastructure network class to register- Returns:
- the generated infrastructure network
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterMacroscopicNetwork
public MacroscopicNetwork createAndRegisterMacroscopicNetwork() throws PlanItException
Create and register a macroscopic network on the project- Returns:
- the generated macroscopic network
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterZoning
public Zoning createAndRegisterZoning(LayeredNetwork<?,?> network) throws PlanItException
Create and register the zoning system on the network- Parameters:
network
- the network on which the zoning will be based- Returns:
- the generated zoning object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterDemands
public Demands createAndRegisterDemands(Zoning zoning, LayeredNetwork<?,?> network) throws PlanItException
Create and register demands to the project- Parameters:
zoning
- Zoning object which defines the zones which will be used in the demand matrix to be creatednetwork
- the network which stores the modes (demands can different for each mode)- Returns:
- the generated demands object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterServiceNetwork
public ServiceNetwork createAndRegisterServiceNetwork(MacroscopicNetwork network) throws PlanItException
Create and register service networks to the project- Parameters:
network
- the network upon which the service network is built- Returns:
- the generated service network object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterRoutedServices
public RoutedServices createAndRegisterRoutedServices(ServiceNetwork serviceNetwork) throws PlanItException
Create and register routed services to the project- Parameters:
serviceNetwork
- the service network upon which the routed services are defined- Returns:
- the generated routed services object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterOdPathSets
public OdPathSets createAndRegisterOdPathSets(NetworkLayer networkLayer, Zoning zoning, String odPathSetInputPath) throws PlanItException
Create and register the OD path sets as populated by the input builder through the path source- Parameters:
networkLayer
- network layer the paths must be compatible withzoning
- zoning to match od paths toodPathSetInputPath
- path to collect the paths from- Returns:
- od path sets that have been parsed
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterTrafficAssignment
public TrafficAssignmentConfigurator<? extends TrafficAssignment> createAndRegisterTrafficAssignment(String trafficAssignmentType, Demands theDemands, Zoning theZoning, LayeredNetwork<?,?> theNetwork) throws PlanItException
Create and register a traffic assignment instance of a given type- Parameters:
trafficAssignmentType
- the class name of the traffic assignment type object to be createdtheDemands
- the demandstheZoning
- the zoningtheNetwork
- the network- Returns:
- the traffic assignment configurator object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterInitialLinkSegmentCost
public InitialMacroscopicLinkSegmentCost createAndRegisterInitialLinkSegmentCost(LayeredNetwork<?,?> network, String fileName) throws PlanItException
Create and register initial link segment costs from a (single) file which we assume are available in the native xml/csv output format as provided in this project- Parameters:
network
- network the InitialLinkSegmentCost object will be registered forfileName
- file containing the initial link segment cost values- Returns:
- the InitialLinkSegmentCost object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterInitialLinkSegmentCost
public InitialMacroscopicLinkSegmentCost createAndRegisterInitialLinkSegmentCost(LayeredNetwork<?,?> network, String fileName, TimePeriod timePeriod) throws PlanItException
Create and register initial link segment costs from a (single) file and register it to the provided time period- Parameters:
network
- network the InitialLinkSegmentCost object will be registered forfileName
- location of file containing the initial link segment cost valuestimePeriod
- to register the initial cost on- Returns:
- the InitialLinkSegmentCostPeriod object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterOutputFormatter
public OutputFormatter createAndRegisterOutputFormatter(String outputFormatterType) throws PlanItException
Create and register an output formatter instance of a given type- Parameters:
outputFormatterType
- the class name of the output formatter type object to be created- Returns:
- the generated output formatter object
- Throws:
PlanItException
- thrown if there is an error
-
getInitialLinkSegmentCost
public List<InitialMacroscopicLinkSegmentCost> getInitialLinkSegmentCost(LayeredNetwork<?,?> network)
Return the initial link segment costs for a network- Parameters:
network
- the specified network- Returns:
- the initial link segment costs for the specified physical network
-
getOutputFormatter
public OutputFormatter getOutputFormatter(long id)
Retrieve an output formatter object given its id- Parameters:
id
- the id of the output formatter object- Returns:
- the retrieved output formatter object
-
executeAllTrafficAssignments
public void executeAllTrafficAssignments() throws PlanItException
Execute all registered traffic assignments Top-level error recording is done in this class. If several traffic assignments are registered and one fails, we record its error and continue with the next assignment.- Throws:
PlanItException
- required for subclasses which override this method and generate an exception before the runs start
-
-