Write Excel Files in SAInt Import Format

This section describes how to write Excel files for network, profiles, and events in SAInt Import format. We will continue with the same triangle dataset from the previous two sections:

  • Define Network Objects

  • Define Profiles, Scenarios, and Events

1. Write a Network File

After creating the pySAInt electric dataset with its associated objects and properties, we can use the write_network method of the dataset to write the SAInt Network Import Excel File. This method accepts the following argument:

Parameter Type Description

path

str, path object

The path where the SAInt Network Import Excel File will be saved.

Defaults to saving as network.xlsx in the current working directory if not specified.

# Write the SAInt Network Import Excel File to the current working directory
triangle.write_network()
python

2. Write Profiles

After adding the profiles to the pySAInt electric dataset with the associated profile properties, we can use the write_profiles method of the dataset to write the SAInt Profile Import Excel File. This method accepts the following argument:

Parameter Type Description

path

str, path object

The path where the SAInt Profile Import Excel File will be saved.

Defaults to saving as profiles.xlsx in the current working directory if not specified.

# Write the SAInt Profile Import Excel File to the current working directory
triangle.write_profiles()
python

3. Write Events

After adding the events to the pySAInt electric dataset with the associated scenario, we can use the write_events method of the dataset to write the SAInt Events Import Excel File. This method accepts the following argument:

Parameter Type Description

path

str, path object

The path where the SAInt Excel Import Excel File will be saved.

Defaults to saving as events.xlsx in the current working directory if not specified.

This method provides an intuitive approach to manage the export of events to SAInt Events Import Excel File, accommodating datasets that comprise either a single scenario or multiple scenarios.

# Write the SAInt Events Import Excel File to the current working directory
triangle.write_events()
python

Single Scenario: When the dataset contains only one scenario, the events file is saved using the specified path. If no path is provided, the default filename "events.xlsx" is used, and the file is saved in the current working directory.

Multiple Scenarios: For datasets containing multiple scenarios, the method automatically adjusts the naming convention of the output files to distinguish between the different scenarios. It appends the name of each scenario to the base filename provided in path. This results in unique filenames for each scenario, facilitating organized storage and easy identification of scenario-specific event data. For instance, if the base filename is "events.xlsx" and the scenarios are Scenario1 and Scenario2, the output files will be named "events_Scenario1.xlsx" and "events_Scenario2.xlsx", respectively.