Tranmission & Distribution Co-Simulation ExampleΒΆ

This is an example of a Simple T&D Co-Simulation. This example will take a simple static power system model and add a detailed secondary side with individual residences with a collection of devices such a HVAC, Water heater, Pool pumps, etc. Then also add a Transmission system using MATPOWER

To get started nagivate to the following folder within the main script base and open the coSimulationTD.py script.

# navigate to the repositories folder
cd $HOME/repositories

# from here navigate to main landing for experiment runs
cd modificationScipts
nano coSimulationTD.py

This script will contain all of the setting you have available for the experiment. The following will explain the settings:

# ---------------------------------------------------------------
# ----------------------- Settings ------------------------------
# ---------------------------------------------------------------

# name of the experiment
experimentName = 'tdExample'

# number of distribution systems in the experiment
distributionSystemNumber = 2

# create simple bash run scipt that will start a GridLAB-D instance per feeder
createRunScripts = True

# create HPC run scipt that will work with the Co-Simulation launcher capability
createHPCScripts = False

# this assumes that everything associated with this experiment is in a certain folder structure. This is the path to the root folder
rootPath = '/people/hans464/helicsUseCaseScripts'

# path to where you want the experiment outputs (if left empty we assume /experiments)
experimentFilePath = ''

# file path that contains the GLMs to extract (if left empty we assume /modelDependency/feeders)
feederFilePath = ''

# file path that contains include files for the experiment (if left empty we assume /modelDependency)
includeFilePath = ''

# dictionary that holds all the log level information for each type of federate
simulatorLogLevels = dict()
simulatorLogLevels['fncs'] = 'WARNING'
simulatorLogLevels['matpower'] = 'INFO'

# specify the port fncs will use to communicate on
fncsPort = '7777'

# list of distribution systems models and their population distribution for the experiment (feeder : [percent [.], region [#])
inputGLM = dict()
inputGLM['small4BusSystem.glm'] = [1, 1]
#inputGLM['R1-12.47-1.glm'] = [0.14, 1]
#inputGLM['R1-12.47-2.glm'] = [0.14, 1]
#inputGLM['R1-12.47-3.glm'] = [0.14, 1]
#inputGLM['R2-12.47-1.glm'] = [0.08, 2]
#inputGLM['R2-12.47-2.glm'] = [0.07, 2]
#inputGLM['R2-12.47-3.glm'] = [0.07, 2]
#inputGLM['R3-12.47-1.glm'] = [0.12, 3]
#inputGLM['R3-12.47-2.glm'] = [0.12, 3]
#inputGLM['R3-12.47-3.glm'] = [0.12, 3]


# This specifies what technologies to use. What is specified here will overwrite the defaults in the technologyConfiguration.py
useFlags = dict()
useFlags['use_FNCS'] = 0
useFlags['use_HELICS'] = 1
useFlags['core_type_HELICS'] = 'zmq'

# This specifies what feeder configuration to use. What is specified here will overwrite the defaults in the feederConfiguration.py
feederConfig = dict()
# this can enable logging to a mysql database instead of csv files
feederConfig['sequelLogging'] = False
feederConfig["sequelSettings"] = ['localhost','gridlabd','passGLD123','3306','0']
# some settings to upgrade the equipment of the feeders
feederConfig['fuses_upgrade_level'] = 2
feederConfig['transformer_upgrade_level'] = 1
feederConfig['transformer_upgrade_cutoff'] = 100
# start and stop time for the simulation
feederConfig['startdate'] = '2013-08-28 00:00:00'
feederConfig['stopdate'] = '2013-08-29 00:00:00'
# edit the files being recorder and the interval
feederConfig['measure_interval'] = 30
feederConfig['recorders'] = {'HVAC': True}
feederConfig['short_names'] = False
feederConfig['suppress_repeat_messages'] = 'True'
feederConfig['tmy_higher_fidelity'] = False
feederConfig['tmy_higher_fidelity_path'] = Path(rootPath) / 'modelDependency' / 'transmission' / 'tmy_higher_fidelity.csv'

# createing a dict for the transmission system
transmissionConfig = {}
transmissionConfig['sequelLogging'] = False
transmissionConfig['matpowerFilePath'] = Path(rootPath) / 'modelDependency' / 'transmission'
transmissionConfig['matpowerSystem'] = 'case9'  # transmission system to use
transmissionConfig['matpowerPFTime'] = 15     # time between power flow solutions in MATPOWER in seconds. OPF need to be a multiple of PF
transmissionConfig['matpowerOPFTime'] = 300   # time between optimal power flow solutions in MATPOWER in seconds. OPF need to be a multiple of PF
transmissionConfig['matpowerAmpFactor'] = 1   # MATPOWER distribution load amplification factor
transmissionConfig['wholesaleTimeShift'] = 15   # lead time at which the OPF is solved

After modifying the setting for this script you can create and run the experiment by doing the following:

# navigate to the repositories folder
cd $HOME/repositories/HELICS-Use-Cases/PNNL-Real-Time-Transactive-Energy/modificationScripts

# run scripts to populate feeders
python coSimulationTD.py

# execute experiment
cd ../experiments/tdExample
./runAll.sh