Step 1: Create and Edit a Constraint Object

Welcome to this new tutorial series on the use of custom constraints. An electric constraint object (ECSNTR) refers to a custom-defined constraint integral to optimization algorithms, ensuring an accurate representation of limitations in the electric power system within a production cost model. In this tutorial, you will learn how to create and edit the properties a constraint object. The network used in this tutorial is the electric network ENET09_13 available in the Projects folder in SAInt’s user folder (C:\...\Documents\encoord\SAInt-v3\Project).

1. Create a new constraint object

Start by opening SAInt and loading the electric network ENET09_13. This network already includes a PV object called PV.SOLARPARK and an electric storage object called ESTR.BATTERY, both located at NODE9. You will create a custom constraint to ensure the battery only charges from the solar park. Start by accessing the Model Explorer and right-click on the "Constraints" section. From the context menu, select [add New Constraint], as shown in Figure 1. This will automatically open display the Property Editor of the new constraint object, which can be found in the model explorer under the Constraint section.

t01 step01 00
Figure 1. Create a constraint ECNSTR object from the Model Explorer.

2. Edit the constraint properties

The property Editor allows to define the Input and Event constraint properties. Edit the following properties, as shown in Figure 2:

  • Name: Modify the constraint’s name to "COUPLEDCHARGING".

  • LowBoundDef: Define the default lower bound for the constraint. Set the value to "0".

  • AvgLowBoundDef: Default time averaged lower bound of the constraint (averaged over each "Time Horizon"). Keep default value of minus infinity.

  • UpBoundDef: Default upper bound for the constraint. Keep default value of plus infinity.

  • AvgUpBoundDef: Default time averaged upper bound of the constraint (averaged over each "Time Horizon"). Keep default value of plus infinity.

The properties LowBoundDef, AvgLowBoundDef, UpBoundDef, and AvgUpBoundDef can be overridden in a scenario using events.

t01 step01 01
Figure 2. Edit the input (left) and events (right) properties of an electric constraint ECNSTR object in the Property Editor.

3. Add new variables to the electric constraint object

Once the properties of the electric constraint object are defined, you can add new variable objects associated to the constraint. In this case we will add two variable objects to the ECNSTR.COUPLEDCHARGING constraint: one for the solar generator PV.SOLARPARK and one for the ESTR.BATTERY. To add a new variable, access the Model Explorer and right-click on the PV.SOLARPARK object, as shown in Figure 3 (left). From the context menu, select Add New Variable  Active Power Generation (P)  ECNSTR.COUPLEDCHARGING. Repeat the same procedure for the ESTR.BATTERY object and add a new variable, as shown in Figure 3 (right).

t01 step01 02
Figure 3. Add new variables to an electric constraint to different externals. On the left, the case when an existing constraint is linked to an object. On the right, the case when there is no existing constraint but a new one needs to be created and directly associated.

4. Edit the new variables properties

After adding new variables to the ECNSTR.COUPLEDCHARGING constraint, the Property Editor will open automatically. In the next step, you will edit the properties of the variables, starting with the variable assigned to the PV.SOLARPARK object. Access the Property Editor and make sure that the values for the following properties matches (Figure 4):

  • Name: Modify the name of the variable to "SOLARPOWER".

  • NETObjID: Network object the variable is referring to. In this case we have PV.SOLARPARK.

  • ObjVarName: Name of object variable. We have selected the Active power generation (P) of the PV.SOLARPARK object.

  • Unit: Unit for object variable. We can set [MW].

  • CoeffDef: Edit the default coefficient for object variable and set a value of 1.

t01 step01 03
Figure 4. Edit the properties of a variable object.

You can use the same procedure to edit the variable assigned to the ESTR.BATTERY object as follows:

  • Name: Modify the name of the variable to "BATTERYCHARGING".

  • NETObjID: Network object the variable is referring to. In this case we have ESTR.BATTERY.

  • ObjVarName: Name of object variable. We have selected the Active power charge of storage (PD) of the ESTR.BATTERY object.

  • Unit: Unit for object variable. We can set [MW].

  • CoeffDef: Edit the default coefficient for object variable and set a value of -1.

Note that the coefficient -1 is for the charging.

t01 step01 04
Figure 5. Edit the properties of a variable object.

Now that you have defined the constraint’s properties and variables, we can interpret the new constraint in the following mathematical formulation (for every time step) (for details see "Electric constraint (ECNSTR)"):

ECNSTR.COUPLEDCHARGING.LowBoundEVAR.SOLARPOWER.Coeff * PV.SOLARFARM.P + EVAR.BATTERYCHARGING.Coeff * ESTR.BATTERY.PD

the remaining properties of the constraint are not relevant as they use the default values.

In a more simple form, as:

0 ≤ PV.SOLARFARM.P - ESTR.BATTERY.PD

5. Save the network

Go to the network tab and select Save  Save Electric Network. This will update the changes implemented by adding and editing the new constraint properties. Notice that the log window will inform you once the network has been saved.