Configure a Scenario With an Excel File

Caution

Still WIP and might not work.

Excel-file setup

  1. Open Excel-file (eelib\utils\simulation_setup\sim_config_data.xlsx). This one is part of the utils package.

  2. The sheets bus, load, ext_grid, trafo, line, sgen, storage are used to configure the grid.

    The sheets in a scenario setup excel.
  3. To add a new entity to the grid you create a new row and include the index name and the init_vals of the element. More information about the characteristics of the grid elements: https://pandapower.readthedocs.io/en/v2.13.1/elements.html

    (Make sure you have at least one transformer, one external grid and buses are connected through lines)

    Example sheet for buses in a scenario setup excel.
  4. After configurating the grid you can add the model entities.

    1. Open the sheet ems and define the number of ems and connect them to a bus

    2. Households, charging stations or pv can be connected to a bus too (but only one per bus)

    3. Adding a new entitiy of a model type is similar to add a new grid element ( important is to set the connection to an ems or a bus and differentiate between csv_reader model or exact mode type

    4. Now set the init_vals for every entity of the model type

    Example sheet for buses in a scenario setup excel.

Create .json files for scenario

  1. Open jupyter notebook eelib\\utils\\simulation_setup\\script_sim_setup.ipynb

  2. Run the corresponding cells to import the packages and set the input and output paths:

    To create a grid
    1. Read the sheets from the excel file

    2. Run the “create grid data file” cell

    3. An image of the grid is shown underneath and the .json-file is safed at C:/Users/Puplic/Documents

    To create model data file
    1. Read the model type sheets frome the excel file

    2. Run “create model data file” cell

    3. .json-file is safed at C:/Users/Public/Documents

    To create connection file
    1. Run the cell “Create model_grid_config file”

    2. File is safed at C:/Users/Public/Documents

  3. Now run a scenario file from examples folder, e.g. test_scenario_grid or test_scenario_building

Add a completely new model type

  1. Create a new sheet for the model type in the excel file

  2. Create entities and set the init_vals and the connection to a bus or ems for the new model type

  3. Open the jupyter notebook eelib\\utils\\simulation_setup\\script_sim_setup.ipynb

    1. Read the new excel sheet

      df_new_model_type = pd.read_excel(FILE_SCENARIO_INPUT, sheet_name="new_model_type", index_col=0)
      
    2. Add new model entities to model_data file (if necessery differentiate between exact- and csv-model)

      #create an empty list for the new model type
      new_model_type = []
      for i in df_new_model_type.index:
      # Add all init_vals for model type
         new_model_type_data = {
            "datafile": df_new_model_type.at[i, "datafile"],
            "start_time": df_new_model_type.at[i, "start_time"],
            "date_format": df_new_model_type.at[i, "date_format"],
            "header_rows": int(df_new_model_type.at[i, "header_rows"]),
         }
         new_model_type.append(new_model_type_data)
      # add new model type list to dictionary
      model_data= { ...
                  new_model_type : new_model_type
      }
      
    3. Add new model type to model_grid_config file

      # create an empty list for the new model type
      new_model_types = []
      # loop over all entities
      for j in df_new_model_type.index:
            # if the entity is connected with bus or ems the name of the entity is added to the list new_model_types
            if df_loads.at[i, "bus"] == df_new_model_type.at[j, "bus"] or ems_idx == df_new_model_type.at[j, "ems"]:
                  new_model_type = df_new_model_type.at[j, "name"]
                  new_model_types.append(new_model_type)
      # add new model type list to dictionary
      elements = {...
            new_model_type: new_model_types
      }
      
  4. Now run the cells to create new .json files