Package: powersddp
PowerSystemStochasticDualDynamicProgrammingThe main goal of this library is to provide support for studies regarding the optimal dispatch of power systems, majorly comprised of Thermoelectric and Hydroelectric Generators.Note 1This is an under development library.A special thank should be given to professorAndré Marcato. This project does not intend to substitute the similar libraryPySDDP.Note 1This project is being developed alongside the masters course:Planejamento de Sistemas Elétricos, as part of the masters program in Energy Systems at theElectrical Engineering Graduate Programfrom theUniversidade Federal de Juiz de Fora - BrazilNote 2The code will evolve alongside the video lectures provided by professor Marcato at:Curso de Planejamento de Sistemas ElétricosInstallationpip install powersddpExampleThere are two ways of initializing aPower System. Either by providing a.ymlfile, or by passing a dictionary as an initialization data. Both are depicted bellow:Note:When using the file input method (.ymlformat) check theexampleof how to declare the parameters.Initializing aPowerSystemimportpowersddpaspsddpsystem=psddp.PowerSystem(path='system.yml')print("System Load:{}\n""Number of HGUs:{}\n""Number of TGUs:{}".format(system.data['load'],len(system.data['hydro_units']),len(system.data['thermal_units'])))importpowersddpaspsddpdata={'load':[50,50,50],'discretizations':3,'stages':3,'scenarios':2,'outage_cost':500,'hydro_units':[{'name':'HU1','v_max':100,'v_min':20,'v_ini':100,'prod':0.95,'flow_max':60,'inflow_scenarios':[[23,16],[19,14],[15,11]]}],'thermal_units':[{'name':'GT1','capacity':15,'cost':10},{'name':'GT2','capacity':10,'cost':25}]}PowerSystem=psddp.PowerSystem(data=data)print("System Load:{}\n""Number of HGUs:{}\n""Number of TGUs:{}".format(PowerSystem.data['load'],len(PowerSystem.data['hydro_units']),len(PowerSystem.data['thermal_units'])))Dispatching aPowerSystemdispatch()accepts the following arguments:solver : str, optional defaults to 'sdp'Selects the solver option for the minimization objective function.scenario : int, optional defaults to 0Chooses either a specific scenario to investigate (scenario>1) or all scenarios to evaluate (scenario= 0). Starting from 0 to the number of declared scenarios in thehydro_units['inflow_scenarios']parameter.verbose : bool, optional defaults to FalseDisplays the PDDE solution for every stage of the execution. Use with care, solutions of complex systems with too many stages and scenarios might overflow the console.plot : bool, optional, defaults to FalseDisplays a sequence of plots showing the future cost function for every stage of the execution.The following example executes the Power System dispatch using the Unique Linear Programming method for the first scenario (id = 1) and outputs the optimization steps.importpowersddpaspsddpdata={'load':[50,50,50],'discretizations':3,'stages':3,'scenarios':2,'outage_cost':500,'hydro_units':[{'name':'HU1','v_max':100,'v_min':20,'v_ini':100,'prod':0.95,'flow_max':60,'inflow_scenarios':[[23,16],[19,14],[15,11]]}],'thermal_units':[{'name':'GT1','capacity':15,'cost':10},{'name':'GT2','capacity':10,'cost':25}]}PowerSystem=psddp.PowerSystem(data=data)operation=PowerSystem.dispatch(solver='ulp',scenario=1,verbose=True)print(operation)