Edit a CEM

This section outlines the procedure for editing an existing CEM using pySAInt. The process involves reading CEM object properties, scenario information, horizon input, events, profiles, and output property selections. In this guide, we will use the CEM input files generated from the "Build a CEM" section.

1. Initialize the pySAInt Dataset

import pysaint as ps

# This creates an empty electric dataset
dataset = ps.create_electric_dataset()
python

This initial step prepares an empty dataset. You can read an exisiting SAInt electric network import file using the read_electric_network method and populate the dataset. Objects can also be added manually using the add_object or add_objects_from_dataframe method. For this guide, we will proceed by using the empty electric dataset.

2. Read CEM Input Files

The read_cem_input_files method is designed to populate an existing pySAInt dataset with data from CEM input files. It accepts the following parameters:

Parameter Type Description

path_or_buf

str

Path to the CEM Input folder containing the CEM input files.

cem_scenario

str

CEM scenario name, containing the input data from the CEM input files.

Ensure to update the directory path to where the CEM input files are stored. The example below uses the path to the directory containing the CEM input files generated in the "Build a CEM" section.

import os

# Read CEM Input Files
dataset.read_cem_input_files(
  path_or_buf=os.path.join(os.getcwd(), "CEM_ESCE", "Input"),
  cem_scenario="CEM_ESCE"
)
python

If the dataset is empty (contains no objects) before reading the CEM input files, a WARNING message is logged. It is recommended to populate the dataset with the network objects to which the CEM properties are added.

3. What happens during the reading of CEM Input Files?

Upon executing read_cem_input_files, the method begins by validating the presence of ScenarioInfo.csv and adds scenario properties to the CEM scenario. If this file is missing, the process will not continue. Here’s what happens next:

  • Object Properties: Adds CEM object properties from investment default files like InvDefaults_EDEM.csv.

  • Horizon Input: Loads data from HorizonInput.csv into the CEM scenario if available .

  • Event Handling: Adds event data from InvEvents.csv into the CEM scenario if available.

  • Profiles: Adds profiles from RepPeriodTimeSeriesInput.csv into the CEM scenario if available.

  • Output Property Selection: Processes selections from ScalarOutputsPropertySelection.csv and TimeseriesOutputsPropertySelection.csv, identifying properties to be omitted from result printing.

The data now integrated into your pySAInt dataset is ready for further analysis or processing. Make sure to handle any potential errors that arise during file reading, especially related to file availability or format issues.