Application Programming Interface

SAInt-API is a powerful tool to automate the manual processes in the GUI. It gives access to multiple network and scenario data processing and execution functions. The API can be used with Python, C++, and other programming languages.

1. Requirement

1.1. Python

Python version: SAInt-API has been tested with multiple releases of Python. Python 3.9 and 3.10 are perfectly compatible. Python 3.11 and 3.12 may generate compatibility problems in conjunction with other packages or caused by unsolved bugs. We encourage our users to avoid the very latest release of Python.

Ctypes package: The ctypes package provides C-compatible data types and allows function calls from a dynamic link library (DLL). It can imported using from ctypes import * command.

Access API Functions: It is necessary to create a DLL object using mydll = cdll.LoadLibrary(path) command, where path is the directory of the SAInt API and DLL file. The SAInt-API functions can then be accessed as attributes of the DLL object.

If you are not able to load SAInt-API, try the following:

  1. Go to "Edit the system environment variables" by searching in the Windows start menu.

  2. On the System Properties window, click on the button Environment variables.

  3. Under user variables, select Path and click on Edit.

  4. On the Edit environment variable window, check if the SAInt directory is listed there; if not, click on New and select the path where SAInt is installed: "C:\Program Files\encoord\SAInt-v3", and click OK on both.

  5. Close the interface and re-open.

If the problem persists, please contact encoord support.

2. SAInt-API functions

This section describes the functions of SAInt-API with examples of their usage with Python. The functions are divided into seven categories:

2.1. Project

openPRJ(string PrjFile)

Open a project and load it into memory.

Parameter Type Description

PrjFile

String

Full path to project file (*.prj)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openPRJ("C:\\Project1.prj")
openSES(string SesFile)

Open a session of a related project and load it into memory.

Parameter Type Description

SesFile

String

Full path to session file (*.ses)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openSES("C:\\Project1_Session1.ses")

2.2. Network

  • Electric Model

  • Gas Model

  • Thermal Model

  • Hub systems

openENET(string ENETFile)

Open an electric network model and load it into memory.

Parameter Type Description

ENETFile

String

Full path to electric network file (*.enet)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")
importENET(string ImportFile)

Import an electric network model from a network import file and load it into memory.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.importENET("C:\\Template_ENET.xlsx")
exportENET(string ImportFile)

Export an electric network to network import file.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.exportENET("C:\\Export_to_ENET_Import.xlsx")
paraimportENET(string ImportFile)

Import a parameter import file and apply it to a loaded electric network model.

Parameter Type Description

ImportFile

String

Full path to parameter import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.paraimportENET("C:\\ENET_ParaImport.xlsx")
paraexportENET(string ExportFile)

Export an input parameter for an electric network model.

Parameter Type Description

ExportFile

String

Full path to parameter import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.paraexportENET("C:\\ENET_ParaExport.xlsx")
importWTPC(string ImportFile)

Import a wind turbine power curve to a loaded electric network.

Parameter Type Description

ImportFile

String

Full path to import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.importWTPC("C:\\ENET_WTPCExport.xlsx")
includeWTPC(string WTPCFile)

Include a wind turbine power curve to a loaded electric network.

Parameter Type Description

WTPCFile

String

Full path to wind turbine power curve file (*.wtpc)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.includeWTPC("C:\\ENET_WTPCInclude.wtpc")
exportWTPC(string ExportFile)

Export a wind turbine power curve from a loaded electric network to an import or include file.

Parameter Type Description

ExportFile

String

Full path to file to export to (*.wtpc | *.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.exportWTPC("C:\\ENET_WTPCExport.xlsx")
importFCC(string ImportFile)

Import a fuel consumption curve to a loaded electric network.

Parameter Type Description

ImportFile

String

Full path to import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.importWTPC("C:\\ENET_FCCExport.xlsx")
includeFCC(string FCCFile)

Include a fuel consumption curve to a loaded electric network.

Parameter Type Description

FCCFile

String

Full path to fuel consumption curve file (*.fcc)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.includeWTPC("C:\\ENET_FCCInclude.fcc")
exportFCC(string ExportFile)

Export a fuel consumption curve from a loaded electric network to an import or include file.

Parameter Type Description

ExportFile

String

Full path to file to export to (*.fcc | *.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.exportWTPC("C:\\ENET_FCCExport.xlsx")
includeENET(string MainENETFile, string ENETFileToAdd, string targetENETFile, bool PreserveContainers, bool LoadAfter)

Include an electric network model from a network file to another electric network model from network file and save the joined network to the target file. Each network must be in a different directory.

Parameter Type Description

MainENETFile

String

Full path to main electric network file (*.enet)

ENETFileToAdd

String

Full path to electric network file to add (*.enet)

targetENETFile

String

Full path to electric network file to save (*.enet)

PreserveContainers

Boolean

Set true to preserve the existing subsystems (Zones,Subs,Groups) in the main network

LoadAfter

Boolean

Set true to load the target network after the join process

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.includeENET("C:\\A\\ENET30.enet","C:\\B\\ENET5.enet","C:\\C\\newENET.enet",False,True)
includeInLoadedENET(string ENETFileToAdd, string targetNetFile, bool PreserveContainers, bool LoadAfter)

Include an electric network model from a network file to loaded electric network model and save the joined network to the target file. Each network must be in a different directory.

Parameter Type Description

ENETFileToAdd

String

Full path to electric network file to add (*.enet)

targetNetFile

String

Full path to electric network file to save (*.enet)

PreserveContainers

Boolean

Set true to preserve the existed the subsystems ( Zones,Subs,Groups) in the main network

LoadAfter

Boolean

Set true to load the target network after the include process

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.includeInLoadedENET("C:\\A\\ENET5.enet","C:\\B\\newENET.enet",False,True)
convertCRSENET(string targetFileName, string sourceEPSG_ID, string targetEPSG_ID, bool transferWholeNet)
Parameter Type Description

targetFileName

String

sourceEPSG_ID

String

targetEPSG_ID

String

transferWholeNet

Boolean

exportENETByEPSGID(string ImportFile, string EPSG_ID)

Export an electric network to network import file with a new CRS indicated by an EPSG code.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

EPSG_ID

String

EPSG Coordinate System ID

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\ENET30.enet")

mydll.exportGNETByEPSGID("C:\\Export_to_ENET_Import.xlsx","32632")
openGNET(string GNETFile)

Open a gas network model and load it into memory.

Parameter Type Description

GNETFile

String

Full path to gas network file (*.gnet)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")
importGNET(string ImportFile)

Import a gas network model from a network import file and load it into memory.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.importGNET("C:\\Template_GNET.xlsx")
exportGNET(string ImportFile)

Export a gas network to network import file.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.exportGNET("C:\\Export_to_GNET_Import.xlsx")
paraimportGNET(string ImportFile)

Import a parameter import file and apply it to a loaded gas network model.

Parameter Type Description

ImportFile

String

Full path to parameter import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.paraimportGNET("C:\\GNET_ParaImport.xlsx")
paraexportGNET(string ExportFile)

Export an input parameter for a gas network model.

Parameter Type Description

ExportFile

String

Full path to parameter import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.paraexportGNET("C:\\GNET_ParaExport.xlsx")
importQUAL(string ImportFile)

Import a gas quality from an import file to a gas network.

Parameter Type Description

ImportFile

String

Full path to gas quality import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.importQUAL("C:\\GNET_QUALImport.xlsx")
exportQUAL(string ExportFile)

Export a gas quality from a gas network to an import or include file.

Parameter Type Description

ExportFile

String

Full path to file to export to (*.qual | *.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.exportQUAL("C:\\GNET_QUALExport.xlsx")
importSynNET(string SynergiFile)

Import a gas network model from a Synergi database file and load it into memory.

Parameter Type Description

SynergiFile

String

Full path to Synergi database file (*.mdb)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.importSynNET("C:\\GasNet.mdb")
includeGNET(string MainGNETFile, string GNETFileToAdd, string targetGNETFile, bool PreserveContainers, bool LoadAfter)

Include a gas network model from a network file to another gas network model from network file and save the joined network to the target file. Each network must be in a different directory.

Parameter Type Description

MainGNETFile

String

Full path to main gas network file (*.gnet)

GNETFileToAdd

String

Full path to gas network file to add (*.gnet)

targetGNETFile

String

Full path to gas network file to save (*.gnet)

PreserveContainers

Boolean

Set true to preserve the existing subsystems (Zones,Subs,Groups) in the main network

LoadAfter

Boolean

Set true to load the target network after the join process

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.includeGNET("C:\\A\\GNET30.gnet","C:\\B\\GNET5.gnet","C:\\C\\newGNET.gnet",False,True)
includeInLoadedGNET(string GNETFileToAdd, string targetNetFile, bool PreserveContainers, bool LoadAfter)

Include a gas network model from a network file to loaded gas network model and save the joined network to the target file. Each network must be in a different directory.

Parameter Type Description

GNETFileToAdd

String

Full path to gas network file to add (*.gnet)

targetNetFile

String

Full path to gas network file to save (*.gnet)

PreserveContainers

Boolean

Set true to preserve the existed the subsystems ( Zones,Subs,Groups) in the main network

LoadAfter

Boolean

Set true to load the target network after the include process

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.includeInLoadedGNET("C:\\A\\GNET5.gnet","C:\\B\\newGNET.gnet",False,True)
convertCRSGNET(string targetFileName, string sourceEPSG_ID, string targetEPSG_ID, bool transferWholeNet)
Parameter Type Description

targetFileName

String

sourceEPSG_ID

String

targetEPSG_ID

String

transferWholeNet

Boolean

exportGNETByEPSGID(string ImportFile, string EPSG_ID)

Export a gas network to network import file with a new CRS indicated by an EPSG code.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

EPSG_ID

String

EPSG Coordinate System ID

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.exportGNETByEPSGID("C:\\Export_to_GNET_Import.xlsx","32632")
openTNET(string TNETFile)

Open a thermal network model and load it into memory.

Parameter Type Description

TNETFile

String

Full path to thermal network file (*.tnet)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")
importTNET(string ImportFile)

Import a thermal network model from a network import file and load it into memory.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.importTNET("C:\\Template_TNET.xlsx")
exportTNET(string ImportFile)

Export a thermal network to network import file.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.exportTNET("C:\\Export_to_TNET_Import.xlsx")
paraimportTNET(string ImportFile)

Import a parameter import file and apply it to a loaded thermal network model.

Parameter Type Description

ImportFile

String

Full path to parameter import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.paraimportTNET("C:\\TNET_ParaImport.xlsx")
paraexportTNET(string ExportFile)

Export an input parameter for a thermal network model.

Parameter Type Description

ExportFile

String

Full path to parameter import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.paraexportTNET("C:\\TNET_ParaExport.xlsx")
includeTNET(string MainTNETFile, string TNETFileToAdd, string targetTNETFile, bool PreserveContainers, bool LoadAfter)

Include a thermal network model from a network file to another thermal network model from network file and save the joined network to the target file. Each network must be in a different directory.

Parameter Type Description

MainTNETFile

String

Full path to main thermal network file (*.tnet)

TNETFileToAdd

String

Full path to thermal network file to add (*.tnet)

targetTNETFile

String

Full path to thermal network file to save (*.tnet)

PreserveContainers

Boolean

Set true to preserve the existing subsystems (Zones,Subs,Groups) in the main network

LoadAfter

Boolean

Set true to load the target network after the join process

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.includeTNET("C:\\A\\TNET30.tnet","C:\\B\\TNET5.tnet","C:\\C\\newTNET.tnet",False,True)
includeInLoadedTNET(string TNETFileToAdd, string targetNetFile, bool PreserveContainers, bool LoadAfter)

Include thermal network model from a network file to loaded thermal network model and save the joined network to the target file. Each network must be in a different directory.

Parameter Type Description

TNETFileToAdd

String

Full path to thermal network file to add (*.tnet)

targetNetFile

String

Full path to thermal network file to save (*.tnet)

PreserveContainers

Boolean

Set true to preserve the existed the subsystems ( Zones,Subs,Groups) in the main network

LoadAfter

Boolean

Set true to load the target network after the include process

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.includeInLoadedTNET("C:\\A\\TNET5.tnet","C:\\B\\newTNET.tnet",False,True)
convertCRSTNET(string targetFileName, string sourceEPSG_ID, string targetEPSG_ID, bool transferWholeNet)
Parameter Type Description

targetFileName

String

sourceEPSG_ID

String

targetEPSG_ID

String

transferWholeNet

Boolean

exportTNETByEPSGID(string ImportFile, string EPSG_ID)

Export a thermal network to network import file with a new CRS indicated by an EPSG code.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

EPSG_ID

String

EPSG Coordinate System ID

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\TNET30.tnet")

mydll.exportGNETByEPSGID("C:\\Export_to_TNET_Import.xlsx","32632")
openHUBS(string HUBFile)

Open a hub system model and load it into memory.

Parameter Type Description

HUBFile

String

Full path to hub system file (*.hubs)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openHUBS("C:\\HUBS6.hubs")
importHUBS(string ImportFile)

Import a hub system from a hub system import file and load it into memory.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.importHUBS("C:\\Template_HUBS.xlsx")
exportHUBS(string ImportFile)

Export a hub system to a hub system import file.

Parameter Type Description

ImportFile

String

Full path to network import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openHUBS("C:\\HUBS5.hubs")

mydll.exportHUBS("C:\\Export_to_HUBS_Import.xlsx")

2.3. Scenario management

  • Electric Model

  • Gas Model

  • Thermal Model

newESCE(string ScenarioNameStr, string ScenarioTypeStr, string StartTimeStr, string EndTimeStr, int TimeStep, int TimeHorizon, int TimeLookAhead, int TimeStepLookAhead)

Create a new electric scenario for a loaded electric network model.

Parameter Type Description

ScenarioNameStr

String

Scenario name

ScenarioTypeStr

String

Scenario type, either "SteadyACPF", "SteadyACOPF", "QuasiDynamicACPF", "QuasiDynamicACOPF", "SteadyDCPF", "SteadyDCOPF", "QuasiDynamicDCPF", "QuasiDynamicDCOPF", or "DCUCOPF"

StartTimeStr

String

Start time in format "dd/MM/yyyy HH:mm"

EndTimeStr

String

End time in format "dd/MM/yyyy HH:mm"

TimeStep

Int32

Time step (of time horizon) in seconds

TimeHorizon

Int32

Time horizon (required input) in seconds, only used in "DCUCOPF"

TimeLookAhead

Int32

Time look ahead (required input) in seconds, only used in "DCUCOPF"

TimeStepLookAhead

Int32

Time step look ahead (required input) in seconds, only used in "DCUCOPF"

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newESCE("ENET30_STE", "SteadyACPF", "01/01/2022 00:00", "01/01/2022 01:00", 3600, 3600, 0, 0)
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newESCE("ENET30_QDYN", "QuasiDynamicACPF", "01/01/2022 06:00", "02/01/2022 06:00", 900, 900, 0, 0)
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newESCE("ENET30_PCM", "DCUCOPF", "01/01/2022 00:00", "08/01/2022 00:00", 1800, 86400, 86400, 7200)
openESCE(string ESCEFile)

Open an electric scenario for a loaded electric network model.

Parameter Type Description

ESCEFile

String

Path to electric scenario file (*.esce)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_STE.esce")
importESCE(string FileName)

Import a scenario events from an import file to a loaded electric scenario.

Parameter Type Description

FileName

String

Path to scenario event import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.importESCE("C:\\Template_ESCE.xlsx")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newGSCE("ENET30_DYN", "QuasiDynamicACPF", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.importESCE("C:\\Template_ESCE.xlsx")
exportESCE(string FileName)

Export an electric scenario events to a scenario event import file.

Parameter Type Description

FileName

String

Path to scenario event export file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.exportESCE("C:\\ExportEvents.xlsx")
includeESCE(string FileName, string StartTimeStr, string EndTimeStr)

Include an electric scenario to a loaded network model and scenario.

Parameter Type Description

FileName

String

Path to electric scenario file to include (*.esce)

StartTimeStr

String

Start time from which events in the scenario file should be added (similar to time definition for scenario event in GUI and import file)

EndTimeStr

String

End time to which events in the scenario file should be added (similar to time definition for scenario event in GUI and import file)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newESCE("ENET30_QDYN", "QuasiDynamicACPF", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeESCE("C:\\ENET30_QDYN2.esce", "+2", "+5")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newESCE("ENET30_QDYN", "QuasiDynamicACPF", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeESCE("C:\\ENET30_QDYN2.esce", "2:00", "5:00")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.newESCE("ENET30_QDYN", "QuasiDynamicACPF", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeESCE("C:\\ENET30_QDYN2.esce", "1/2:00", "2/5:00")
newGSCE(string ScenarioNameStr, string ScenarioTypeStr, string StartTimeStr, string EndTimeStr, int TimeStep)

Create a new gas scenario for a loaded gas network model.

Parameter Type Description

ScenarioNameStr

String

Scenario name

ScenarioTypeStr

String

Scenario type, either "SteadyGas" or "DynamicGas"

StartTimeStr

String

Start time in format "dd/MM/yyyy HH:mm"

EndTimeStr

String

End time in format "dd/MM/yyyy HH:mm"

TimeStep

Int32

Time step in seconds

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.newGSCE("GNET30_STE", "SteadyGas", "01/01/2022 00:00", "01/01/2022 01:00", 3600)
from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.newGSCE("GNET30_DYN", "DynamicGas", "01/01/2022 06:00", "02/01/2022 06:00", 900)
openGSCE(string GSCEFile)

Open a gas scenario for a loaded gas network model.

Parameter Type Description

GSCEFile

String

Path to gas scenario file (*.gsce)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_STE.gsce")
importGSCE(string FileName)

Import a scenario events from an import file to a loaded gas scenario.

Parameter Type Description

FileName

String

Path to scenario event import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.importGSCE("C:\\Template_GSCE.xlsx")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.newGSCE("GNET30_DYN", "DynamicGas", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.importGSCE("C:\\Template_GSCE.xlsx")
exportGSCE(string FileName)

Export a gas scenario events to a scenario event import file.

Parameter Type Description

FileName

String

Path to scenario event export file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.exportGSCE("C:\\ExportEvents.xlsx")
includeGSCE(string FileName, string StartTimeStr, string EndTimeStr)

Include a gas scenario to a loaded network model and scenario.

Parameter Type Description

FileName

String

Path to gas scenario file to include (*.gsce)

StartTimeStr

String

Start time from which events in the scenario file should be added (similar to time definition for scenario event in GUI and import file)

EndTimeStr

String

End time to which events in the scenario file should be added (similar to time definition for scenario event in GUI and import file)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.newGSCE("GNET30_DYN", "DynamicGas", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeGSCE("C:\\GNET30_DYN2.gsce", "+2", "+5")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.newGSCE("GNET30_DYN", "DynamicGas", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeGSCE("C:\\GNET30_DYN2.gsce", "2:00", "5:00")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.newGSCE("GNET30_DYN", "DynamicGas", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeGSCE("C:\\GNET30_DYN2.gsce", "1/2:00", "2/5:00")
newTSCE(string ScenarioNameStr, string ScenarioTypeStr, string StartTimeStr, string EndTimeStr, int TimeStep)

Create a new thermal scenario for a loaded thermal network model.

Parameter Type Description

ScenarioNameStr

String

Scenario name

ScenarioTypeStr

String

Scenario type, either "SteadyThermal" or "QuasiDynamicThermal"

StartTimeStr

String

Start time in format "dd/MM/yyyy HH:mm"

EndTimeStr

String

End time in format "dd/MM/yyyy HH:mm"

TimeStep

Int32

Time step in seconds

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.newTSCE("TNET30_STE", "SteadyThermal, "01/01/2022 00:00", "01/01/2022 01:00", 3600)
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.newTSCE("TNET30_DYN", "QuasiDynamicThermal", "01/01/2022 06:00", "02/01/2022 06:00", 900)
openTSCE(string TSCEFile)

Open a thermal scenario for a loaded thermal network model.

Parameter Type Description

TSCEFile

String

Path to thermal scenario file (*.tsce)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_STE.tsce")
importTSCE(string FileName)

Import a scenario events from an import file to a loaded thermal scenario.

Parameter Type Description

FileName

String

Path to scenario event import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_STE.tsce")

mydll.importTSCE("C:\\Template_TSCE.xlsx")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.newTSCE("TNET30_DYN", "QuasiDynamicThermal", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.importTSCE("C:\\Template_TSCE.xlsx")
exportTSCE(string FileName)

Export a thermal scenario events to a scenario event import file.

Parameter Type Description

FileName

String

Path to scenario event import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.exportTSCE("C:\\ExportEvents.txt")
includeTSCE(string FileName, string StartTimeStr, string EndTimeStr)

Include a thermal scenario to a loaded network model and scenario.

Parameter Type Description

FileName

String

Path to thermal scenario file to include (*.tsce)

StartTimeStr

String

Start time from which events in the scenario file should be added (similar to time definition for scenario event in GUI and import file)

EndTimeStr

String

End time to which events in the scenario file should be added (similar to time definition for scenario event in GUI and import file)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.newTSCE("TNET30_DYN", "QuasiDynamicThermal", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeTSCE("C:\\TNET30_DYN2.tsce", "+2", "+5")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.newTSCE("TNET30_DYN", "QuasiDynamicThermal", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeTSCE("C:\\TNET30_DYN2.tsce", "2:00", "5:00")
from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.newTSCE("TNET30_DYN", "QuasiDynamicThermal", "01/01/2022 06:00", "02/01/2022 06:00", 900)

mydll.includeTSCE("C:\\TNET30_DYN2.tsce", "1/2:00", "2/5:00")

2.4. Scenario execution

These functions apply to all scenario types.

showSIMLOG(bool input)

Show the simulation log in a console window.

Parameter Type Description

input

Boolean

True if simulation log should be displayed in the console

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runGSIM.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.showSIMLOG(True)

b = mydll.runGSIM()

print(b)
setSIMLOGFile(string input)

Specify a file to write the simulation log to.

Parameter Type Description

input

String

Full path to log file (*.log)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runGSIM.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.setSIMLOGFile("C:\\SimOut.log)

b = mydll.runGSIM()

print(b)
writeSIMLOG(bool input)

Write the simulation log to a file.

Parameter Type Description

input

Boolean

True if simulation log should be written to a file specified by the "setSIMLOGFile" function

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runGSIM.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.writeSIMLOG(True)

b = mydll.runGSIM()

print(b)
  • Electric Model

  • Gas Model

  • Thermal Model

  • Hub Systems

int runESIM()

Run an electric scenario for the loaded electric network, scenario and condition file.

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runESIM.restype = c_int

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openECON("C:\\ENET30_STE.econ")

b = mydll.runESIM()

print(b)
int runESIMCustomDLL(string AssemblyPath, string NamespaceName, string ClassName)

Run an electric scenario for the loaded electric network, scenario and condition file using a custom dll file.

Parameter Type Description

AssemblyPath

String

Path to custom dll file (*.dll)

NamespaceName

String

Namespace where the class is defined

ClassName

String

Name of class where the "ISolverHandler" interface is implemented

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runESIMCustomDLL.restype = c_int

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_DYN.esce")

mydll.openECON("C:\\ENET30_STE.econ")

b = mydll.rungESIMCustomDLL("C:\\MyAssembly.dll", "MyAssembly", "TestClass")

print(b)
int runGSIM()

Run a gas scenario for the loaded gas network, scenario and condition file.

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runGSIM.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

b = mydll.runGSIM()

print(b)
int runGSIMCustomDLL(string AssemblyPath, string NamespaceName, string ClassName)

Run a gas scenario for the loaded gas network, scenario and condition file using a custom dll file.

Parameter Type Description

AssemblyPath

String

Full path to custom dll file (*.dll)

NamespaceName

String

Namespace where the class is defined

ClassName

String

Name of class where the "ISolverHandler" interface is implemented

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runGSIMCustomDLL.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

b = mydll.rungGSIMCustomDLL("C:\\MyAssembly.dll", "MyAssembly", "TestClass")

print(b)
setMaxCnstrSteps(int k)

Set the maximum number of steps the solver should perform in the constraint handling loop of a gas simulation.

Parameter Type Description

k

Int32

Maximum number of constraint steps in the constraint handling loop

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.setMaxCnstrSteps(200)

mydll.runGSIM()
int runTSIM()

Run a thermal scenario for the loaded thermal network, scenario and condition file.

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runTSIM.restype = c_int

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTCON("C:\\TNET30_STE.tcon")

b = mydll.runTSIM()

print(b)
int runTSIMCustomDLL(string AssemblyPath, string NamespaceName, string ClassName)

Run a thermal scenario for the loaded thermal network, scenario and condition file using a custom dll file.

Parameter Type Description

AssemblyPath

String

Path to custom dll file (*.dll)

NamespaceName

String

Namespace where the class is defined

ClassName

String

Name of class where the "ISolverHandler" interface is implemented

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runTSIMCustomDLL.restype = c_int

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_QDYN.tsce")

mydll.openTCON("C:\\TNET30_STE.tcon")

b = mydll.runTSIMCustomDLL("C:\\MyAssembly.dll", "MyAssembly", "TestClass")

print(b)
int runCMBSIM()

Run a combined simulation for the loaded gas and electric network, scenario and condition file.

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runCMBSIM.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openECON("C:\\ENET30_STE.econ")

b = mydll.runCMBSIM()

print(b)
int runCMBSIMCustomDLL(string AssemblyPath, string NamespaceName, string ClassName)

Run a combined simulation for the loaded gas and electric network, scenario and condition file using a custom dll file.

Parameter Type Description

AssemblyPath

String

NamespaceName

String

ClassName

String

Returns:

  • none = 0

  • Infeasible = 1

  • Feasible = 2

  • Solving = 4

  • Aborted = 8

  • Paused = 16

  • Solved = 32

  • Failed = 64

  • ConstraintViolation = 128

  • AmbientPressureViolation = 256

  • ConstraintHandling = 512

  • MissingPressure = 1028

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.runCMBSIM.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openECON("C:\\ENET30_STE.econ")

b = mydll.runCMBSIMCustomDLL("C:\\MyAssembly.dll", "MyAssembly", "TestClass")

print(b)

2.5. Scenario solution

  • Electric Model

  • Gas Model

  • Thermal Model

openESOL(string SOLFile)

Open an electric solution file to the loaded electric network model.

Parameter Type Description

SOLFile

String

Full path to electric solution file (*.esol)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openESOL("C:\\ENET30_QDYN.esol")
writeESOL(string SOLInputFile, string SOLOutputFile)

Write an electric scenario results to a file using a result description file.

Parameter Type Description

SOLInputFile

String

Path to result description file (*.xlsx | *.xls | *.txt | *.csv)

SOLOutputFile

String

Path to result output file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_DYN.esce")

mydll.openECON("C:\\ENET30_STE.econ")

mydll.runESIM()

mydll.writeESOL("C:\\SolIn.xlsx", "C:\\SolOutput.xlsx")
openECON(string CONFile)

Open a state/condition file for the loaded electric network model.

Parameter Type Description

CONFile

String

Path to electric state file (*.econ)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openECON("C:\\ENET30_STE.econ")
setECONWriteStatus(bool writefile)

Switch between writing and not writing the electric network state file after simulation.

Parameter Type Description

writefile

Boolean

If True state file will be generated after simulation

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openECON("C:\\ENET30_QDYN.econ")

mydll.setECONWriteStatus(False)

mydll.runESIM()
exportECON(string Filename, string TimeStr)

Export an electric network state at the specified simulation time to a state file.

Parameter Type Description

Filename

String

Path to electric state file (*.econ)

TimeStr

String

Time for which state file should be generated (similar to time definition for scenario event in EUI and import file)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openESOL("C:\\ENET30_QDYN.esol")

mydll.exportECON("C:\\ExportState.econ", "1/2:00")
from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.openESOL("C:\\ENET30_QDYN.esol")

mydll.exportECON("C:\\ExportState.econ", "+2")
openGSOL(string SOLFile)

Open a gas solution file for the loaded gas network model.

Parameter Type Description

SOLFile

String

Path to gas solution file (*.gsol)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")
writeGSOL(string SOLInputFile, string SOLOutputFile)

Write a gas scenario results to a file using a result description file.

Parameter Type Description

SOLInputFile

String

Path to result description file (*.xlsx | *.xls | *.txt | *.csv)

SOLOutputFile

String

Path to result output file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")

mydll.runGSIM()

mydll.writeGSOL("C:\\SolIn.xlsx", "C:\\SolOutput.xlsx")
openGCON(string CONFile)

Open a state/condition file for the loaded gas network model.

Parameter Type Description

CONFile

String

Path to gas state file (*.gcon)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGCON("C:\\GNET30_STE.gcon")
setGCONWriteStatus(bool writefile)

Switch between writing and not writing the gas network state file after simulation.

Parameter Type Description

writefile

Boolean

If True state file will be generated after simulation

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_QDYN.gsce")

mydll.openGCON("C:\\GNET30_QDYN.gcon")

mydll.setGCONWriteStatus(False)

mydll.runGSIM()
exportGCON(string Filename, string TimeStr)

Export a gas network state at the specified simulation time to a state file.

Parameter Type Description

Filename

String

Path to gas state file (*.gcon)

TimeStr

String

Time for which state file should be generated (similar to time definition for scenario event in GUI and import file)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

mydll.exportGCON("C:\\ExportState.gcon", "1/2:00")
from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

mydll.exportGCON("C:\\ExportState.gcon", "+2")
openTSOL(string SOLFile)

Open a thermal solution file for the loaded thermal network model.

Parameter Type Description

SOLFile

String

Path to gas solution file (*.tsol)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTSOL("C:\\TNET30_DYN.tsol")
writeTSOL(string SOLInputFile, string SOLOutputFile)

Write a thermal scenario results to a file using a result description file.

Parameter Type Description

SOLInputFile

String

Full path to result description file (*.xlsx | *.xls | *.txt | *.csv)

SOLOutputFile

String

Full path to result output file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTCON("C:\\TNET30_STE.tcon")

mydll.runTSIM()

mydll.writeTSOL("C:\\SolIn.xlsx", "C:\\SolOutput.xlsx")
openTCON(string CONFile)

Open a state/condition file for the loaded thermal network model.

Parameter Type Description

CONFile

String

Path to thermal state file (*.tcon)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTCON("C:\\TNET30_STE.tcon")
setTCONWriteStatus(bool writefile)

Switch between writing and not writing the thermal network state file after simulation.

Parameter Type Description

writefile

Boolean

If True state file will be generated after simulation

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTCON("C:\\TNET30_DYN.tcon")

mydll.setTCONWriteStatus(False)

mydll.runTSIM()
exportTCON(string Filename, string TimeStr)

Export a thermal network state at the specified simulation time to a state file.

Parameter Type Description

Filename

String

Path to gas state file (*.tcon)

TimeStr

String

Time for which state file should be generated (similar to time definition for scenario event in HUI and import file)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTSOL("C:\\TNET30_DYN.tsol")

mydll.exportTCON("C:\\ExportState.tcon", "1/2:00")
from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.openTSOL("C:\\TNET30_DYN.tsol")

mydll.exportTCON("C:\\ExportState.tcon", "+2")

2.6. Profiles

  • Electric Model

  • Gas Model

  • Thermal Model

importEPRF(string FileName)

Import a profile import file to a loaded electric scenario.

Parameter Type Description

FileName

String

Path to profile import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.importEPRF("C:\\Template_Profile_Import.xlsx")

mydll.importESCE("C:\\Template_ESCE.xlsx")
exportEPRF(string FileName)

Export profiles from the current electric scenario to an export file.

Parameter Type Description

FileName

String

Full path to profile export file (*.prfl)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.exportEPRF("C:\\ExportProfile.prfl")
includeEPRF(string FileName)

Include profiles from a profile file to the current electric scenario.

Parameter Type Description

FileName

String

Full path to profile file (*.prfl)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openENET("C:\\ENET30.enet")

mydll.openESCE("C:\\ENET30_QDYN.esce")

mydll.includeEPRF("C:\\Profile.prfl")

mydll.importESCE("C:\\Template_ESCE.xlsx")
importGPRF(string FileName)

Import a profile import file to a loaded gas scenario.

Parameter Type Description

FileName

String

Path to profile import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.importGPRF("C:\\Template_Profile_Import.xlsx")

mydll.importGSCE("C:\\Template_GSCE.xlsx")
exportGPRF(string FileName)

Export profiles from the current gas scenario to an export file.

Parameter Type Description

FileName

String

Full path to profile export file (*.prfl)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.exportGPRF("C:\\ExportProfile.prfl")
includeGPRF(string FileName)

Include a profiles from a profile file to the current gas scenario.

Parameter Type Description

FileName

String

Full path to profile file (*.prfl)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.includeGPRF("C:\\Profile.prfl")

mydll.importGSCE("C:\\Template_GSCE.xlsx")
importTPRF(string FileName)

Import a profile import file to a loaded thermal scenario.

Parameter Type Description

FileName

String

Path to profile import file (*.xlsx | *.xls | *.txt | *.csv)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tnet")

mydll.importTPRF("C:\\Template_Profile_Import.xlsx")

mydll.importTSCE("C:\\Template_TSCE.xlsx")
exportTPRF(string FileName)

Export profiles from the current thermal scenario to an export file.

Parameter Type Description

FileName

String

Full path to profile export file (*.prfl)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.exportTPRF("C:\\ExportProfile.prfl")
includeTPRF(string FileName)

Include profiles from profile file to the current thermal scenario.

Parameter Type Description

FileName

String

Full path to profile file (*.prfl)

from ctypes import *

mydll= cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openTNET("C:\\TNET30.tnet")

mydll.openTSCE("C:\\TNET30_DYN.tsce")

mydll.includeTPRF("C:\\Profile.prfl")

mydll.importTSCE("C:\\Template_TSCE.xlsx")

2.7. Evaluation

How to write expression is discussed in the section "Expression" of the reference guide. These functions apply to all scenario types.

eval(string Expression)

Evaluate an expression for the current loaded model and display the result in a console/log.

Parameter Type Description

Expression

String

Expression similar to GUI command window expression

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_STE.gsol")

mydll.eval("GNET.LP.(%)")
bool evalBool(string Expression)

Evaluate a logical expression for the current loaded model and return an integer.

Parameter Type Description

Expression

String

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalBool.restype = c_bool

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

b = mydll.evalBool("GNET.NUMNO>2")

print(b)
float evalFloat(string Expression)

Evaluate an expression for the current loaded model and return a float.

Parameter Type Description

Expression

String

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalFloat.restype = c_float

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

b = mydll.evalFloat("GNET.LP.[Msm3].(2)")

print(b)
int evalInt(string Expression)

Evaluate the expression for the current loaded model and return an integer.

Parameter Type Description

Expression

String

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalInt.restype = c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

b = mydll.evalInt("GNET.NUMNO")

print(b)
string evalStr(string Expression)

Evaluate the expression for the current loaded model and return a string.

Parameter Type Description

Expression

String

Expression similar to GUI command window expression

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalStr.restype = c_wchar_p

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_STE.gsol")

b = mydll.evalStr("GNO.Name.(%)")

print(b)
evalCmd(string Expression)

Evaluate an expression w/o preprocessing the expression in the SAInt interpreter for the current loaded model and display the result in console/log.

Parameter Type Description

Expression

String

Expression similar to GUI command window expression

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_STE.gsol")

mydll.evalCmd("eminat('GNO.%.P')")
bool evalCmdBool(string Expression)

Evaluate a logical expression w/o preprocessing the expression in the SAInt interpreter for the current loaded model and return a boolean.

Parameter Type Description

Expression

String

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalCmdBool.restype=c_bool

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

b = mydll.evalCmdBool("emin('GNO.%.P.[barg]')>10")

print(b)
float evalCmdFloat(string Expression)

Evaluate an expression w/o preprocessing the expression in the SAInt interpreter for the current loaded model and return a float.

Parameter Type Description

Expression

String

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalCmdFloat.restype=c_float

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

b = mydll.evalCmdFloat("emax('GNO.%.P.[barg]')")

print(b)
int evalCmdInt(string Expression)

Evaluate an expression w/o preprocessing the expression in the SAInt interpreter for the current loaded model and return an integer.

Parameter Type Description

Expression

String

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalCmdInt.restype=c_int

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_DYN.gsol")

b = mydll.evalCmdInt("ecount('GNO.%')")

print(b)
string evalCmdStr(string Expression)

Evaluate an expression w/o preprocessing the expression in the SAInt interpreter for the current loaded model and return a string.

Parameter Type Description

Expression

String

Expression similar to GUI command window expression

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.evalCmdStr.restype = c_wchar_p

mydll.openGNET("C:\\GNET30.gnet")

mydll.openGSCE("C:\\GNET30_DYN.gsce")

mydll.openGSOL("C:\\GNET30_STE.gsol")

b = mydll.evalCmdStr("eminat('GNO.%.P')")

print(b)

2.8. Miscellaneous Functions

LoadUnits(string filePath)

Change the default units by loading a units file.

Parameter Type Description

filePath

String

Full path to units file (*.units)

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.LoadUnits("C:\\SampleUnits.units)
string getVersion()

Get the current SAInt version.

Returns: None

from ctypes import *

mydll = cdll.LoadLibrary("C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll")

mydll.getVersion.restype = c_wchar_p

b = mydll.getVersion()

print(b)

3. Change DCUCOPF scenario settings

RelMipGap

The relative mip gap in the current loaded scenario.

mydll = cdll.LoadLibrary('C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll')

mydll.evalCmdStr('ENET.SCE.RelMipGap=0.05')
TimeLimit

The solver time limit in the current loaded scenario.

mydll = cdll.LoadLibrary('C:\\Program Files\\encoord\\SAInt-v3\\SAInt-API.dll')

mydll.evalCmdStr('ENET.SCE.TimeLimit=600')

4. Exception logging mechanism

SAInt API provides the user with a logging option for debugging possible errors and addressing exceptions caused by the execution of Python code. The exception logging mechanism saves the exception log either in the default directory .\encoord\SAInt-v3\Logs or in a user-specified directory if a new system environment variable named SAIntExceptionLogPath is defined.