Class CustomPlanItProject

  • Direct Known Subclasses:
    PlanItProject, PlanItSimpleProject

    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
    • 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

      • initialiseFactories

        protected void initialiseFactories()
        Instantiate the factories and register the event manager on them
      • executeTrafficAssignment

        protected void executeTrafficAssignment​(TrafficAssignment ta)
        Execute a particular traffic assignment
        Parameters:
        ta - TrafficAssignment to be run
      • registerEligibleTrafficComponentClass

        public void registerEligibleTrafficComponentClass​(Class<? extends TrafficAssignmentComponent<?>> 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
      • createAndRegisterPhysicalNetwork

        public PhysicalNetwork createAndRegisterPhysicalNetwork​(String physicalNetworkType)
                                                         throws PlanItException
        Create and register a physical network on the project
        Parameters:
        physicalNetworkType - name of physical network class to register
        Returns:
        the generated physical network
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterZoning

        public Zoning createAndRegisterZoning​(PhysicalNetwork physicalNetwork)
                                       throws PlanItException
        Create and register the zoning system on the network
        Parameters:
        physicalNetwork - the physical 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,
                                                PhysicalNetwork physicalNetwork)
                                         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 created
        physicalNetwork - the physical network which stores the modes (demands can different for each mode)
        Returns:
        the generated demands object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterODRouteSets

        public ODRouteSets createAndRegisterODRouteSets​(PhysicalNetwork physicalNetwork,
                                                        Zoning zoning,
                                                        String odRouteSetInputPath)
                                                 throws PlanItException
        Create and register the OD route sets as populated by the input builder through the path source
        Parameters:
        physicalNetwork - network the routes must be compatible with
        zoning - zoning to match od routes to
        odRouteSetInputPath - path to collect the routes from
        Returns:
        od route sets that have been parsed
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterTrafficAssignment

        public TrafficAssignmentBuilder createAndRegisterTrafficAssignment​(String trafficAssignmentType,
                                                                           Demands theDemands,
                                                                           Zoning theZoning,
                                                                           PhysicalNetwork thePhysicalNetwork)
                                                                    throws PlanItException
        Create and register a deterministic traffic assignment instance of a given type
        Parameters:
        trafficAssignmentType - the class name of the traffic assignment type object to be created
        theDemands - the demands
        theZoning - the zoning
        thePhysicalNetwork - the physical network
        Returns:
        the traffic assignment builder object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterInitialLinkSegmentCost

        public InitialLinkSegmentCost createAndRegisterInitialLinkSegmentCost​(PhysicalNetwork 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 - physical network the InitialLinkSegmentCost object will be registered for
        fileName - file containing the initial link segment cost values
        Returns:
        the InitialLinkSegmentCost object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterInitialLinkSegmentCost

        public InitialLinkSegmentCostPeriod createAndRegisterInitialLinkSegmentCost​(PhysicalNetwork 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 - physical network the InitialLinkSegmentCost object will be registered for
        fileName - location of file containing the initial link segment cost values
        timePeriod - to register the initial cost on
        Returns:
        the InitialLinkSegmentCostPeriod object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterInitialLinkSegmentCost

        public List<InitialLinkSegmentCostPeriod> createAndRegisterInitialLinkSegmentCost​(PhysicalNetwork network,
                                                                                          String fileName,
                                                                                          Demands demands)
                                                                                   throws PlanItException
        Create and register initial link segment costs from a (single) file for all time periods in Demands object
        Parameters:
        network - physical network the InitialLinkSegmentCost object will be registered for
        fileName - location of file containing the initial link segment cost values
        demands - the Demands object to extract all eligible time periods from
        Returns:
        the InitialLinkSegmentCostPeriod objects
        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<InitialLinkSegmentCost> getInitialLinkSegmentCost​(PhysicalNetwork network)
        Return the initial link segment costs for a network
        Parameters:
        network - the specified physical 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