一个Python框架,用于开发、测试和评估城区多能源系统的基于优化的功率调度算法

pycity-scheduling的Python项目详细描述


PYU调度

Python包pycity_调度是一个有效开发、测试和评估基于优化的城市区域多能源系统电力调度算法的框架。 该框架主要针对协调概念的阐述,这些概念能够有效地解决城市-地区层面的电力调度问题。 它的目标用户是智能电网应用领域的研究人员,以及当地能源系统运行灵活性的部署。在

贡献

  1. 通过SSH(git clone git@git.rwth-aachen.de:acs/public/simulation/pycity_scheduling.git)克隆存储库或通过HTTPS(git clone https://git.rwth-aachen.de/acs/public/simulation/pycity_scheduling.git)克隆存储库
  2. https://git.rwth-aachen.de/acs/public/simulation/pycity_scheduling/-/issues打开问题
  3. {cd3>分店}
  4. 更新您的本地开发分支机构(如有必要):git pull origin development
  5. 创建您的功能/问题分支:git checkout -b issueXY_explanation
  6. {cd6>提交您的更改^
  7. 推到分支:git push origin issueXY_explanation
  8. 通过https://git.rwth-aachen.de/acs/public/simulation/pycity_scheduling/-/merge_requests向开发分支提交来自issueXY_解释的合并请求
  9. 等待新实现的批准或修订。在

安装

pycity_调度至少需要以下Python包:

  • numpy公司
  • 熊猫
  • matplotlib库
  • pyomo公司
  • 匀称的
  • pycity_基地

{a3/凸规划的数学建模和求解器至少有一个是由凸规划支持的。 我们建议使用以下解算器之一:

安装pycity\u调度

pycity_调度的最新版本是v1.0.1。在

如果安装了上述所有依赖项,您应该能够通过PyPI(使用python3.X)安装包pycity_scheduling,如下所示:

pip install pycity_scheduling

或者:

pip install -e '<your_path_to_pycity_scheduling_git_folder>/src'

或者:

<path_to_your_python_binary> -m pip install -e '<your_path_to_pycity_scheduling_git_folder>/src'

您可以通过尝试将包pycity_scheduling导入Python环境来检查安装是否成功。 这个导入应该可以没有任何错误。在

import pycity_scheduling

您还可以尝试使用Python模块pytest运行位于./src/testing文件夹中的pycity_调度单元测试。在

文件

最新pycity_计划版本的文档可以在文件夹./docs和thisGitLab页面中找到。在

更多信息,请访问FEIN Aachen association website。在

示例用法

importnumpyasnpimportmatplotlib.pyplotaspltfrompycity_scheduling.classesimport*frompycity_scheduling.algorithmsimport*importpycity_scheduling.util.debugasdebug# This is a fundamental tutorial on how to use the pycity_scheduling package.defmain(do_plot=False):print("\n\n------ Example 00: Fundamentals ------\n\n")# 1) Environment objects:# (Almost) every object within pycity_scheduling requires an environment. The environment object holds general data,# which is valid for all objects within pycity_scheduling, such as time data, weather data or energy market prices.# Therefore, all objects point to an environment. The first step is usually to generate such an environment.# Generate a timer object for the environment:timer=Timer(step_size=3600,op_horizon=24,initial_date=(2015,1,1),initial_time=(0,0,0))# Generate a weather object for the environment:weather=Weather(timer=timer)# Generate a price object for the environment:price=Prices(timer=timer)# Generate the environment object:environment=Environment(timer=timer,weather=weather,prices=price)# Now there is a distinct environment object with timer, weather and price data.# We can use it to access different data of interest.# For example, print the current weekday:print('Weekday:')print(environment.timer.weekday)# For example, print the weather forecast for the outdoor temperature (only extract the first 10 timestep values):print('\nOutdoor temperature forecast:')print(environment.weather.getWeatherForecast(getTAmbient=True)[0][:10])# For example, print the energy spot market day-ahead prices:print('\nDay-ahead spot market prices on 2015/01/01:')print(environment.prices.da_prices)# 2) Buildings objects:# After defining the environment, different building objects should be created. In pycity_scheduling, buildings# represent the different customers of the local energy system / city district under investigation.# In general, buildings should also be understood in a more abstract way. For instance, a building object must not# necessarily represent a building structure, as it would be the case for a wind energy converter.# Create a building object:building=Building(environment=environment)# This building is assumed to be equipped with a building energy system and one apartment (=single-family house).# In general, every building object can, however, hold up to N different apartments (=multi-family house).apartment=Apartment(environment=environment)bes=BuildingEnergySystem(environment=environment)building.addMultipleEntities([apartment,bes])# Every apartment usually possesses both electrical and thermal loads:# The electrical load is added to the apartment as follows:load=FixedLoad(environment=environment,method=1,annual_demand=3000)# Print and show the electrical power curve in Watt:print('\nElectrical load in Watt:')print(load.get_power(currentValues=False))plt.plot(load.get_power(currentValues=False))plt.xlabel('Time in hours')plt.ylabel('Electrical power in Watt (fixed load)')plt.title('Fixed load power curve')ifdo_plot:plt.show()# The thermal load is added to the apartment as follows:space_heating=SpaceHeating(environment=environment,method=1,living_area=150,specific_demand=100)# Print and show space heating power curve in Watt:print('\nSpace heating power curve in Watt:')print(space_heating.get_power(currentValues=False))plt.plot(space_heating.get_power(currentValues=False))plt.xlabel('Time in hours')plt.ylabel('Thermal power in Watt (space heating)')plt.title('Space heating power curve')ifdo_plot:plt.show()apartment.addMultipleEntities([load,space_heating])# The BuildingEnergySystem (BES) class is a 'container' for all kind of building energy systems (i.e., electrical# and/or thermal assets). For example, we can add an electro-thermal heating system (such as a heatpump plus thermal# energy storage) and a photovoltaic unit to a building's BES as done below. In pycity_scheduling all BES devices# automatically come with basic scheduling models, which include the required Pyomo optimization variables and# several optimization constraints.eh=HeatPump(environment=environment,p_th_nom=16.0)ths=ThermalHeatingStorage(environment=environment,e_th_max=20.0,soc_init=0.5,loss_factor=0)pv=Photovoltaic(environment=environment,method=0,peak_power=8.0)bes.addMultipleDevices([eh,ths,pv])# Verify if the assets were added successfully (method getHasDevice):print('\nBES has heatpump? : ',bes.getHasDevices(all_devices=False,heatpump=True)[0])print('BES has thermal heating storage? : ',bes.getHasDevices(all_devices=False,ths=True)[0])print('BES has photovoltaic? : ',bes.getHasDevices(all_devices=False,pv=True)[0])# 3) CityDistrict objects:# In pycity_scheduling, a group of buildings form a CityDistrict object. The CityDistrict is the object to be# "provided" to a power scheduling algorithm later on. In other word, it encapsulates all buildings together with# their local assets and it hence includes all the optimization problem information and data.# Create a city district object:cd=CityDistrict(environment=environment)# Add the building from above to the city district at a certain position/coordinate (x, y).cd.addEntity(entity=building,position=[0,0])# Define and add three other buildings:foriinrange(3):heat_demand=SpaceHeating(environment=environment,method=1,living_area=150,specific_demand=100)el_load_demand=FixedLoad(environment=environment,method=1,annual_demand=3000)pv=Photovoltaic(environment=environment,method=0,peak_power=5.0)bl=Boiler(environment=environment,p_th_nom=24.0)ap=Apartment(environment=environment)ap.addEntity(heat_demand)ap.addEntity(el_load_demand)bes=BuildingEnergySystem(environment=environment)bes.addDevice(pv)bes.addDevice(bl)bd=Building(environment=environment)bd.addEntity(entity=ap)bd.addEntity(entity=bes)cd.addEntity(entity=bd,position=[0,i])# Print the city district information:print('\nTotal number of buildings in city district:')print(cd.get_nb_of_building_entities())print("\nDetailed city district information:")debug.print_district(cd,3)# 4) Power scheduling:# The final step is to schedule the buildings/assets inside the city district subject to a certain optimization# objective, which can be, for example, peak-shaving. The scheduling is then performed by the user by "passing"# the city district object to a certain power scheduling algorithm.# Here, the central optimization algorithm is used.# Set the city district / district operator objective and perform the power scheduling using the central# optimization algorithm:cd.set_objective("peak-shaving")opt=CentralOptimization(cd)opt.solve()# The scheduling results obtained from the algorithm run can be (temporally) stored as follows:cd.copy_schedule("my_central_scheduling")# Print and show the scheduling result (city district power values for every time slot within the defined# optimization horizon):print("\nPower schedule of city district:")print(list(cd.p_el_schedule))plt.plot(cd.p_el_schedule,drawstyle='steps')plt.xlabel('Time in hours')plt.ylabel('Electrical power in Kilowatt')plt.title('Electrical Power Schedule of CityDistrict')ifdo_plot:plt.show()returnif__name__=='__main__':# Run example:main(do_plot=True)

教程

pycity_调度包在文件夹./src/examples中附带了几个示例/教程脚本。 可以在/src/tests文件夹中找到。在

有关框架核心功能的基本用法,请参阅pycity_base包的教程。在

许可证

pycity_调度软件包由位于亚琛RWTH亚琛大学的复杂电力系统自动化研究所(ACS)、E.ON能源研究中心(E.ON ERC)发布。在

联系人

Institute for Automation of Complex Power Systems (ACS)
E.ON Energy Research Center (E.ON ERC)
RWTH Aachen University, Germany

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
来自Oozie Java Jobs的电子邮件   泛型Java映射。具有有界通配符的getOrDefault   java如何制作定制的Swing容器?   java断言使用正则表达式重新启动响应体   安卓 java正则表达式查找字符串中的所有空格   java循环语法不起作用   使用spring4@Transactional时,java事务不起作用   java三桨乒乓球命中检测   java Camera 2 Api错误不拍照的错误   java使用ServletContext从war外部读取Hibernate属性   性能如何禁用Java垃圾回收器?   如何通过MySQL触发器执行外部java函数?   使用Ecfbittorent下载torrent时出现java NegativeArraySizeException   java Android arraylist因迭代而崩溃   MyBatis中的java Delete查询没有删除任何内容