cloudpss 4.5.3__tar.gz → 4.5.4__tar.gz
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-4.5.3 → cloudpss-4.5.4}/PKG-INFO +1 -1
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/PlanModel.py +20 -59
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/runner.py +27 -12
- cloudpss-4.5.4/cloudpss/version.py +1 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss.egg-info/PKG-INFO +1 -1
- cloudpss-4.5.3/cloudpss/version.py +0 -1
- {cloudpss-4.5.3 → cloudpss-4.5.4}/README.md +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/job/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/job/job.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/job/messageStreamReceiver.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/job/messageStreamSender.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/model/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/model/model.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/model/revision.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/model/topology.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/utils/AsyncIterable.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/utils/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/asyncio/utils/httpAsyncRequest.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/function/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/function/function.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/function/functionExecution.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/function/job.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/DataManageModel.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/EvaluationModel.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/IESLabOpt.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/IESLabPlan.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/IESLabSimulation.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/ieslab/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/job.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/jobReceiver.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/messageStreamReceiver.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/messageStreamSender.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/EMTResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/IESLabSimulationResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/IESLabTypicalDayResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/IESResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/PowerFlowResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/job/result/result.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/implements/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/implements/component.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/implements/diagram.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/implements/implement.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/jobDefinitions.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/model.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/revision.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/model/topology.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/project/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/project/project.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/IESLabEvaluationResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/IESLabPlanResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/IESLabTypicalDayResult.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/MessageStreamReceiver.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/receiver.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/result.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/storage.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/runner/transform.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/IO.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/__init__.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/dataEncoder.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/graphqlUtil.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/httprequests.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/matlab.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/utils/yamlLoader.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss/verify.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss.egg-info/SOURCES.txt +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss.egg-info/dependency_links.txt +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss.egg-info/requires.txt +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/cloudpss.egg-info/top_level.txt +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/setup.cfg +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/setup.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-async.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-async2.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-async3.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-plot.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-plot1.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-sdk.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-sdk1.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-snapshot.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-topology.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-topology1.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test-yield.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test11.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test12.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test7950.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testAsync.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testEvent.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testRt-test.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testRt.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testRt2.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testSend.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test_in_new_web_1.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test_modepower_ampratio(3).py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test_ws.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/test_ws2.py +0 -0
- {cloudpss-4.5.3 → cloudpss-4.5.4}/test/testb.py +0 -0
@@ -17,7 +17,6 @@ class IESLabPlanModel(object):
|
|
17
17
|
'''
|
18
18
|
self.simulationId = simulationId
|
19
19
|
self.optimizationInfo = self.GetOptimizationInfo()
|
20
|
-
# self.OptimizationMode = OptimizationMode
|
21
20
|
|
22
21
|
def _fetchItemData(self, url, params):
|
23
22
|
'''
|
@@ -29,69 +28,31 @@ class IESLabPlanModel(object):
|
|
29
28
|
data = json.loads(r.text)
|
30
29
|
return data['results']
|
31
30
|
|
31
|
+
|
32
32
|
def GetOptimizationInfo(self):
|
33
33
|
'''
|
34
34
|
获取当前算例的优化目标设置信息
|
35
35
|
|
36
|
-
:return:
|
36
|
+
:return: enum 类型,代表经济性优化和环保性优化的类型
|
37
37
|
'''
|
38
38
|
try:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
"OptimizationMode": OptimizationMode['经济性'],
|
45
|
-
"StoSen": 0.1
|
46
|
-
}
|
47
|
-
else:
|
48
|
-
value = json.loads(r[0]['opt_params'])
|
49
|
-
return {
|
50
|
-
"OptimizationMode": OptimizationMode(value['OptimizationMode']),
|
51
|
-
"StoSen": value['StoSen']
|
52
|
-
}
|
39
|
+
data = self._fetchItemData(self._baseUri)
|
40
|
+
for e in OptimizationMode:
|
41
|
+
if (e.value == data['data']['optimizationpara']
|
42
|
+
['OptimizationMode']):
|
43
|
+
return e
|
53
44
|
except:
|
54
|
-
|
45
|
+
return OptimizationMode['经济性']
|
55
46
|
|
56
|
-
def SetOptimizationInfo(self,
|
47
|
+
def SetOptimizationInfo(self, optType):
|
57
48
|
'''
|
49
|
+
无对应接口
|
58
50
|
设置当前算例的优化目标
|
59
51
|
|
60
|
-
:param
|
61
|
-
|
62
|
-
:return: boolean 类型,为 True 则设置成功
|
52
|
+
:param optType: enum 类型,代表经济性优化和环保性优化的类型
|
63
53
|
'''
|
64
|
-
|
65
|
-
|
66
|
-
params = {"simu_id": self.simulationId}
|
67
|
-
r = self._fetchItemData(url, params)
|
68
|
-
opt_params = {
|
69
|
-
"OptimizationMode": data.get('OptimizationMode', '').value,
|
70
|
-
"StoSen": data.get('StoSen', ''),
|
71
|
-
"ProjectPeriod": "20"
|
72
|
-
}
|
73
|
-
if(len(r) == 0):
|
74
|
-
payload = {
|
75
|
-
"simu_id": self.simulationId,
|
76
|
-
"opt_params": json.dumps(opt_params)
|
77
|
-
}
|
78
|
-
r = request('POST',
|
79
|
-
url,
|
80
|
-
data=json.dumps(payload))
|
81
|
-
return True
|
82
|
-
else:
|
83
|
-
url2 = f'{self._baseUri}/simuOpt/{r[0]["id"]}/'
|
84
|
-
payload = {
|
85
|
-
"simu_id": self.simulationId,
|
86
|
-
"opt_params": json.dumps(opt_params),
|
87
|
-
"id": r[0]["id"]
|
88
|
-
}
|
89
|
-
r = request('PUT',
|
90
|
-
url2,
|
91
|
-
data=json.dumps(payload))
|
92
|
-
return True
|
93
|
-
except:
|
94
|
-
return False
|
54
|
+
self.optimizationInfo = optType
|
55
|
+
return True
|
95
56
|
|
96
57
|
def run(self) -> HttpRunner[IESLabPlanResult]:
|
97
58
|
'''
|
@@ -103,12 +64,9 @@ class IESLabPlanModel(object):
|
|
103
64
|
if isRunning:
|
104
65
|
raise Exception('该算例正在运行!请从浏览器算例页面点击结束运行或者调用IESPlan对象的kill接口终止计算后重试!')
|
105
66
|
else:
|
106
|
-
url = f'
|
107
|
-
|
108
|
-
|
109
|
-
"ProjectPeriod": "20",
|
110
|
-
"StoSen": self.optimizationInfo.get('StoSen', 0.1)
|
111
|
-
}
|
67
|
+
url = f'{self._runUri}/runOptimization'
|
68
|
+
optType = self.optimizationInfo if self.optimizationInfo is not None else OptimizationMode.经济性
|
69
|
+
optTypeValue = optType.value if isinstance(optType, OptimizationMode) else 0
|
112
70
|
try:
|
113
71
|
r = request('GET',
|
114
72
|
url,
|
@@ -116,7 +74,10 @@ class IESLabPlanModel(object):
|
|
116
74
|
"simuid":
|
117
75
|
self.simulationId,
|
118
76
|
"optPara":
|
119
|
-
json.dumps(
|
77
|
+
json.dumps({
|
78
|
+
"OptimizationMode": optTypeValue,
|
79
|
+
"ProjectPeriod": "20"
|
80
|
+
})
|
120
81
|
})
|
121
82
|
data = json.loads(r.text)
|
122
83
|
return HttpRunner({}, self.simulationId)
|
@@ -15,7 +15,7 @@ from .IESLabEvaluationResult import IESLabEvaluationResult, IESLabPlanEvaluation
|
|
15
15
|
from .IESLabTypicalDayResult import IESLabTypicalDayResult
|
16
16
|
from .storage import Storage
|
17
17
|
from ..utils import request
|
18
|
-
from typing import
|
18
|
+
from typing import TypeVar, Generic
|
19
19
|
import re
|
20
20
|
|
21
21
|
RECEIVER = {
|
@@ -35,6 +35,8 @@ IES_LAB_OPT_RESULT = {
|
|
35
35
|
'function/ieslab/evaluation': IESLabOptEvaluationResult,
|
36
36
|
}
|
37
37
|
|
38
|
+
|
39
|
+
|
38
40
|
RESULT_DB = {
|
39
41
|
'function/CloudPSS/emtp': EMTResult,
|
40
42
|
'function/CloudPSS/emtps': EMTResult,
|
@@ -60,7 +62,11 @@ class Runner(Generic[T]):
|
|
60
62
|
self.taskId = taskId
|
61
63
|
self.db = Storage(taskId, name, job, config, revision, modelRid)
|
62
64
|
rid =job['rid'].replace('job-definition/','function/').replace('/cloudpss/','/CloudPSS/')
|
63
|
-
|
65
|
+
resultClass = kwargs.get('RESULT_DB', None)
|
66
|
+
if resultClass is not None:
|
67
|
+
result = resultClass
|
68
|
+
else:
|
69
|
+
result = RESULT_DB.get(rid, Result)
|
64
70
|
self.result: T = result(self.db)
|
65
71
|
self.receiver = kwargs.get('receiver', None)
|
66
72
|
|
@@ -85,18 +91,25 @@ class Runner(Generic[T]):
|
|
85
91
|
return self.receiver.status()
|
86
92
|
|
87
93
|
def __listen(self, **kwargs):
|
88
|
-
|
89
94
|
receiver = kwargs.get('RECEIVER', 'default')
|
90
|
-
receiverclass = None
|
91
95
|
if type(receiver) is str:
|
92
96
|
if receiver not in RECEIVER:
|
93
|
-
|
97
|
+
receiver = RECEIVER['default']
|
94
98
|
else:
|
95
|
-
|
96
|
-
if
|
99
|
+
receiver = RECEIVER[receiver]
|
100
|
+
if receiver is None:
|
97
101
|
raise Exception('not find receiver')
|
98
|
-
self.receiver =
|
102
|
+
self.receiver = receiver(self.taskId, self.db, **kwargs)
|
99
103
|
self.receiver.connect()
|
104
|
+
def statusCode(self):
|
105
|
+
query="mutation($_a:JobInput!){job(input:$_a){status}}"
|
106
|
+
variables= {
|
107
|
+
"_a": {
|
108
|
+
"id": self.jobId,
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
return graphql_request(query,variables=variables)
|
100
113
|
|
101
114
|
def terminate(self):
|
102
115
|
"""
|
@@ -143,19 +156,21 @@ class Runner(Generic[T]):
|
|
143
156
|
tres[k] = float(v) # type: ignore
|
144
157
|
policy["tres"] = tres
|
145
158
|
function = job["rid"].replace("job-definition/cloudpss/", "function/CloudPSS/")
|
146
|
-
implement = kwargs.get("implement", None)
|
159
|
+
implement = kwargs.get("implement", kwargs.get("topology", None))
|
147
160
|
debug = job["args"].get("@debug", None )
|
148
161
|
debugargs={}
|
149
162
|
if debug is not None:
|
150
163
|
t= [ i.split('=') for i in re.split(r'\s+',debug) if i.find('=')>0]
|
151
164
|
for i in t:
|
152
165
|
debugargs[i[0]]=i[1]
|
153
|
-
|
166
|
+
|
154
167
|
context= [
|
155
168
|
function,
|
156
|
-
|
169
|
+
|
157
170
|
f"model/@sdk/{str(int(time.time() * random.random()))}",
|
158
171
|
]
|
172
|
+
if rid != '':
|
173
|
+
context.append(rid)
|
159
174
|
|
160
175
|
PARENT_JOB_ID =kwargs.get("PARENT_JOB_ID",None)
|
161
176
|
if PARENT_JOB_ID is not None:
|
@@ -240,7 +255,7 @@ class HttpRunner(Runner[T]):
|
|
240
255
|
if self.__taskId is None:
|
241
256
|
return False
|
242
257
|
return self.result.status() # type: ignore
|
243
|
-
|
258
|
+
|
244
259
|
|
245
260
|
class HttpOPTRunner(Runner[T]):
|
246
261
|
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '4.5.4'
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '4.5.3'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|