Define Profiles, Scenarios, and Events

This section describes how to define scenarios, profiles, and events using pySAInt. We will continue with the same dataset from the previous section.

1. Add Profiles to a Dataset

Unlike in SAInt, profiles in pySAInt do not belong to specific scenarios. Profiles are instead defined at the dataset level.

We can use the add_profile method of the dataset to add profiles with its associated properties. This method has the following parameters:

Parameter Type Description

Name

str

Name of the profile

Mean

list

Mean values to use for the profile.

kwargs

Other properties to use for profiles.

Profiles must have the following properties defined:

  • TimeStep, which must be defined using the built-in Python package datetime.

  • PRFTIME, we recommend always using h, meaning that the profile timestep will be described in terms of hours.

  • PrflType, which must be DETERMINISTIC or STOCHASTIC (we recommend using DETERMINISTIC).

  • InterpolationType, which must be STEP, LINEAR, or CUBIC (we recommend using STEP).

  • DurationType, which must be PERIODIC, CONSTANT, or STOP (we recommend using PERIODIC)

  • DistributionType, which must be UNIFORM, NORMAL, or EXPONENTIAL (for non stochastic profiles this option is irrelevant, but we recommend using UNIFORM)

Please see the SAInt documentation for further details and explanations about profiles. Have a look at the Reference Guide section "Scenario profiles", for examples.

import datetime

# Add a profiles to the dataset
triangle.add_profile(
    Name="NORMALIZED_DEMAND",
    Mean=[0.6, 0.55, 0.6, 0.65, 0.65, 0.7, 0.75, 0.8, 0.8, 0.75, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 0.95, 0.9, 0.85, 0.8, 0.75, 0.7, 0.65],
    TimeStep=datetime.timedelta(hours=1),
    PRFTIME="h",
    PrflType="DETERMINISTIC",
    InterpolationType="STEP",
    DurationType="PERIODIC",
    DistributionType='UNIFORM',
)
triangle.add_profile(
    Name="NORMALIZED_SOLAR",
    Mean=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.25, 0.4, 0.55, 0.7, 0.8, 0.85, 0.8, 0.7, 0.55, 0.4, 0.25, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0],
    TimeStep=datetime.timedelta(hours=1),
    PRFTIME="h",
    PrflType="DETERMINISTIC",
    InterpolationType="STEP",
    DurationType="PERIODIC",
    DistributionType='UNIFORM',
)
python

2. Add Scenarios to a Dataset

pySAInt does not perform any simulations or optimizations directly. Users should pay close attention to SAInt outputs including log files, solution files, etc.

This means that in pySAInt, scenarios are just containers used to organize events. Scenarios in pySAInt do not influence actual scenarios in SAInt in any way.

Although scenarios in pySAInt are just used to group/organize events, it is often useful to have scenarios and their properties defined in pySAInt when building a model.

A scenario can be added to the dataset, using the add_scenario method of the dataset. It has the following parameters:

Parameter Type Description

Name

str

Name of the scenario.

SceType

str

Type of the scenario

kwargs

Other scenario properties.

import datetime

# Add scenario(s) to the dataset
triangle.add_scenario(
    Name="REFERENCE",
    SceType="DCUCOPF",
    StartTime=datetime.datetime(year=2019, month=6, day=1),
    EndTime=datetime.datetime(year=2019, month=6, day=2),
    TimeStep=datetime.timedelta(hours=1),
    TimeHorizon=datetime.timedelta(hours=24),
    TimeLookAhead=datetime.timedelta(hours=0),
    TimeStepLookAhead=datetime.timedelta(hours=0)
)
python

We recommend defining properties like StartTime and TimeStep using the built-in Python package datetime

3. Add Events to a Dataset

Once the scenario and profiles are added to the dataset, we can use the add_event method of the dataset to add events to the dataset. This method has the following parameters:

Parameter Type Description

ObjType

str

Object type for the event

ObjName

str

Object name for the event

Parameter

str

Event parameter or property extension

Scenario

str

Scenario name of the event

StartTime

datetime, optional

Event start time, by default None

Profile

str, optional

Profile used by event, by default None

kwargs

Other event properties

Events are "where the magic happens" in SAInt. If you are unsure about how to implement an event properly, consult the SAInt documentation!

import datetime

# Add events to the REFERENCE scenario
triangle.add_event(
    ObjType="EDEM",
    ObjName="DEMAND1",
    Parameter="PSET",
    Scenario="REFERENCE",
    StartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    Value=200,
    Unit="[MW]",
    Profile="NORMALIZED_DEMAND",
    UsePrfStartTime=True,
    PrfStartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    AveragePrf=False,
    InterpolatePrf=False,
    Info="Demand setpoint for DEMAND1"
)
triangle.add_event(
    ObjType="EDEM",
    ObjName="DEMAND2",
    Parameter="PSET",
    Scenario="REFERENCE",
    StartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    Value=250,
    Unit="[MW]",
    Profile="NORMALIZED_DEMAND",
    UsePrfStartTime=True,
    PrfStartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    AveragePrf=False,
    InterpolatePrf=False,
    Info="Demand setpoint for DEMAND2"
)
triangle.add_event(
    ObjType="PV",
    ObjName="SOLAR",
    Parameter="PSET",
    Scenario="REFERENCE",
    StartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    Value="PV.SOLAR.PMAX",
    Unit="[MW]",
    Profile="NORMALIZED_SOLAR",
    UsePrfStartTime=True,
    PrfStartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    AveragePrf=False,
    InterpolatePrf=False,
    Info="Generation setpoint for SOLAR"
)
triangle.add_event(
    ObjType="ASVC",
    ObjName="SPINNING_RESERVE",
    Parameter="MinVal",
    Scenario="REFERENCE",
    StartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    Value="ENET.PDSET*0.05",
    Unit="[MW]",
    Info="Spinning reserve requirement equal to 5% of total system demand"
)
triangle.add_event(
    ObjType="ASVCX",
    ObjName="GAS_CT_SPINNING_RESERVE",
    Parameter="MaxVal",
    Scenario="REFERENCE",
    StartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    Value="FGEN.GAS_CT.MaxUpRamp*10",
    Unit="[MW]",
    Info="Max reserve contribution equal to GAS_CT upward ramping capability in 10 minutes"
)
triangle.add_event(
    ObjType="ASVCX",
    ObjName="GAS_CC_SPINNING_RESERVE",
    Parameter="MaxVal",
    Scenario="REFERENCE",
    StartTime=datetime.datetime(year=2019, month=6, day=1, hour=1),
    Value="FGEN.GAS_CC.MaxUpRamp*10",
    Unit="[MW]",
    Info="Max reserve contribution equal to GAS_CC upward ramping capability in 10 minutes"
)
python