Class PlanitMatsimWriterModeMappingSettings

    • Field Detail

      • DEFAULT_PLANIT2MATSIM_MODE_MAPPING

        protected static final Map<PredefinedModeType,​String> DEFAULT_PLANIT2MATSIM_MODE_MAPPING
        provides the default mapping from planit modes ((predefined) mode name) to MATSIM mode (string)
      • DEFAULT_ACTIVATED_MODES

        protected static final Set<PredefinedModeType> DEFAULT_ACTIVATED_MODES
        track the PLANit modes that we include in the network to write
      • planit2MatsimModeMapping

        protected final Map<PredefinedModeType,​String> planit2MatsimModeMapping
        provides the mapping from PLANit modes ((predefined) mode name) to MATSIM mode (string)
      • activatedPlanitModes

        protected final Set<PredefinedModeType> activatedPlanitModes
        track the PLANit modes that we include in the network to write
      • DEFAULT_RESTRICT_SPEED_LIMIT_BY_SUPPORTED_MODE

        public static final Boolean DEFAULT_RESTRICT_SPEED_LIMIT_BY_SUPPORTED_MODE
        Default setting for restricting a link's max speed by its supported mode max speeds if more restricting
      • DEFAULT_PUBLIC_TRANSPORT_MODE

        public static final String DEFAULT_PUBLIC_TRANSPORT_MODE
        default mode for all public transport modes in Matsim is pt, so that is what we use for initial mapping
        See Also:
        Constant Field Values
      • DEFAULT_PRIVATE_TRANSPORT_MODE

        public static final String DEFAULT_PRIVATE_TRANSPORT_MODE
        default mode for all private transport modes in Matsim is car, so that is what we use for initial mapping
        See Also:
        Constant Field Values
    • Constructor Detail

      • PlanitMatsimWriterModeMappingSettings

        protected PlanitMatsimWriterModeMappingSettings​(PlanitMatsimWriterModeMappingSettings other)
        Shallow copy constructor. Can be sued when mode mappings requires syncing across various settings classes that are used simulatneously
        Parameters:
        other - to create shallow copy (with respect to mode mappings)
      • PlanitMatsimWriterModeMappingSettings

        public PlanitMatsimWriterModeMappingSettings​(String countryName)
        constructor
        Parameters:
        countryName - to use
      • PlanitMatsimWriterModeMappingSettings

        public PlanitMatsimWriterModeMappingSettings​(String outputDirectory,
                                                     String countryName)
        constructor
        Parameters:
        outputDirectory - to use
        countryName - to use
      • PlanitMatsimWriterModeMappingSettings

        public PlanitMatsimWriterModeMappingSettings​(String outputDirectory,
                                                     String outputFileName,
                                                     String countryName)
        constructor
        Parameters:
        outputDirectory - to use
        outputFileName - to use
        countryName - to use
      • PlanitMatsimWriterModeMappingSettings

        public PlanitMatsimWriterModeMappingSettings​(String outputDirectory,
                                                     String outputFileName,
                                                     String countryName,
                                                     Map<PredefinedModeType,​String> planit2MatsimModeMapping,
                                                     Set<PredefinedModeType> activatedPlanitModes)
        constructor
        Parameters:
        outputDirectory - to use
        outputFileName - to use
        countryName - to use
        planit2MatsimModeMapping - instead of using an internally created instance based on defaults, use the provided mapping as a starting point
        activatedPlanitModes - instead of using an internally created instance based on defaults, use the provided activated modes as a starting point
    • Method Detail

      • createDefaultPredefinedModeMappings

        protected static Map<PredefinedModeType,​String> createDefaultPredefinedModeMappings()
        Initialise the predefined PLANit modes to MATSIM mode mapping, based on the (predefined) mode names. MATSIM seems not to have any predefined modes, so any name can be given to them. We therefore apply the PLANit's name attribute as the id for the mapping to MATSIM mode
        Returns:
        default mode mapping based on predefined modes
      • getDefaultPredefinedModeMappings

        protected static String getDefaultPredefinedModeMappings​(PredefinedModeType modeType)
        Collect the default mapping from PLANit predefined mode to MATSim mode
        Parameters:
        modeType - to get MATSim default mapping for
        Returns:
        default mapping found
      • createDefaultActivatedPlanitModes

        protected static Set<PredefinedModeType> createDefaultActivatedPlanitModes()
        Create the default activate PLANit modes that the MATSIM write will include when writing the network (if they are available). By default, all predefined PLANit modes that could be reasonably mapped to motorised private mode car (car) or public transport (pt) are activated.
        Returns:
        default activate PLANit modes (by name)
      • logSettings

        protected void logSettings​(MacroscopicNetwork macroscopicNetwork)
        Convenience method to log all the current settings
        Parameters:
        macroscopicNetwork - provided for reference
      • updatePredefinedModeMapping

        public void updatePredefinedModeMapping​(PredefinedModeType planitModeType,
                                                String matsimMode)
        Overwrite a mapping from a predefined PLANit mode to a particular MATSim mode
        Parameters:
        planitModeType - PLANit mode
        matsimMode - the new MATSim mode string to use
      • deactivatePredefinedMode

        public void deactivatePredefinedMode​(PredefinedModeType planitModeType)
        Remove the provided predefined mode from the activated modes listed for inclusion in the MATSIM network (in mapped form)
        Parameters:
        planitModeType - to deactivate
      • deactivateAllModes

        public void deactivateAllModes()
        Deactivate all currently activated modes
      • activatePredefinedMode

        public void activatePredefinedMode​(PredefinedModeType planitModeType)
        Activate the provided predefined mode from the activated modes listed for inclusion in the MATSIM network (in mapped form). By default all PLANit modes are active, so this is only needed when a mode has been deactivated earlier
        Parameters:
        planitModeType - to activate
      • collectActivatedPlanitModeToMatsimModeMapping

        public Map<Mode,​String> collectActivatedPlanitModeToMatsimModeMapping​(MacroscopicNetworkLayerImpl networkLayer)
        Creating a mapping from actual PLANit modes in the network to the MATSIM mode mapping as per the configuration in this class instance
        Parameters:
        networkLayer - the networkLayer
        Returns:
        the mapped PLANit mode instances to MATSIM modes (string)