.settings
PlanitDemandsReader property
The PlanitDemandsReader
class instance can be created via the DemandsConverter
.
It provides the functionality to parse demands, e.g., travellers’ trips, in the native PLANit format, and persist it in the same
or another format using a DemandsWriter. Once created the user can configure its settings.
For information on the PLANit XML format, please consult the Data formats/Input/Default section
All configuration readers is performed via its .settings
property, providing access to the
PlanitDemandsReaderSettings
.
The user is required to explicitly configure at least the following settings on PlanitDemandsReader:
.settings.set_inputdirectory(+)
In addition to verify the correctness of the demands, they are expected to be related to a zoning system and network. Therefore, it is expected that a zoning reader (which in turn requires a network reader) is to be provided to the PLANit demands reader.
the user is then free to configure those readers separately. However, upon performing the conversion, the network and zoning will be parsed first and then mapped to the demands. After that, the demands - if all went well - are then written in the new format.
N/A
This class exposes the following properties:
Property | Availability | Description |
---|---|---|
.settings |
Always | Access to PlanitDemandsReaderSettings to configure the reader |
from planit import *
# create a network converter
planit_instance = Planit()
converter = planit_instance.converter_factory.create(ConverterType.DEMANDS)
# PLANit required readers - prep
net_reader = planit.converter_factory.create(ConverterType.NETWORK) \
.create_reader(NetworkReaderType.PLANIT)
network_settings: TntpNetworkReaderSettingsWrapper =
net_reader.settings.set_input_file(NETWORK_FILE_PATH)
zon_reader = planit.converter_factory.create(ConverterType.ZONING) \
.create_reader(ZoningReaderType.PLANIT, net_reader)
zon_reader.settings.set_input_file(ZONING_FILE_PATH)
# PLANit demands reader
planit_reader = converter.create_reader(DemandsReaderType.PLANIT, zon_reader)
planit_reader.settings.set_inputdirectory("<path_to_input_dir>")
# PLANit demands writer
planit_writer = network_converter.create_writer(DemandsWriterType.PLANIT)
planit_writer.settings.set_output_dir("<path_to_output_dir>")
# execute
converter.convert(planit_reader,planit_writer)
PlanitDemandsReaderSettings
for configuration of the PLANit demands reader
ConverterFactory
for the converter factory to create other types of converters
DemandsReaderType
for the supported demands reader types
DemandsWriterType
for the supported demands writer types
Class PlanitDemandsReaderWrapper
in converterwrappers.py
PlanitDemandsReader property