File I/O

Parsing functions in PowerWaterModels use the native parsing features of PowerModelsDistribution and WaterModels with extra features to parse information used to couple the two infrastructures.

Coupling Data Format

The PowerWaterModels parsing implementation relies on data formats that support extensions to accommodate arbitrary extra data fields, such as those required to define couplings between infrastructures. Thus, PowerWaterModels largely relies on parsing of MATPOWER, OpenDSS, and EPANET input files to populate some data fields. In addition, the coupling between loads and pumps is accomplished via a tertiary JSON linking file of the following form (further detailed in Interdependency Information):

{
    "it": {
        "dep": {
            "pump_load": {
                "1": {
                    "pump": {
                        "source_id": <String> # Index in the source water
                        # network data file of the pump that is being modeled
                        # in the interdependency.
                    },
                    "load": {
                        "source_id": <String> # Index in the source power
                        # network data file of the load that is being modeled
                        # in the interdependency.
                    },
                    "status": <Int64> # Indicator (-1, 0, or 1) specifying if
                    # the status of the interdependency is unknown (-1, i.e.,
                    # potentially on _or_ off), inactive (0, i.e., off) or 
                    # active (1, i.e., on).
                },
                "2": {
                    ...
                },
                ...
            }
        },
    "pmd": {
        "source_type": <String> # Type of input file used to describe the power
        # distribution network model. Can be "opendss" or "matpower".
        ...
    },
    "wm": {
        "source_type": <String> # Type of input file used to describe the water
        # distribution network model. Can currently only be set to "epanet".
        ...
    }
}

Parsing Functions

The following functions can be used for convenient parsing of input files.

PowerWaterModels.parse_filesFunction
parse_files(power_path, water_path, link_path)

Parses power, water, and linking data from power_path, water_path, and link_path, respectively, into a single data dictionary. Returns a PowerWaterModels multi-infrastructure data structure keyed by the infrastructure type it.

source
PowerWaterModels.parse_jsonFunction
parse_json(path)

Parses a JavaScript Object Notation (JSON) file from the file path path and returns a PowerWaterModels data structure that links power and water networks (a dictionary of data).

source