cloudpss 4.1.1b7__py3-none-any.whl → 4.5.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cloudpss/__init__.py +2 -3
- cloudpss/asyncio/__init__.py +8 -0
- cloudpss/asyncio/job/__init__.py +5 -0
- cloudpss/asyncio/job/job.py +116 -0
- cloudpss/asyncio/job/messageStreamReceiver.py +121 -0
- cloudpss/asyncio/job/messageStreamSender.py +45 -0
- cloudpss/asyncio/model/__init__.py +5 -0
- cloudpss/asyncio/model/model.py +257 -0
- cloudpss/asyncio/model/revision.py +41 -0
- cloudpss/asyncio/model/topology.py +34 -0
- cloudpss/asyncio/utils/__init__.py +6 -0
- cloudpss/{utils → asyncio/utils}/httpAsyncRequest.py +2 -2
- cloudpss/dslab/dataManageModel.py +43 -14
- cloudpss/dslab/dslab.py +35 -9
- cloudpss/dslab/files/curveData.py +35066 -35042
- cloudpss/dslab/files/files.py +21 -13
- cloudpss/function/functionExecution.py +74 -5
- cloudpss/ieslab/DataManageModel.py +144 -9
- cloudpss/ieslab/EvaluationModel.py +80 -9
- cloudpss/ieslab/IESLabOpt.py +235 -0
- cloudpss/ieslab/IESLabPlan.py +82 -4
- cloudpss/ieslab/IESLabSimulation.py +59 -32
- cloudpss/ieslab/PlanModel.py +222 -18
- cloudpss/ieslab/__init__.py +2 -1
- cloudpss/job/TemplateCompiler.py +273 -0
- cloudpss/job/TemplateManager.py +37 -0
- cloudpss/job/job.py +136 -141
- cloudpss/job/jobReceiver.py +8 -2
- cloudpss/job/messageStreamReceiver.py +42 -99
- cloudpss/job/messageStreamSender.py +5 -42
- cloudpss/job/{view/EMTView.py → result/EMTResult.py} +57 -14
- cloudpss/job/result/IESLabSimulationResult.py +5 -0
- cloudpss/job/result/IESLabTypicalDayResult.py +134 -0
- cloudpss/job/{view/IESView.py → result/IESResult.py} +7 -5
- cloudpss/job/{view/PowerFlowView.py → result/PowerFlowResult.py} +2 -2
- cloudpss/job/result/__init__.py +40 -0
- cloudpss/job/{view/view.py → result/result.py} +38 -8
- cloudpss/model/implements/diagram.py +140 -0
- cloudpss/model/jobDefinitions.py +6 -6
- cloudpss/model/model.py +245 -226
- cloudpss/model/revision.py +30 -35
- cloudpss/model/topology.py +26 -15
- cloudpss/runner/IESLabEvaluationResult.py +14 -6
- cloudpss/runner/IESLabPlanResult.py +91 -35
- cloudpss/runner/IESLabTypicalDayResult.py +62 -50
- cloudpss/runner/MessageStreamReceiver.py +5 -100
- cloudpss/runner/result.py +6 -1
- cloudpss/runner/runner.py +97 -53
- cloudpss/utils/IO.py +3 -1
- cloudpss/utils/graphqlUtil.py +3 -2
- cloudpss/utils/httprequests.py +19 -10
- cloudpss/version.py +1 -1
- {cloudpss-4.1.1b7.dist-info → cloudpss-4.5.13.dist-info}/METADATA +2 -2
- cloudpss-4.5.13.dist-info/RECORD +80 -0
- cloudpss/dslab/DSLabFinancialResult.py +0 -96
- cloudpss/job/jobMachine.py +0 -11
- cloudpss/job/jobPolicy.py +0 -129
- cloudpss/job/jobQueue.py +0 -14
- cloudpss/job/jobTres.py +0 -6
- cloudpss/job/view/IESLabSimulationView.py +0 -5
- cloudpss/job/view/IESLabTypicalDayView.py +0 -27
- cloudpss/job/view/__init__.py +0 -42
- cloudpss-4.1.1b7.dist-info/RECORD +0 -72
- /cloudpss/{utils → asyncio/utils}/AsyncIterable.py +0 -0
- {cloudpss-4.1.1b7.dist-info → cloudpss-4.5.13.dist-info}/WHEEL +0 -0
- {cloudpss-4.1.1b7.dist-info → cloudpss-4.5.13.dist-info}/top_level.txt +0 -0
cloudpss/dslab/files/files.py
CHANGED
@@ -1,18 +1,26 @@
|
|
1
|
-
from .curveData import 基准出力曲线, 基准出力曲线2, 基准出力曲线3, 负荷曲线,
|
1
|
+
from .curveData import 基准出力曲线, 基准出力曲线2, 基准出力曲线3, 负荷曲线, 策略曲线, 运行策略曲线
|
2
|
+
|
3
|
+
extra_paths = {
|
4
|
+
'光伏': 基准出力曲线,
|
5
|
+
'光伏曲线': 基准出力曲线,
|
6
|
+
'风机': 基准出力曲线,
|
7
|
+
'风机曲线': 基准出力曲线,
|
8
|
+
'燃气': 基准出力曲线2,
|
9
|
+
'燃气曲线': 基准出力曲线,
|
10
|
+
'水电': 基准出力曲线2,
|
11
|
+
'水电曲线': 基准出力曲线,
|
12
|
+
'火电': 基准出力曲线2,
|
13
|
+
'火电曲线': 基准出力曲线,
|
14
|
+
'生物质发电': 基准出力曲线2,
|
15
|
+
'生物质发电曲线': 基准出力曲线,
|
16
|
+
'垃圾电厂': 基准出力曲线2,
|
17
|
+
'垃圾电厂曲线': 基准出力曲线,
|
18
|
+
'负荷分类': 负荷曲线,
|
19
|
+
'负荷用户': 负荷曲线,
|
20
|
+
'储能运行策略': 运行策略曲线,
|
21
|
+
}
|
2
22
|
|
3
23
|
def getCurveData(kind):
|
4
|
-
extra_paths = {
|
5
|
-
'光伏': 基准出力曲线,
|
6
|
-
'风机': 基准出力曲线,
|
7
|
-
'燃气': 基准出力曲线2,
|
8
|
-
'水电': 基准出力曲线2,
|
9
|
-
'常规小火电': 基准出力曲线2,
|
10
|
-
'生物质发电': 基准出力曲线2,
|
11
|
-
'垃圾电厂': 基准出力曲线2,
|
12
|
-
'负荷分类': 负荷曲线,
|
13
|
-
'负荷用户': 负荷曲线,
|
14
|
-
'储能配置': 策略曲线,
|
15
|
-
}
|
16
24
|
if kind in extra_paths:
|
17
25
|
return extra_paths[kind]
|
18
26
|
else :
|
@@ -4,6 +4,8 @@ import json
|
|
4
4
|
import signal
|
5
5
|
import sys
|
6
6
|
from ..utils import MatlabDataEncoder
|
7
|
+
import threading
|
8
|
+
import queue
|
7
9
|
|
8
10
|
|
9
11
|
class EventSample(object):
|
@@ -23,7 +25,23 @@ class EventSample(object):
|
|
23
25
|
eventHandlerKwargs] in self.__eventHandlerSample:
|
24
26
|
eventHandlerSample(*eventHandlerArgs, **eventHandlerKwargs)
|
25
27
|
|
28
|
+
class EventInput(object):
|
29
|
+
def __init__(self):
|
30
|
+
self.__eventHandlerSample = []
|
26
31
|
|
32
|
+
def __iadd__(self, EventHandler):
|
33
|
+
self.__eventHandlerSample.append(EventHandler)
|
34
|
+
return self
|
35
|
+
|
36
|
+
def __isub__(self, EventHandler):
|
37
|
+
self.__eventHandlerSample.remove(EventHandler)
|
38
|
+
return self
|
39
|
+
|
40
|
+
def __call__(self, *args, **kwargs):
|
41
|
+
for [eventHandlerSample] in self.__eventHandlerSample:
|
42
|
+
# 调用事件处理程序
|
43
|
+
if eventHandlerSample:
|
44
|
+
eventHandlerSample(*args, **kwargs)
|
27
45
|
class Args(dict):
|
28
46
|
"""
|
29
47
|
参数类
|
@@ -87,7 +105,9 @@ class FunctionExecution(object):
|
|
87
105
|
self.token = kwargs.get('token', None)
|
88
106
|
self.functionToken = kwargs.get('functionToken', None)
|
89
107
|
self.__abortedEvents = EventSample()
|
108
|
+
self.__inputEvents = EventInput()
|
90
109
|
self._args = None
|
110
|
+
self.__input_thread = None
|
91
111
|
signal.signal(signal.SIGINT, self._on_abort)
|
92
112
|
|
93
113
|
@property
|
@@ -99,6 +119,26 @@ class FunctionExecution(object):
|
|
99
119
|
self._args = val
|
100
120
|
|
101
121
|
@staticmethod
|
122
|
+
def __listObj2Array(data):
|
123
|
+
arr=[]
|
124
|
+
for item in data:
|
125
|
+
if type(item) is list:
|
126
|
+
arr.append(FunctionExecution.__listObj2Array(item))
|
127
|
+
elif type(item) is dict and ('ɵid' in item or '?id' in item ):
|
128
|
+
a = list(range(len(item)-1))
|
129
|
+
for k, v in item.items():
|
130
|
+
if k == 'ɵid' or k == '?id':
|
131
|
+
continue
|
132
|
+
k = int(k)
|
133
|
+
if type(v) is list:
|
134
|
+
a[k] = FunctionExecution.__listObj2Array(v)
|
135
|
+
else:
|
136
|
+
a[k] = v
|
137
|
+
arr.append(a)
|
138
|
+
else:
|
139
|
+
arr.append(item)
|
140
|
+
return arr
|
141
|
+
@staticmethod
|
102
142
|
def __loadArgs():
|
103
143
|
"""加载当前任务参数
|
104
144
|
|
@@ -110,9 +150,12 @@ class FunctionExecution(object):
|
|
110
150
|
if k.startswith('CLOUDPSS_JOB_ARG-'):
|
111
151
|
s = k.split('-')
|
112
152
|
key = bytes.decode(bytes.fromhex(s[1]))
|
113
|
-
|
114
|
-
|
115
|
-
|
153
|
+
data = json.loads(v)
|
154
|
+
|
155
|
+
if type(data) is list:
|
156
|
+
data = FunctionExecution.__listObj2Array(data)
|
157
|
+
|
158
|
+
args[key] = data
|
116
159
|
return args
|
117
160
|
|
118
161
|
def feedDog(self):
|
@@ -162,6 +205,23 @@ class FunctionExecution(object):
|
|
162
205
|
'''
|
163
206
|
sys.exit(code)
|
164
207
|
|
208
|
+
def input_thread(self):
|
209
|
+
while True:
|
210
|
+
user_input = input()
|
211
|
+
self.__inputEvents(user_input)
|
212
|
+
|
213
|
+
def on_input(self, func):
|
214
|
+
"""
|
215
|
+
监听input事件
|
216
|
+
|
217
|
+
:params func 响应后的回调函数
|
218
|
+
"""
|
219
|
+
if self.__input_thread is None:
|
220
|
+
self.__input_thread = threading.Thread(target=self.input_thread, args=())
|
221
|
+
self.__input_thread.start()
|
222
|
+
self.log('cloudpss input stream is ready', 'debug')
|
223
|
+
self.__inputEvents += [func]
|
224
|
+
|
165
225
|
def print(self, data):
|
166
226
|
print(json.dumps(data, cls=MatlabDataEncoder)+'\n', flush=True)
|
167
227
|
|
@@ -392,8 +452,17 @@ class FunctionExecution(object):
|
|
392
452
|
'title': title,
|
393
453
|
'traces':
|
394
454
|
[self.__plotlyDataToTrace(trace) for trace in traces],
|
395
|
-
'
|
396
|
-
'yAxis': layout.get('yaxis', {}),
|
455
|
+
'layout': layout,
|
397
456
|
}
|
398
457
|
}
|
458
|
+
self.print(result)
|
459
|
+
|
460
|
+
def custom(self, data, key=None,verb='replace'):
|
461
|
+
result = {
|
462
|
+
'key': key,
|
463
|
+
'version': 1,
|
464
|
+
'verb': verb,
|
465
|
+
'type': 'custom',
|
466
|
+
'data': data
|
467
|
+
}
|
399
468
|
self.print(result)
|
@@ -83,10 +83,9 @@ class DataManageModel(object):
|
|
83
83
|
|
84
84
|
:return: 无
|
85
85
|
'''
|
86
|
-
list = ['thermalLoads', 'electricLoads', 'fuels', 'typhoon', 'rainfall', 'earthquake', 'extremeCold']
|
86
|
+
list = ['thermalLoads', 'heatingLoad', 'coolingLoad', 'electricLoads', 'fuels', 'typhoon', 'rainfall', 'earthquake', 'extremeCold', 'HydrogenLoad', 'ammoniaLoad']
|
87
87
|
for kind,value in self._kindUrlMap.items():
|
88
88
|
try:
|
89
|
-
|
90
89
|
if kind in list:
|
91
90
|
dataList = self._fetchItemData(self._kindUrlMap[kind], None)
|
92
91
|
else:
|
@@ -102,12 +101,13 @@ class DataManageModel(object):
|
|
102
101
|
|
103
102
|
def GetDataItem(self, ID: str):
|
104
103
|
'''
|
105
|
-
获取ID
|
104
|
+
获取ID对应的数据信息
|
106
105
|
|
107
106
|
:params: ID string类型,代表数据项的标识符,可以在所有类型的数据项中实现唯一标识
|
108
107
|
|
109
108
|
:return: dict类型,为源数据的引用,返回该数据项的信息
|
110
109
|
'''
|
110
|
+
|
111
111
|
data = self._itemDataMap.get(str(ID),None)
|
112
112
|
|
113
113
|
assert (data is not None), "找不到数据"
|
@@ -125,6 +125,7 @@ class DataManageModel(object):
|
|
125
125
|
assert (dataType in self._kindNameMap
|
126
126
|
or dataType in self._kindUrlMap), "数据类型不存在"
|
127
127
|
kind = self._kindNameMap.get(dataType, dataType)
|
128
|
+
print(kind)
|
128
129
|
return copy.deepcopy(self._kindItemDataMap[kind])
|
129
130
|
|
130
131
|
def AddDataItem(self, dataType, data):
|
@@ -151,7 +152,7 @@ class DataManageModel(object):
|
|
151
152
|
self._kindIdMap[str(data['id'])]=kind
|
152
153
|
self._itemDataMap[str(data['timeid'])]=data
|
153
154
|
self._itemDataMap[str(data['id'])]=data
|
154
|
-
if kind in ['thermalLoads', 'electricLoads', 'fuels']:
|
155
|
+
if kind in ['thermalLoads', 'heatingLoad','coolingLoad', 'electricLoads', 'fuels', 'ammoniaLoad']:
|
155
156
|
dataList = self._fetchItemData(self._kindUrlMap[kind], None)
|
156
157
|
self._kindItemDataMap[kind] = dataList
|
157
158
|
return dataList[-1]['id']
|
@@ -281,11 +282,35 @@ class DataManageModel(object):
|
|
281
282
|
})
|
282
283
|
weatherData = json.loads(r.text)
|
283
284
|
return weatherData['results']
|
285
|
+
|
286
|
+
def UpdateAtmosData(self, data):
|
287
|
+
'''
|
288
|
+
更新气象数据
|
289
|
+
:data: list类型,表示数据内容,其数据结构应满足对应数据项的满足如下结构要求:
|
290
|
+
"lat": string类型 坐标纬度
|
291
|
+
"lng": string类型 坐标经度
|
292
|
+
"time": string类型 表示时间 需满足格式YYYY-MM-DD hh:mm:ss 如"2016-01-01 00:00:00"
|
293
|
+
"t10m": string类型 表示环境温度(℃)
|
294
|
+
"lwgab_swgdn": string类型 表示太阳辐射强度(W/m2)
|
295
|
+
"u10m": string类型 距地面10m处东向风速(m/s)
|
296
|
+
"u50m": string类型 距地面50m处东向风速(m/s)
|
297
|
+
"v10m": string类型 距地面10m处北向风速(m/s)
|
298
|
+
"v50m": string类型 距地面50m处北向风速(m/s)
|
299
|
+
"adj_sfc_sw_direct_all_1h": string类型 短波直射强度(W/m²)
|
300
|
+
"adj_sfc_sw_diff_all_1h": string类型 短波散射强度(W/m²)
|
301
|
+
"solar_zen_angle_1h": string类型 太阳天顶角°
|
302
|
+
:return: bool 类型,返回True 更新成功
|
303
|
+
'''
|
304
|
+
r = request('POST',
|
305
|
+
self._weatherUrl,
|
306
|
+
data=json.dumps({"sid":self.simulationId, "data":data}))
|
307
|
+
return r.ok
|
284
308
|
|
285
309
|
|
286
310
|
class IESSimulationDataManageModel(DataManageModel):
|
287
311
|
_baseUri = 'api/ieslab-simulation/'
|
288
312
|
_weatherUrl = 'api/ieslab-simulation/rest/weather_data/'
|
313
|
+
_dataManageUrl = 'api/ieslab-simulation/editor/data_manage/'
|
289
314
|
_kindNameMap = {
|
290
315
|
"光伏": "PhotovoltaicSys",
|
291
316
|
"风机": "WindPowerGenerator",
|
@@ -314,7 +339,7 @@ class IESSimulationDataManageModel(DataManageModel):
|
|
314
339
|
"台风灾害": "typhoon",
|
315
340
|
"降雨灾害": "rainfall",
|
316
341
|
"地震灾害": "earthquake",
|
317
|
-
"极寒灾害": "extremeCold"
|
342
|
+
"极寒灾害": "extremeCold",
|
318
343
|
}
|
319
344
|
_kindUrlMap = {
|
320
345
|
"PhotovoltaicSys": "api/ieslab-simulation/rest/dpcs/",
|
@@ -344,7 +369,7 @@ class IESSimulationDataManageModel(DataManageModel):
|
|
344
369
|
"typhoon": "api/ieslab-simulation/rest/typhoon/",
|
345
370
|
"rainfall": "api/ieslab-simulation/rest/rainfall/",
|
346
371
|
"earthquake": "api/ieslab-simulation/rest/earthquake/",
|
347
|
-
"extremeCold": "api/ieslab-simulation/rest/extremeCold/"
|
372
|
+
"extremeCold": "api/ieslab-simulation/rest/extremeCold/",
|
348
373
|
}
|
349
374
|
pass
|
350
375
|
|
@@ -352,6 +377,7 @@ class IESSimulationDataManageModel(DataManageModel):
|
|
352
377
|
class IESPlanDataManageModel(DataManageModel):
|
353
378
|
_baseUri = 'api/ieslab-plan/'
|
354
379
|
_weatherUrl = 'api/ieslab-plan/rest/weather_data/'
|
380
|
+
_dataManageUrl = 'api/ieslab-plan/editor/data_manage/'
|
355
381
|
_kindNameMap = {
|
356
382
|
"光伏": "PhotovoltaicSys",
|
357
383
|
"风机": "WindPowerGenerator",
|
@@ -363,6 +389,7 @@ class IESPlanDataManageModel(DataManageModel):
|
|
363
389
|
"吸收式制冷机": "AbsorptionChiller",
|
364
390
|
"蓄电池": "Battery",
|
365
391
|
"储水罐": "WaterTank",
|
392
|
+
"蓄冰空调": "IceStorageAC",
|
366
393
|
"变压器": "Transformer",
|
367
394
|
"传输线": "TransferLine",
|
368
395
|
"模块化多电平变流器": "MMC",
|
@@ -380,7 +407,8 @@ class IESPlanDataManageModel(DataManageModel):
|
|
380
407
|
"台风灾害": "typhoon",
|
381
408
|
"降雨灾害": "rainfall",
|
382
409
|
"地震灾害": "earthquake",
|
383
|
-
"极寒灾害": "extremeCold"
|
410
|
+
"极寒灾害": "extremeCold",
|
411
|
+
"换热器": "HeatExchanger",
|
384
412
|
}
|
385
413
|
_kindUrlMap = {
|
386
414
|
"PhotovoltaicSys": "api/ieslab-plan/rest/dpcs/",
|
@@ -389,10 +417,11 @@ class IESPlanDataManageModel(DataManageModel):
|
|
389
417
|
"HeatPump": "api/ieslab-plan/rest/dhscs/",
|
390
418
|
"GasBoiler": "api/ieslab-plan/rest/dhscs/",
|
391
419
|
"HPSolarCollector": "api/ieslab-plan/rest/dhscs/",
|
392
|
-
"CompRefrg": "api/ieslab-
|
420
|
+
"CompRefrg": "api/ieslab-simulation/rest/dhscs/",
|
393
421
|
"AbsorptionChiller": "api/ieslab-plan/rest/dhscs/",
|
394
422
|
"Battery": "api/ieslab-plan/rest/escs/",
|
395
423
|
"WaterTank": "api/ieslab-plan/rest/escs/",
|
424
|
+
"IceStorageAC": "api/ieslab-plan/rest/escs/",
|
396
425
|
"Transformer": "api/ieslab-plan/rest/dstcs/",
|
397
426
|
"TransferLine": "api/ieslab-plan/rest/dstcs/",
|
398
427
|
"MMC": "api/ieslab-plan/rest/dstcs/",
|
@@ -410,6 +439,112 @@ class IESPlanDataManageModel(DataManageModel):
|
|
410
439
|
"typhoon": "api/ieslab-plan/rest/typhoon/",
|
411
440
|
"rainfall": "api/ieslab-plan/rest/rainfall/",
|
412
441
|
"earthquake": "api/ieslab-plan/rest/earthquake/",
|
413
|
-
"extremeCold": "api/ieslab-plan/rest/extremeCold/"
|
442
|
+
"extremeCold": "api/ieslab-plan/rest/extremeCold/",
|
443
|
+
"HeatExchanger": "api/ieslab-plan/rest/hstcs/",
|
444
|
+
}
|
445
|
+
pass
|
446
|
+
|
447
|
+
class IESOptDataManageModel(DataManageModel):
|
448
|
+
_baseUri = 'api/ieslab-opt/'
|
449
|
+
_weatherUrl = 'api/ieslab-opt/rest/weather_data/'
|
450
|
+
_kindNameMap = {
|
451
|
+
"光伏": "PhotovoltaicSys",
|
452
|
+
"风机": "WindPowerGenerator",
|
453
|
+
"燃料发电机组": "GasTurbine",
|
454
|
+
"空气源热泵": "HeatPump",
|
455
|
+
"燃气锅炉": "GasBoiler",
|
456
|
+
"太阳能集热器": "HPSolarCollector",
|
457
|
+
"吸收式热泵": "AbsorptionHeatPump",
|
458
|
+
"单工况制冷机": "SingleConChiller",
|
459
|
+
"双工况制冷机": "DualConChiller",
|
460
|
+
"吸收式制冷机": "AbsorptionChiller",
|
461
|
+
"蓄电池": "Battery",
|
462
|
+
"蓄冰槽": "IceStorageAC",
|
463
|
+
"变压器": "Transformer",
|
464
|
+
"传输线": "TransferLine",
|
465
|
+
"模块化多电平变流器": "MMC",
|
466
|
+
"离心泵": "CentrifugalPump",
|
467
|
+
"管道": "Pipe",
|
468
|
+
"热负荷": "heatingLoad",
|
469
|
+
"冷负荷": "coolingLoad",
|
470
|
+
"电负荷": "electricLoads",
|
471
|
+
"燃料": "fuels",
|
472
|
+
"热": "HVACHeating",
|
473
|
+
"冷": "HVACCooling",
|
474
|
+
"常数电价": "常数电价",
|
475
|
+
"分时电价": "分时电价",
|
476
|
+
"阶梯电价": "阶梯电价",
|
477
|
+
"分时阶梯电价": "分时阶梯电价",
|
478
|
+
"台风灾害": "typhoon",
|
479
|
+
"降雨灾害": "rainfall",
|
480
|
+
"地震灾害": "earthquake",
|
481
|
+
"极寒灾害": "extremeCold",
|
482
|
+
"PEM燃料电池": "PEMF",
|
483
|
+
"SOFC": "SOFC",
|
484
|
+
"碱性电解槽": "ALK",
|
485
|
+
"PEM电解槽": "PEME",
|
486
|
+
"SOEC": "SOEC",
|
487
|
+
"储氢罐": "HydrogenTank",
|
488
|
+
"储热罐": "HeatStoTank",
|
489
|
+
"储冷罐": "CoolStoTank",
|
490
|
+
"换热器": "HeatExchanger",
|
491
|
+
"氢气压缩设备": "HydrogenCompression",
|
492
|
+
"氢负荷": "HydrogenLoad",
|
493
|
+
"氢": "HydrogenProductionFuels",
|
494
|
+
"运氢槽车": "HydrogenTanker",
|
495
|
+
"制氨设备": "AmmoniaProduction",
|
496
|
+
"储氨罐": "AmmoniaStoTank",
|
497
|
+
"制氮设备": "NitrogenProduction",
|
498
|
+
"氨负荷": "ammoniaLoad",
|
499
|
+
}
|
500
|
+
_kindUrlMap = {
|
501
|
+
"PhotovoltaicSys": "api/ieslab-opt/rest/dpcs/",
|
502
|
+
"WindPowerGenerator": "api/ieslab-opt/rest/dpcs/",
|
503
|
+
"GasTurbine": "api/ieslab-opt/rest/dpcs/",
|
504
|
+
"HeatPump": "api/ieslab-opt/rest/dhscs/",
|
505
|
+
"GasBoiler": "api/ieslab-opt/rest/dhscs/",
|
506
|
+
"HPSolarCollector": "api/ieslab-opt/rest/dhscs/",
|
507
|
+
"AbsorptionHeatPump": "api/ieslab-opt/rest/dhscs/",
|
508
|
+
"SingleConChiller": "api/ieslab-opt/rest/dhscs/",
|
509
|
+
"DualConChiller": "api/ieslab-opt/rest/dhscs/",
|
510
|
+
"AbsorptionChiller": "api/ieslab-opt/rest/dhscs/",
|
511
|
+
"Battery": "api/ieslab-opt/rest/escs/",
|
512
|
+
"IceStorageAC": "api/ieslab-opt/rest/escs/",
|
513
|
+
"Transformer": "api/ieslab-opt/rest/dstcs/",
|
514
|
+
"TransferLine": "api/ieslab-opt/rest/dstcs/",
|
515
|
+
"MMC": "api/ieslab-opt/rest/dstcs/",
|
516
|
+
"CentrifugalPump": "api/ieslab-opt/rest/hstcs/",
|
517
|
+
"Pipe": "api/ieslab-opt/rest/hstcs/",
|
518
|
+
"heatingLoad": "api/ieslab-opt/rest/heatingLoad/",
|
519
|
+
"coolingLoad": "api/ieslab-opt/rest/coolingLoad/",
|
520
|
+
"electricLoads": "api/ieslab-opt/rest/electricLoads/",
|
521
|
+
"fuels": "api/ieslab-opt/rest/fuels/",
|
522
|
+
"HVACHeating": "api/ieslab-opt/rest/hots/",
|
523
|
+
"HVACCooling": "api/ieslab-opt/rest/colds/",
|
524
|
+
"常数电价": "api/ieslab-opt/rest/elects/",
|
525
|
+
"分时电价": "api/ieslab-opt/rest/elects/",
|
526
|
+
"阶梯电价": "api/ieslab-opt/rest/elects/",
|
527
|
+
"分时阶梯电价": "api/ieslab-opt/rest/elects/",
|
528
|
+
"typhoon": "api/ieslab-opt/rest/typhoon/",
|
529
|
+
"rainfall": "api/ieslab-opt/rest/rainfall/",
|
530
|
+
"earthquake": "api/ieslab-opt/rest/earthquake/",
|
531
|
+
"extremeCold": "api/ieslab-opt/rest/extremeCold/",
|
532
|
+
"HydrogenTank": "api/ieslab-opt/rest/escs/",
|
533
|
+
"HeatStoTank": "api/ieslab-opt/rest/escs/",
|
534
|
+
"CoolStoTank": "api/ieslab-opt/rest/escs/",
|
535
|
+
"HeatExchanger": "api/ieslab-opt/rest/hstcs/",
|
536
|
+
"HydrogenCompression": "api/ieslab-opt/rest/hsec/",
|
537
|
+
"HydrogenLoad": "api/ieslab-opt/rest/hydrogenLoad/",
|
538
|
+
"HydrogenProductionFuels": "api/ieslab-opt/rest/hydrogen/",
|
539
|
+
"HydrogenTanker": "api/ieslab-opt/rest/hydrogen/",
|
540
|
+
"PEMF": "api/ieslab-opt/rest/dhscs/",
|
541
|
+
"SOFC": "api/ieslab-opt/rest/dhscs/",
|
542
|
+
"ALK": "api/ieslab-opt/rest/hpc/",
|
543
|
+
"PEME": "api/ieslab-opt/rest/hpc/",
|
544
|
+
"SOEC": "api/ieslab-opt/rest/hpc/",
|
545
|
+
"AmmoniaProduction": "api/ieslab-opt/rest/apc/",
|
546
|
+
"AmmoniaStoTank": "api/ieslab-opt/rest/escs/",
|
547
|
+
"NitrogenProduction": "api/ieslab-opt/rest/asec/",
|
548
|
+
"ammoniaLoad": "api/ieslab-opt/rest/ammoniaLoad/",
|
414
549
|
}
|
415
550
|
pass
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import time
|
2
|
-
from cloudpss.runner.runner import HttpRunner, Runner
|
3
|
-
from cloudpss.runner.IESLabEvaluationResult import
|
2
|
+
from cloudpss.runner.runner import HttpRunner, Runner, HttpOPTRunner
|
3
|
+
from cloudpss.runner.IESLabEvaluationResult import IESLabPlanEvaluationResult, IESLabOptEvaluationResult
|
4
4
|
from ..utils import request
|
5
5
|
import json
|
6
6
|
from enum import IntEnum, unique
|
7
7
|
|
8
8
|
class IESLabEvaluationModel(object):
|
9
|
-
_baseUri = '
|
10
|
-
_taskUri = '
|
9
|
+
_baseUri = ''
|
10
|
+
_taskUri = ''
|
11
|
+
_runUri = ''
|
11
12
|
_kindNameMap = {
|
12
13
|
"投资组成": "investmentbanchandproportion",
|
13
14
|
"资金来源": "capitalsource",
|
@@ -123,16 +124,16 @@ class IESLabEvaluationModel(object):
|
|
123
124
|
dict_result[v] = list['results']
|
124
125
|
return dict_result
|
125
126
|
|
126
|
-
def run(self, planID, type=None) ->
|
127
|
+
def run(self, planID, type=None) -> HttpRunner[IESLabPlanEvaluationResult]:
|
127
128
|
'''
|
128
129
|
运行方案评估
|
129
130
|
|
130
131
|
:param planID int类型,表示优化方案的ID,数值位于0~优化方案数量之间
|
131
132
|
:params type: string类型,任务类型:环保评价/能效评价
|
132
133
|
|
133
|
-
:return: Runner[
|
134
|
+
:return: Runner[IESLabPlanEvaluationResult]
|
134
135
|
'''
|
135
|
-
url =
|
136
|
+
url = self._runUri
|
136
137
|
CMD_TYPE = type if type is None else self._evaluationType[type]
|
137
138
|
try:
|
138
139
|
timeId = int(time.time() * 1000)
|
@@ -172,7 +173,7 @@ class IESLabEvaluationModel(object):
|
|
172
173
|
'''
|
173
174
|
return self.run(planID, 'energyEvaluation')
|
174
175
|
|
175
|
-
def GetRunner(self, planID) -> Runner[
|
176
|
+
def GetRunner(self, planID) -> Runner[IESLabPlanEvaluationResult]:
|
176
177
|
'''
|
177
178
|
获得运行实例
|
178
179
|
|
@@ -186,4 +187,74 @@ class IESLabEvaluationModel(object):
|
|
186
187
|
@unique
|
187
188
|
class OptimizationMode(IntEnum):
|
188
189
|
经济性 = 0
|
189
|
-
环保性 = 1
|
190
|
+
环保性 = 1
|
191
|
+
|
192
|
+
|
193
|
+
class IESLabPlanEvaluationModel(IESLabEvaluationModel):
|
194
|
+
_baseUri = 'api/ieslab-plan/rest/'
|
195
|
+
_taskUri = 'api/ieslab-plan/taskmanager/getSimuLastTasks'
|
196
|
+
_runUri = 'api/ieslab-plan/taskmanager/saveDataToclickhouse'
|
197
|
+
|
198
|
+
def run(self, planID, type=None) -> HttpRunner[IESLabPlanEvaluationResult]:
|
199
|
+
'''
|
200
|
+
运行方案评估
|
201
|
+
|
202
|
+
:param planID int类型,表示优化方案的ID,数值位于0~优化方案数量之间
|
203
|
+
:params type: string类型,任务类型:环保评价/能效评价
|
204
|
+
|
205
|
+
:return: HttpRunner[IESLabEvaluationResult]
|
206
|
+
'''
|
207
|
+
url = self._runUri
|
208
|
+
CMD_TYPE = type if type is None else self._evaluationType[type]
|
209
|
+
try:
|
210
|
+
timeId = int(time.time() * 1000)
|
211
|
+
r = request('GET',
|
212
|
+
url,
|
213
|
+
params={
|
214
|
+
"simuid": self.simulationId,
|
215
|
+
"planId": planID,
|
216
|
+
"CMD_TYPE": CMD_TYPE
|
217
|
+
})
|
218
|
+
data = json.loads(r.text)
|
219
|
+
return HttpRunner({'rid': 'function/ieslab/evaluation'},
|
220
|
+
self.simulationId,
|
221
|
+
timeId=timeId,
|
222
|
+
planId=planID,
|
223
|
+
cmdType=CMD_TYPE)
|
224
|
+
except:
|
225
|
+
raise Exception('方案评估开始计算失败')
|
226
|
+
|
227
|
+
|
228
|
+
class IESLabOptEvaluationModel(IESLabEvaluationModel):
|
229
|
+
_baseUri = 'api/ieslab-opt/rest/'
|
230
|
+
_taskUri = 'api/ieslab-opt/taskmanager/getSimuLastTasks'
|
231
|
+
_runUri = 'api/ieslab-opt/taskmanager/saveDataToclickhouse'
|
232
|
+
|
233
|
+
def run(self, planID, type=None) -> HttpOPTRunner[IESLabOptEvaluationResult]:
|
234
|
+
'''
|
235
|
+
运行方案评估
|
236
|
+
|
237
|
+
:param planID int类型,表示优化方案的ID,数值位于0~优化方案数量之间
|
238
|
+
:params type: string类型,任务类型:环保评价/能效评价
|
239
|
+
|
240
|
+
:return: HttpRunner[IESLabEvaluationResult]
|
241
|
+
'''
|
242
|
+
url = self._runUri
|
243
|
+
CMD_TYPE = type if type is None else self._evaluationType[type]
|
244
|
+
try:
|
245
|
+
timeId = int(time.time() * 1000)
|
246
|
+
r = request('GET',
|
247
|
+
url,
|
248
|
+
params={
|
249
|
+
"simuid": self.simulationId,
|
250
|
+
"planId": planID,
|
251
|
+
"CMD_TYPE": CMD_TYPE
|
252
|
+
})
|
253
|
+
data = json.loads(r.text)
|
254
|
+
return HttpOPTRunner({'rid': 'function/ieslab/evaluation'},
|
255
|
+
self.simulationId,
|
256
|
+
timeId=timeId,
|
257
|
+
planId=planID,
|
258
|
+
cmdType=CMD_TYPE)
|
259
|
+
except:
|
260
|
+
raise Exception('方案评估开始计算失败')
|