Package: pyprodrisk
pyprodriskStatus:The nicest python interface to ProdRisk!ProdRisk is a modeling tool for medium-term hydro operation planning developed by SINTEF Energy Research in Trondheim, Norway. ProdRisk is used for both scientific and commerical purposes, please visit theProdRisk home pagefor further information and inquiries regarding access and use.The pyprodrisk package is an open source python wrapper for ProdRisk, and requires the proper ProdRisk binaries to function (see step 2).1 Installing pyprodriskThe pyprodrisk package can be installed using pip, the package installer for python. Please visit thepip home pagefor installation and any pip related issues. You can install the official pyprodrisk release through the terminal command:pip install pyprodriskYou can also clone this repository and install the latest development version. To do this, open a terminal in the cloned pyProdRisk directory and give the command:pip install .You should now see pyprodrisk appear in the list of installed python modules when typing:pip list2 Download the desired ProdRisk binaries for your systemNOTE: You may not distribute the cplex library as it requires end user licenseThe ProdRisk core and API are separate from the pyprodrisk package, and must be downloaded separately. The latest ProdRisk binaries are found on theProdRisk Portal. Access to the portal must be granted by SINTEF Energy Research.The following binaries are required for pyprodrisk to run:Windows:A ltm_core_bin folder containing the prodrisk and genpris binaries, and cplex2010.dll (only needed if you have a HPO license).The ProdRisk API binary prodrisk_pybind.pydLinux:A ltm_core_bin folder containing the prodrisk- and genpris binaries, and cplex2010.dll (only needed if you have a HPO license).The ProdRisk API binary prodrisk_pybind.soThe solver specific binary is listed as cplex2010 here, but will change as new CPLEX versions become available.It is also possible to use the OSI coin solver with ProdRisk, by setting the attribute use_coin_osi=True on a ProdRisk session object.3 Environment and license fileTo use a license file to access your ProdRisk license, the environment variableLTM_LICENSE_CONTROL_SYSTEMshould be set to TRUE (note: all capical letters!).The ProdRisk license file,LTM_License.dat, must always be located in the directory specified by the environment variableLTM_LICENSE_PATH.
TheLTM_LICENSE_PATHcan be added as a persistent environment variable in the regular ways, or it can be set by pyprodrisk on a session basis.
If the keyword argumentlicense_pathis specified when creating an instance of the ProdriskSession class (see step 4), the environment variablesLTM_LICENSE_CONTROL_SYSTEMis set to TRUE, andLTM_LICENSE_PATHand is overridden in the local environment of the executing process.
If ProdRisk complains about not finding the license file, it is likely an issue with the LTM_LICENSE_PATH and/or LTM_LICENSE_CONTROL_SYSTEM are not being correctly specified.TheLTM_LICENSE_PATHis also the default place pyprodrisk will look for the ProdRisk API binary prodrisk_pybind mentioned in step 2.
If the binaries are placed elsewhere, the keyword argumentsolver_pathmust be used when a ProdriskSession instance is created to ensure the correct binaries are loaded.The setting attribute prodrisk_path should be set on a ProdriskSession to the directory where the ltm_core_bin (prodrisk and genpris binaries) mentioned in step 2 is installed, e.g. prodrisk.prodrisk_path = "/path/to/ltm_core_bin/"Note that libcplex2010.so also may be placed in the '/lib' directory when running pyprodrisk in a Linux environment.4 Running ProdRiskNow that pyprodrisk is installed, the ProdRisk binaries are downloaded, and the license file and binary paths are located, it is possible to run ProdRisk in python using pyProdRisk:import pyprodrisk as pys

prodrisk = pys.ProdriskSession(license_path="C:/License/File/Path", solver_path="C:/ProdRisk/versions/10.3.0")
prodrisk.prodrisk_path = "C:/ProdRisk/versions/10.3.0/ltm_core_bin/"

#If you have a HPO license you may use the cplex solver:
prodrisk.use_coin_osi = False

#Set time resolution
#Build topolgy
#Add temporal input
#Run model
#Retreive resultsPlease visit the ProdRisk Portal for a detailedtutorialand severalexamplesusing pyprodrisk.