SolUtil 0.1.0__tar.gz → 0.1.1__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.
- {solutil-0.1.0 → solutil-0.1.1}/PKG-INFO +2 -2
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/_version.py +3 -3
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/dhs_fault_flow.py +1 -61
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/dhs_flow.py +2 -7
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/gas_flow.py +1 -28
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/hydraulic_mdl.py +1 -46
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/power_flow.py +13 -27
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_power_flow.py +14 -8
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil.egg-info/PKG-INFO +2 -2
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil.egg-info/requires.txt +1 -1
- solutil-0.1.1/SolUtil.egg-info/scm_version.json +8 -0
- {solutil-0.1.0 → solutil-0.1.1}/pyproject.toml +1 -1
- solutil-0.1.0/SolUtil.egg-info/scm_version.json +0 -8
- {solutil-0.1.0 → solutil-0.1.1}/.github/workflows/ci-cd.yml +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/.gitignore +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/.readthedocs.yaml +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/LICENSE +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/README.md +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/alternate_solver/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/alternate_solver/solver.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow/case_heat_test.xlsx +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow/case_heat_test0.xlsx +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow/case_heat_test1.xlsx +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_flow/BarryIsland.xlsx +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_flow.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_gas_flow/belgium.xlsx +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_gas_flow.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_load_matpower/case9.m +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_load_matpower.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_power_flow/case9.xlsx +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/error_cal.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/profile.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/sysparser/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/sysparser/_array_utils.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/sysparser/dhs_function.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/sysparser/eps_function.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/sysparser/ngs_function.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil/tf2ss.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil.egg-info/SOURCES.txt +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil.egg-info/dependency_links.txt +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil.egg-info/scm_file_list.json +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/SolUtil.egg-info/top_level.txt +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/Makefile +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/make.bat +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/requirements.txt +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/source/__init__.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/source/conf.py +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/docs/source/index.rst +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/requirements.txt +0 -0
- {solutil-0.1.0 → solutil-0.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SolUtil
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: The util lib for Solverz
|
|
5
5
|
Author-email: Ruizhi Yu <rz.yu@foxmail.com>
|
|
6
6
|
Project-URL: Repository, https://github.com/rzyu45/SolUtil
|
|
@@ -19,7 +19,7 @@ Requires-Dist: numpy
|
|
|
19
19
|
Requires-Dist: openpyxl
|
|
20
20
|
Requires-Dist: pandas
|
|
21
21
|
Requires-Dist: scipy
|
|
22
|
-
Requires-Dist: Solverz>=0.
|
|
22
|
+
Requires-Dist: Solverz>=0.12.0
|
|
23
23
|
Requires-Dist: tqdm
|
|
24
24
|
Requires-Dist: pyomo
|
|
25
25
|
Dynamic: license-file
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.1.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
21
|
+
__version__ = version = '0.1.1'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 1)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gd6e00832f'
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
from .dhs_flow import DhsFlow
|
|
2
2
|
from .hydraulic_mdl import HydraFlow
|
|
3
|
-
from Solverz
|
|
4
|
-
from Solverz import Var as SolVar, Param as SolParam, Model, heaviside, Abs, Eqn, exp, made_numerical, nr_method, Sign, \
|
|
5
|
-
Opt
|
|
6
|
-
import networkx as nx
|
|
3
|
+
from Solverz import Var as SolVar, Param as SolParam, Model, heaviside, Abs, Eqn, exp, made_numerical, nr_method, Sign
|
|
7
4
|
import numpy as np
|
|
8
5
|
import copy
|
|
9
6
|
|
|
@@ -660,60 +657,3 @@ class DhsFaultFlow:
|
|
|
660
657
|
return np.max(np.abs(dF))
|
|
661
658
|
else:
|
|
662
659
|
return 1
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
def remove_edge_by_idx(G, target_idx):
|
|
666
|
-
"""
|
|
667
|
-
从图 G 中移除具有给定 idx 属性值的边。
|
|
668
|
-
|
|
669
|
-
:param G: networkx.Graph 或其子类的实例
|
|
670
|
-
:param target_idx: 要移除的边的 idx 属性值
|
|
671
|
-
"""
|
|
672
|
-
edge_to_remove = None
|
|
673
|
-
for u, v, data in G.edges(data=True):
|
|
674
|
-
if data.get('idx') == target_idx:
|
|
675
|
-
edge_to_remove = (u, v)
|
|
676
|
-
break
|
|
677
|
-
|
|
678
|
-
if edge_to_remove is not None:
|
|
679
|
-
G.remove_edge(*edge_to_remove)
|
|
680
|
-
print(f"Edge with idx={target_idx} removed.")
|
|
681
|
-
else:
|
|
682
|
-
print(f"No edge found with idx={target_idx}.")
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
def cal_H(slack_nodes,
|
|
686
|
-
Hset,
|
|
687
|
-
G: nx.DiGraph):
|
|
688
|
-
"""
|
|
689
|
-
calculate H using depth-first search, for graph without self-loop and multiple edges
|
|
690
|
-
"""
|
|
691
|
-
H = dict()
|
|
692
|
-
slack_nodes = slack_nodes.tolist()
|
|
693
|
-
H[slack_nodes[0]] = Hset[slack_nodes.index(0)]
|
|
694
|
-
|
|
695
|
-
def dfs(i):
|
|
696
|
-
for neighbor in list(G.successors(i)) + list(G.predecessors(i)):
|
|
697
|
-
if neighbor not in H:
|
|
698
|
-
if neighbor in G.successors(i):
|
|
699
|
-
f = i
|
|
700
|
-
t = neighbor
|
|
701
|
-
fij = G[f][t]['f']
|
|
702
|
-
cij = G[f][t]['c']
|
|
703
|
-
H[t] = H[f] - cij * fij ** 2 * np.sign(fij)
|
|
704
|
-
elif neighbor in G.predecessors(i):
|
|
705
|
-
f = neighbor
|
|
706
|
-
t = i
|
|
707
|
-
fij = G[f][t]['f']
|
|
708
|
-
cij = G[f][t]['c']
|
|
709
|
-
H[f] = H[t] + cij * fij ** 2 * np.sign(fij)
|
|
710
|
-
else:
|
|
711
|
-
raise ValueError(f'{neighbor} neither successor nor predecessor!')
|
|
712
|
-
dfs(neighbor)
|
|
713
|
-
|
|
714
|
-
dfs(slack_nodes[0])
|
|
715
|
-
|
|
716
|
-
sorted_H = sorted(H.items(), key=lambda item: item[0])
|
|
717
|
-
H = [np.array(item[1]).reshape(-1) for item in sorted_H]
|
|
718
|
-
|
|
719
|
-
return np.asarray(H).reshape(-1)
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from pyomo.environ import (Reals, Var, AbstractModel, Set, Param, Constraint, minimize,
|
|
4
|
-
SolverFactory, Objective, PositiveReals)
|
|
5
1
|
from Solverz import Var as SolVar, Param as SolParam, Eqn, Model, made_numerical, nr_method, module_printer, Sign, \
|
|
6
2
|
heaviside, exp, Abs
|
|
7
3
|
from SolUtil.sysparser import load_hs
|
|
8
4
|
import numpy as np
|
|
9
|
-
import pandas as pd
|
|
10
5
|
from .hydraulic_mdl import HydraFlow
|
|
11
6
|
|
|
12
7
|
__all__ = ["DhsFlow", "generate_dhs_module", "generate_temp_module"]
|
|
@@ -367,13 +362,13 @@ def mdl_dhs(hc):
|
|
|
367
362
|
|
|
368
363
|
def inline_dhs_mdl(hc):
|
|
369
364
|
heat, y0 = mdl_dhs(hc)
|
|
370
|
-
nheat = made_numerical(heat, y0, sparse=True)
|
|
365
|
+
nheat = made_numerical(heat, y0, sparse=True, backend='inline')
|
|
371
366
|
return nheat, y0
|
|
372
367
|
|
|
373
368
|
|
|
374
369
|
def inline_temp_mdl(hc):
|
|
375
370
|
temp, y0 = mdl_temp(hc)
|
|
376
|
-
ntemp = made_numerical(temp, y0, sparse=True)
|
|
371
|
+
ntemp = made_numerical(temp, y0, sparse=True, backend='inline')
|
|
377
372
|
return ntemp, y0
|
|
378
373
|
|
|
379
374
|
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Solve gas flow equations using optimization
|
|
3
3
|
"""
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
from pyomo.environ import (Reals, Var, AbstractModel, Set, Param, Constraint, minimize,
|
|
7
|
-
SolverFactory, Objective, PositiveReals)
|
|
8
|
-
from Solverz import Var as SolVar, Param as SolParam, Eqn, Model, made_numerical, nr_method, module_printer, Sign
|
|
4
|
+
from Solverz import Var as SolVar, Param as SolParam, Eqn, Model, module_printer, Sign
|
|
9
5
|
import numpy as np
|
|
10
|
-
import pandas as pd
|
|
11
6
|
from ..sysparser import load_ngs
|
|
12
7
|
from .hydraulic_mdl import HydraFlow
|
|
13
8
|
|
|
@@ -77,28 +72,6 @@ class GasFlow:
|
|
|
77
72
|
else:
|
|
78
73
|
self.Pi = np.sqrt(self.gas_mdl.H)
|
|
79
74
|
|
|
80
|
-
def output_results(self, file):
|
|
81
|
-
fnd = []
|
|
82
|
-
tnd = []
|
|
83
|
-
for i, j in self.cgmdl.Arcs:
|
|
84
|
-
self.f.append(self.cgmdl.f[i, j].value)
|
|
85
|
-
fnd.append(i)
|
|
86
|
-
tnd.append(j)
|
|
87
|
-
|
|
88
|
-
pipe = {'idx': np.arange(len(self.f)),
|
|
89
|
-
'fnd': fnd,
|
|
90
|
-
'tnd': tnd,
|
|
91
|
-
'f': self.f}
|
|
92
|
-
node = {'idx': np.arange(len(self.Pi)),
|
|
93
|
-
'Pi': self.Pi}
|
|
94
|
-
pipe_df = pd.DataFrame(pipe)
|
|
95
|
-
node_df = pd.DataFrame(node)
|
|
96
|
-
|
|
97
|
-
with pd.ExcelWriter(file, engine='openpyxl') as writer:
|
|
98
|
-
# Write each DataFrame to a different sheet
|
|
99
|
-
pipe_df.to_excel(writer, sheet_name='pipe', index=False)
|
|
100
|
-
node_df.to_excel(writer, sheet_name='node', index=False)
|
|
101
|
-
|
|
102
75
|
|
|
103
76
|
def mdl_ngs(gc, module_name, jit=True):
|
|
104
77
|
"""
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
|
|
3
3
|
from pyomo.environ import (Reals, Var, AbstractModel, Set, Param, Constraint, minimize,
|
|
4
|
-
SolverFactory, Objective
|
|
4
|
+
SolverFactory, Objective)
|
|
5
5
|
import numpy as np
|
|
6
|
-
from Solverz import Var as SolVar, Param as SolParam, Eqn, Model, made_numerical, nr_method, module_printer, Sign
|
|
7
6
|
from Solverz.num_api.Array import Array
|
|
8
7
|
from networkx import DiGraph, incidence_matrix
|
|
9
8
|
|
|
@@ -117,7 +116,6 @@ class HydraFlow:
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
self.cmdl = self.mdl.create_instance(data_dict)
|
|
120
|
-
# self.Hmdl, self.y0 = self.derive_H_mdl()
|
|
121
119
|
|
|
122
120
|
def update_fs(self, fs1):
|
|
123
121
|
for i in range(len(fs1)):
|
|
@@ -147,53 +145,10 @@ class HydraFlow:
|
|
|
147
145
|
self.fs[i] = self.cmdl.fs_slack[i].value
|
|
148
146
|
|
|
149
147
|
if len(self.slack_nodes) > 0:
|
|
150
|
-
# self.Hmdl.p['f'] = self.f
|
|
151
|
-
# sol = nr_method(self.Hmdl, self.y0)
|
|
152
|
-
# self.H = sol.y['H']
|
|
153
148
|
self.cal_H()
|
|
154
149
|
else:
|
|
155
150
|
warnings.warn("No slack nodes! Cannot calculate H distribution!")
|
|
156
151
|
|
|
157
|
-
def derive_H_mdl(self):
|
|
158
|
-
"""
|
|
159
|
-
The linear algebraic equations about node pressure, with pipe flow given as parameters.
|
|
160
|
-
"""
|
|
161
|
-
m = Model()
|
|
162
|
-
m.f = SolParam('f', self.f)
|
|
163
|
-
m.H = SolVar('H', np.zeros(self.n_node))
|
|
164
|
-
m.c = SolParam('c', self.c)
|
|
165
|
-
m.Hset = SolParam('Hset', self.Hset)
|
|
166
|
-
|
|
167
|
-
for edge in range(self.n_pipe):
|
|
168
|
-
fnode = self.pipe_from[edge]
|
|
169
|
-
tnode = self.pipe_to[edge]
|
|
170
|
-
idx = edge
|
|
171
|
-
include_pipe = True
|
|
172
|
-
|
|
173
|
-
if len(self.pinloop) > 0:
|
|
174
|
-
# if there exists loop, omit the last pipe in the loop
|
|
175
|
-
if np.isclose(idx, np.where(self.pinloop != 0)[0][-1]):
|
|
176
|
-
include_pipe = False
|
|
177
|
-
|
|
178
|
-
if include_pipe:
|
|
179
|
-
Hi = m.H[fnode]
|
|
180
|
-
Hj = m.H[tnode]
|
|
181
|
-
fij = m.f[idx]
|
|
182
|
-
rhs = m.c[idx] * fij ** 2 * Sign(fij) - (Hi - Hj)
|
|
183
|
-
m.__dict__[f'H_f_{fnode}_{tnode}'] = Eqn(f"H_f_{fnode}_{tnode}", rhs)
|
|
184
|
-
|
|
185
|
-
# node pressure equations
|
|
186
|
-
# for multi-slack cases, preserve only the first one, so that the equations would not be overdetermined
|
|
187
|
-
for node in self.slack_nodes[0:1]:
|
|
188
|
-
idx_slack = self.slack_nodes.tolist().index(node)
|
|
189
|
-
m.__dict__[f'H_{node}'] = Eqn(f'H_{node}',
|
|
190
|
-
m.H[node] - m.Hset[idx_slack])
|
|
191
|
-
|
|
192
|
-
sae, y0 = m.create_instance()
|
|
193
|
-
ae = made_numerical(sae, y0, sparse=True)
|
|
194
|
-
|
|
195
|
-
return ae, y0
|
|
196
|
-
|
|
197
152
|
def cal_H(self):
|
|
198
153
|
"""
|
|
199
154
|
calculate H using depth-first search, for graph without self-loop and multiple edges
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import tempfile
|
|
3
|
-
import sys
|
|
4
|
-
import uuid
|
|
5
1
|
import warnings
|
|
6
2
|
|
|
7
3
|
from Solverz import (Var as SolVar, Param as SolParam, Eqn, Model,
|
|
@@ -12,7 +8,6 @@ from SolUtil.sysparser import load_mpc
|
|
|
12
8
|
from SolUtil.sysparser.eps_function import bus_injections
|
|
13
9
|
from scipy.sparse import csc_array
|
|
14
10
|
import numpy as np
|
|
15
|
-
import pandas as pd
|
|
16
11
|
|
|
17
12
|
__all__ = ["PowerFlow"]
|
|
18
13
|
|
|
@@ -44,9 +39,9 @@ class PowerFlow:
|
|
|
44
39
|
rather than the number of buses. This is the default since 0.9.0.
|
|
45
40
|
|
|
46
41
|
``LoopEqn`` is only supported by the Numba-JIT module path
|
|
47
|
-
(``
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
(``made_numerical(..., backend='module')``), not by the inline path.
|
|
43
|
+
Solverz caches the compiled module on disk by structure, so the Numba
|
|
44
|
+
compile cost is paid once per structure.
|
|
50
45
|
|
|
51
46
|
``loopeqn=False`` selects the legacy per-bus scalar inline build.
|
|
52
47
|
**It is deprecated and will be removed in a future release**; it
|
|
@@ -310,29 +305,20 @@ def generate_pf_module(pf: PowerFlow, module_name, jit=True, directory=None):
|
|
|
310
305
|
|
|
311
306
|
def inline_pf_mdl(pf: PowerFlow):
|
|
312
307
|
spf, y0 = pf.mdlpf_scalar()
|
|
313
|
-
npf = made_numerical(spf, y0, sparse=True)
|
|
308
|
+
npf = made_numerical(spf, y0, sparse=True, backend='inline')
|
|
314
309
|
return npf, y0
|
|
315
310
|
|
|
316
311
|
|
|
317
312
|
def loopeqn_pf_mdl(pf: PowerFlow):
|
|
318
|
-
"""Build
|
|
313
|
+
"""Build a LoopEqn power-flow model via Solverz's cached module backend.
|
|
319
314
|
|
|
320
|
-
``LoopEqn`` is only supported by the module
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
315
|
+
``LoopEqn`` is only supported by the module backend, so this delegates to
|
|
316
|
+
``made_numerical(..., backend='module', jit=True)``. Solverz caches the
|
|
317
|
+
compiled module by model structure without creating temporary directories
|
|
318
|
+
or modifying ``sys.path``, while returning a fresh ``nAE`` with its own
|
|
319
|
+
parameter dict and ``y0`` per call.
|
|
324
320
|
"""
|
|
325
321
|
spf, y0 = pf.mdlpf_loopeqn()
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
# package was found in sys.modules and reloaded, but reload() only
|
|
330
|
-
# re-executes __init__.py, and the cached num_func / dependency
|
|
331
|
-
# submodules kept the first case's F, J, p and y.
|
|
332
|
-
module_name = f'pf_loopeqn_mdl_{uuid.uuid4().hex[:8]}'
|
|
333
|
-
module_printer(spf, y0, module_name, directory=tmpdir, jit=True).render()
|
|
334
|
-
if tmpdir not in sys.path:
|
|
335
|
-
sys.path.insert(0, tmpdir)
|
|
336
|
-
import importlib
|
|
337
|
-
mod = importlib.import_module(module_name)
|
|
338
|
-
return mod.mdl, mod.y
|
|
322
|
+
npf = made_numerical(spf, y0, sparse=True, backend='module', jit=True,
|
|
323
|
+
name='pf_loopeqn')
|
|
324
|
+
return npf, y0
|
|
@@ -16,6 +16,8 @@ shared with the cookbook IES chapter (a MATPOWER-format xlsx with
|
|
|
16
16
|
``bus`` / ``branch`` / ``gen`` / ``setting`` sheets parsed by
|
|
17
17
|
``load_mpc``).
|
|
18
18
|
"""
|
|
19
|
+
import sys
|
|
20
|
+
|
|
19
21
|
import numpy as np
|
|
20
22
|
import pytest
|
|
21
23
|
|
|
@@ -83,16 +85,20 @@ def test_pf_scalar_path_is_deprecated(case_file):
|
|
|
83
85
|
PowerFlow(case_file, loopeqn=False)
|
|
84
86
|
|
|
85
87
|
|
|
86
|
-
def test_pf_two_instances_are_independent(case_file
|
|
87
|
-
"""Two PowerFlow objects in one process
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
fixed name the second instance got the first instance's F / J / y.
|
|
91
|
-
"""
|
|
88
|
+
def test_pf_two_instances_are_independent(case_file):
|
|
89
|
+
"""Two PowerFlow objects in one process have independent models, params,
|
|
90
|
+
and initial states, and do not pollute ``sys.path``."""
|
|
91
|
+
path_before = list(sys.path)
|
|
92
92
|
pf_a = PowerFlow(case_file)
|
|
93
93
|
pf_b = PowerFlow(case_file)
|
|
94
|
+
assert sys.path == path_before
|
|
94
95
|
assert pf_a.pfmdl is not pf_b.pfmdl
|
|
95
|
-
assert pf_a.pfmdl.
|
|
96
|
+
assert pf_a.pfmdl.p is not pf_b.pfmdl.p
|
|
97
|
+
assert pf_a.y0 is not pf_b.y0
|
|
98
|
+
|
|
99
|
+
pf_a.Pg = pf_a.Pg * 1.1
|
|
100
|
+
pf_a.run()
|
|
96
101
|
pf_b.run()
|
|
97
|
-
assert pf_b.run_succeed
|
|
102
|
+
assert pf_a.run_succeed and pf_b.run_succeed
|
|
98
103
|
assert pf_b.Vm.shape == (pf_b.nb,)
|
|
104
|
+
assert not np.allclose(pf_a.Pg, pf_b.Pg)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SolUtil
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: The util lib for Solverz
|
|
5
5
|
Author-email: Ruizhi Yu <rz.yu@foxmail.com>
|
|
6
6
|
Project-URL: Repository, https://github.com/rzyu45/SolUtil
|
|
@@ -19,7 +19,7 @@ Requires-Dist: numpy
|
|
|
19
19
|
Requires-Dist: openpyxl
|
|
20
20
|
Requires-Dist: pandas
|
|
21
21
|
Requires-Dist: scipy
|
|
22
|
-
Requires-Dist: Solverz>=0.
|
|
22
|
+
Requires-Dist: Solverz>=0.12.0
|
|
23
23
|
Requires-Dist: tqdm
|
|
24
24
|
Requires-Dist: pyomo
|
|
25
25
|
Dynamic: license-file
|
|
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
|
{solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow/case_heat_test.xlsx
RENAMED
|
File without changes
|
{solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow/case_heat_test0.xlsx
RENAMED
|
File without changes
|
{solutil-0.1.0 → solutil-0.1.1}/SolUtil/energyflow/test/test_dhs_fault_flow/case_heat_test1.xlsx
RENAMED
|
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
|