fpowerkit 0.2.1__tar.gz → 0.2.3__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.
Files changed (29) hide show
  1. fpowerkit-0.2.3/PKG-INFO +50 -0
  2. fpowerkit-0.2.3/README.md +46 -0
  3. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/cases.py +1 -1
  4. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/ess.py +1 -1
  5. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/grid.py +4 -3
  6. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/line.py +4 -0
  7. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/solbase.py +11 -0
  8. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/soldist.py +16 -13
  9. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/soldss.py +16 -13
  10. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/solgcal.py +5 -10
  11. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/solnt.py +7 -13
  12. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/utils.py +1 -2
  13. fpowerkit-0.2.3/fpowerkit.egg-info/PKG-INFO +50 -0
  14. fpowerkit-0.2.3/fpowerkit.egg-info/requires.txt +2 -0
  15. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/setup.py +2 -2
  16. fpowerkit-0.2.1/PKG-INFO +0 -38
  17. fpowerkit-0.2.1/README.md +0 -44
  18. fpowerkit-0.2.1/fpowerkit.egg-info/PKG-INFO +0 -38
  19. fpowerkit-0.2.1/fpowerkit.egg-info/requires.txt +0 -4
  20. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/LICENSE +0 -0
  21. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/__init__.py +0 -0
  22. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/bus.py +0 -0
  23. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/gen.py +0 -0
  24. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/pvwind.py +0 -0
  25. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit/solcmb.py +0 -0
  26. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit.egg-info/SOURCES.txt +0 -0
  27. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit.egg-info/dependency_links.txt +0 -0
  28. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/fpowerkit.egg-info/top_level.txt +0 -0
  29. {fpowerkit-0.2.1 → fpowerkit-0.2.3}/setup.cfg +0 -0
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.2
2
+ Name: fpowerkit
3
+ Version: 0.2.3
4
+ Summary: A Distflow PDN solver based on Gurobi.
5
+ Author: fmy_xfk
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: feasytools>=0.0.21
13
+ Requires-Dist: numpy>=1.19.0
14
+ Dynamic: author
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: requires-dist
19
+ Dynamic: requires-python
20
+ Dynamic: summary
21
+
22
+ # FPowerKit - A power distribution network calculation component
23
+
24
+ This is a package designed for power distribution network solving.
25
+
26
+ This package is affiliated to V2Sim, an open-aource microscopic V2G simulation platform in urban power and transportation network. If you are using the modified DistFlow model in this package, please cite the [paper](https://ieeexplore.ieee.org/document/10970754):
27
+
28
+ ```
29
+ @ARTICLE{10970754,
30
+ author={Qian, Tao and Fang, Mingyu and Hu, Qinran and Shao, Chengcheng and Zheng, Junyi},
31
+ journal={IEEE Transactions on Smart Grid},
32
+ title={V2Sim: An Open-Source Microscopic V2G Simulation Platform in Urban Power and Transportation Network},
33
+ year={2025},
34
+ pages={1-1},
35
+ keywords={Vehicle-to-grid;Partial discharges;Microscopy;Batteries;Planning;Discharges (electric);Optimization;Vehicle dynamics;Transportation;Roads;EV charging load simulation;microscopic EV behavior;Vehicle-to-grid;charging station fault sensing},
36
+ doi={10.1109/TSG.2025.3560976}}
37
+
38
+ ```
39
+
40
+ There are 3 modes for this package to work:
41
+
42
+ - Optimal power flow (OPF): Use cvxpy to solve the optimal power flow and determine the output of the generators.
43
+
44
+ - Power flow calculation: Use OpenDSS/GridCal/Inner Newton-Raphson method to solve the power flow.
45
+
46
+ - Hybrid: Use OPF to determine the initial value, and then use OpenDSS/GridCal/Inner Newton-Raphson to perform accurate calculation.
47
+
48
+ Since this package is still under development, the API is unstable and may be changed anytime.
49
+
50
+ Please visit https://gitee.com/fmy_xfk/fpowerkit to read the detailed introduction and the usage.
@@ -0,0 +1,46 @@
1
+ # FPowerKit 配电网运算组件
2
+ **本仓库已上线PyPI**,您可以通过`pip install fpowerkit`直接以Python包的形式安装使用本仓库的代码!
3
+
4
+ ## 简介
5
+ - FPowerKit是一个配电网求解组件,它包含电网的描述(含母线、发电机、线路、光伏、风机和储能等)和多种内置和外部求解方案:
6
+ + (内置) 改进DistFlow配电网最优潮流
7
+ + (内置) Newton-Raphson潮流计算
8
+ + (外接) OpenDSS配电网潮流计算
9
+ + (外接) GridCal潮流计算(仅限较高版本的Python)
10
+ + 最优潮流+潮流计算核验的混合方案
11
+ - 对于最优潮流模型,优化目标为“发电成本最小”。发电成本模型为二次函数$f(x)=ax^2+bx+c$或者一次函数$f(x)=bx+c$。
12
+ - 依赖于feasytools和numpy: `pip install feasytools numpy`
13
+ - 内含IEEE 33节点配电网和IEEE 69节点配电网,可通过以下方式快速创建:
14
+ ```py
15
+ from fpowerkit import PDNCases
16
+ grid_obj33 = PDNCases.IEEE33()
17
+ grid_obj69 = PDNCases.IEEE69()
18
+ ```
19
+
20
+ ## 重要信息目录
21
+ + [FPowerKit文件格式](docs/xml_file.md)
22
+ + [在命令行中使用](docs/cmd.md)
23
+ + [从代码创建和求解电网](docs/develop.md)
24
+
25
+ ## 引用说明
26
+ 这个项目是[V2Sim](https://gitee.com/fmy_xfk/v2sim)的附属项目。V2Sim的论文请见如下链接
27
+
28
+ - 正式版:https://ieeexplore.ieee.org/document/10970754
29
+
30
+ - 早期版本:https://arxiv.org/abs/2412.09808
31
+
32
+ 如果你正在使用本项目中的**改进配电网DistFlow模型**,请引用[V2Sim正式版论文](https://ieeexplore.ieee.org/document/10970754):
33
+
34
+ ```
35
+ @ARTICLE{10970754,
36
+ author={Qian, Tao and Fang, Mingyu and Hu, Qinran and Shao, Chengcheng and Zheng, Junyi},
37
+ journal={IEEE Transactions on Smart Grid},
38
+ title={V2Sim: An Open-Source Microscopic V2G Simulation Platform in Urban Power and Transportation Network},
39
+ year={2025},
40
+ pages={1-1},
41
+ keywords={Vehicle-to-grid;Partial discharges;Microscopy;Batteries;Planning;Discharges (electric);Optimization;Vehicle dynamics;Transportation;Roads;EV charging load simulation;microscopic EV behavior;Vehicle-to-grid;charging station fault sensing},
42
+ doi={10.1109/TSG.2025.3560976}}
43
+
44
+ ```
45
+
46
+ IEEE33和IEEE69节点的配网数据从公开渠道收集。除配网数据以外,本仓库代码均遵循LGPL3.0协议使用。
@@ -1,5 +1,5 @@
1
1
  from feasytools import SegFunc, ConstFunc
2
- from .grid import GeneratorModel, Grid, Bus, Line, Generator
2
+ from .grid import GeneratorModel, Grid, Bus, Line
3
3
 
4
4
  # IEEE33 kVA
5
5
  _IEEE33_LOAD = [
@@ -76,7 +76,7 @@ class ESS:
76
76
  '''Calculate reactive power'''
77
77
  return P * math.sqrt(1 - self._pf**2)
78
78
 
79
- def GetLoad(self, t: int, cprice:float, dprice:float) -> tuple[float, float]:
79
+ def GetLoad(self, t: int, cprice:float, dprice:float) -> 'tuple[float, float]':
80
80
  '''
81
81
  Get the power of the ESS. Return p+jq.
82
82
  p > 0 means the ESS is charging, and thus the ESS is treated as a load.
@@ -2,8 +2,7 @@ from enum import IntEnum
2
2
  import gzip
3
3
  from xml.etree.ElementTree import ElementTree
4
4
  import zipfile
5
- from io import BytesIO, TextIOWrapper
6
- from typing import Any, Iterable
5
+ from typing import Iterable
7
6
 
8
7
  import numpy as np
9
8
  from .bus import *
@@ -52,7 +51,7 @@ class Grid:
52
51
  return self.Sb / (self.Ub * (3 ** 0.5))
53
52
 
54
53
  def __init__(self, Sb_MVA: float, Ub_kV: float, buses: 'Iterable[Bus]', lines: 'Iterable[Line]',
55
- gens: 'Iterable[Generator]', pvws: 'Iterable[PVWind]', esss: 'Iterable[ESS]',
54
+ gens: 'Iterable[Generator]', pvws: 'Optional[Iterable[PVWind]]' = None, esss: 'Optional[Iterable[ESS]]' = None,
56
55
  cprice: FloatLike = 0, dprice: FloatLike = 0, holdShadowPrice: bool = False):
57
56
  '''
58
57
  Initialize
@@ -73,7 +72,9 @@ class Grid:
73
72
  self._buses = {bus.ID: bus for bus in self._busl}
74
73
  self._lines = {line.ID: line for line in lines}
75
74
  self._gens = {gen.ID: gen for gen in gens}
75
+ if pvws is None: pvws = []
76
76
  self._pvws = {pvw.ID: pvw for pvw in pvws}
77
+ if esss is None: esss = []
77
78
  self._esss = {ess.ID: ess for ess in esss}
78
79
  self._cp = Float2Func(cprice)
79
80
  self._dp = Float2Func(dprice)
@@ -81,8 +81,12 @@ class Line:
81
81
  t = node.attrib["To"]
82
82
  r, ru = ReadVal(node.attrib["R"])
83
83
  if ru.lower() == "ohm": r = float(r) / Zb_Ohm
84
+ elif ru.lower() in ["pu",""]: r = float(r)
85
+ else: raise ValueError(f"Unknown unit '{ru}' for R, only 'ohm','pu', and non-unit (treated as pu) are supported")
84
86
  x, xu = ReadVal(node.attrib["X"])
85
87
  if xu.lower() == "ohm": x = float(x) / Zb_Ohm
88
+ elif xu.lower() in ["pu",""]: x = float(x)
89
+ else: raise ValueError(f"Unknown unit '{xu}' for X, only 'ohm','pu', and non-unit (treated as pu) are supported")
86
90
  max_I = float(node.attrib.get("MaxIkA", math.inf))
87
91
  l = float(node.attrib.get("Length_km", -1))
88
92
  return Line(id, f, t, r, x, max_I_kA=max_I, length_km=l)
@@ -25,6 +25,17 @@ class SolverBase(ABC):
25
25
  self.saveto = path
26
26
  Path(path).mkdir(parents=True, exist_ok = True)
27
27
 
28
+ def _calc_line_params(self):
29
+ for l in self.grid.Lines:
30
+ vi = self.grid.Bus(l.fBus).V_cpx
31
+ vj = self.grid.Bus(l.tBus).V_cpx
32
+ assert vi is not None and vj is not None
33
+ i = (vi-vj)/l.Z
34
+ l.I = abs(i)
35
+ s = vi*i.conjugate()
36
+ l.P = s.real
37
+ l.Q = s.imag
38
+
28
39
  @abstractmethod
29
40
  def solve(self, grid:Grid, _t:int, /, **kwargs):
30
41
  raise NotImplementedError
@@ -16,13 +16,13 @@ class LoadReduceModule:
16
16
  Reduction: FloatVar = None
17
17
 
18
18
  class _Island:
19
- def __init__(self, g: Grid, buses: Iterable[BusID], cutlines: set[LineID]):
19
+ def __init__(self, g: Grid, buses: Iterable[BusID], cutlines: 'set[LineID]'):
20
20
  self.grid = g
21
- self.Buses: set[str] = set()
22
- self.Gens: set[str] = set()
23
- self.Lines: set[str] = set()
24
- self.PVWs: set[str] = set()
25
- self.ESSs: set[str] = set()
21
+ self.Buses: 'set[str]' = set()
22
+ self.Gens: 'set[str]' = set()
23
+ self.Lines: 'set[str]' = set()
24
+ self.PVWs: 'set[str]' = set()
25
+ self.ESSs: 'set[str]' = set()
26
26
  for b in buses:
27
27
  self.Buses.add(b)
28
28
  self.Gens.update(gen.ID for gen in g._gatb[b])
@@ -103,13 +103,13 @@ class DistFlowSolver(SolverBase):
103
103
 
104
104
  def __detect_islands(self, cutofl: bool):
105
105
  '''Detect islands'''
106
- q: deque[BusID] = deque()
107
- visited: set[BusID] = set()
108
- islands: list[set[BusID]] = []
106
+ q: 'deque[BusID]' = deque()
107
+ visited: 'set[BusID]' = set()
108
+ islands: 'list[set[BusID]]' = []
109
109
  for bus in self.grid.BusNames:
110
110
  if bus in visited: continue
111
111
  q.append(bus)
112
- island: set[BusID] = set()
112
+ island: 'set[BusID]' = set()
113
113
  while len(q) > 0:
114
114
  b = q.popleft()
115
115
  if b in visited: continue
@@ -212,9 +212,12 @@ class DistFlowSolver(SolverBase):
212
212
  P[i,j]: Line active power
213
213
  Q[i,j]: Line reactive power
214
214
  '''
215
- import cvxpy as cp
216
- from cvxpy import Variable as Var
217
- cons:list[cp.Constraint] = []
215
+ try:
216
+ import cvxpy as cp
217
+ from cvxpy import Variable as Var
218
+ except ImportError:
219
+ raise ImportError("cvxpy or ecos is not installed. Please install them using 'pip install cvxpy ecos'")
220
+ cons: 'list[cp.Constraint]' = []
218
221
  # Create GEN vars
219
222
  pg0: 'dict[str, VF]' = {}
220
223
  qg0: 'dict[str, VF]' = {}
@@ -4,10 +4,16 @@ class OpenDSSSolver(SolverBase):
4
4
  def __init__(self, grid:Grid, eps:float = 1e-6, max_iter:int = 1000, *,
5
5
  default_saveto:str = DEFAULT_SAVETO, source_bus:str, init_t:int = 0):
6
6
  super().__init__(grid, eps, max_iter, default_saveto = default_saveto)
7
- from py_dss_interface import DSS
7
+ try:
8
+ from py_dss_interface import DSS
9
+ except ImportError:
10
+ raise ImportError("py_dss_interface or OpenDSS is not installed. Please install OpenDSS first and then py_dss_interface using 'pip install py_dss_interface'")
8
11
  self._g = grid
9
12
  t = init_t
10
- d = DSS()
13
+ try:
14
+ d = DSS()
15
+ except:
16
+ d = DSS.DSSDLL()
11
17
  d.text("clear")
12
18
  cir = f"new circuit.my_circuit basekv={grid.Ub} pu=1 MVASC3=5000000 5000000 bus1={source_bus}"
13
19
  self.source_bus = source_bus
@@ -79,8 +85,12 @@ class OpenDSSSolver(SolverBase):
79
85
  self.dss.text(f"set Voltagebases=[{self.grid.Ub}]")
80
86
  self.dss.text("calcv")
81
87
  self.dss.text("solve maxcontrol=10000")
82
- bnames = self.dss.circuit.buses_names
83
- bvolt = np.array(self.dss.circuit.buses_volts).reshape(-1, 3, 2)
88
+ if hasattr(self.dss, "circuit"):
89
+ bnames = self.dss.circuit.buses_names
90
+ bvolt = np.array(self.dss.circuit.buses_volts).reshape(-1, 3, 2)
91
+ else:
92
+ bnames = self.dss.circuit_all_bus_names()
93
+ bvolt = np.array(self.dss.circuit_all_bus_volts()).reshape(-1, 3, 2)
84
94
  sb_theta = 0
85
95
  for i, bn in enumerate(bnames):
86
96
  v1 = bvolt[i,0][0] + 1j * bvolt[i,0][1]
@@ -95,13 +105,6 @@ class OpenDSSSolver(SolverBase):
95
105
  for i, bn in enumerate(bnames):
96
106
  self.grid.Bus(bn).theta -= sb_theta
97
107
 
98
- for l in self.grid.Lines:
99
- vi = self.grid.Bus(l.fBus).V_cpx
100
- vj = self.grid.Bus(l.tBus).V_cpx
101
- assert vi is not None and vj is not None
102
- i = (vi-vj)/l.Z
103
- l.I = abs(i)
104
- s = vi*i.conjugate()
105
- l.P = s.real
106
- l.Q = s.imag
108
+ self._calc_line_params()
109
+
107
110
  return GridSolveResult.OK, 0.0
@@ -4,7 +4,10 @@ from .solbase import *
4
4
  class GridCalSolver(SolverBase):
5
5
  def __init__(self, grid:Grid, eps:float = 1e-6, max_iter:int = 1000, *, default_saveto:str = DEFAULT_SAVETO,
6
6
  slack_bus:str, slack_gen:str = "", init_t:int = 0):
7
- import GridCalEngine as gce
7
+ try:
8
+ import GridCalEngine as gce
9
+ except ImportError:
10
+ raise ImportError("GridCalEngine is not installed. Please install it using 'pip install GridCalEngine'")
8
11
  super().__init__(grid, eps, max_iter, default_saveto = default_saveto)
9
12
  self.max_iter = max_iter
10
13
  self._g = grid
@@ -116,14 +119,6 @@ class GridCalSolver(SolverBase):
116
119
  assert isinstance(angle, (float, np.floating)), f"Bus {bn} angle is not a float: {type(angle)}"
117
120
  b.theta = float(angle) / 180 * math.pi
118
121
 
119
- for l in self.grid.Lines:
120
- vi = self.grid.Bus(l.fBus).V_cpx
121
- vj = self.grid.Bus(l.tBus).V_cpx
122
- assert vi is not None and vj is not None
123
- i = (vi-vj)/l.Z
124
- l.I = abs(i)
125
- s = vi*i.conjugate()
126
- l.P = s.real
127
- l.Q = s.imag
122
+ self._calc_line_params()
128
123
 
129
124
  return GridSolveResult.OK, 0.0
@@ -16,10 +16,10 @@ class NewtonSolver(SolverBase):
16
16
 
17
17
  def CheckBusType(self, _t:int):
18
18
  '''Check the bus type'''
19
- busType:dict[BusID, BusType] = {}
19
+ busType: 'dict[BusID, BusType]' = {}
20
20
  slack_cnt = 0
21
- eq_P:list[int] = []
22
- eq_Q:list[int] = []
21
+ eq_P: 'list[int]' = []
22
+ eq_Q: 'list[int]' = []
23
23
  self.Ps = []
24
24
  self.Qs = []
25
25
  for i, bus in enumerate(self.grid._busl):
@@ -107,7 +107,7 @@ class NewtonSolver(SolverBase):
107
107
 
108
108
  def _solve(self) -> int:
109
109
  cnt = 0
110
- while cnt<self.max_iter:
110
+ while cnt < self.max_iter:
111
111
  y = np.zeros(self.n, dtype=np.float64)
112
112
  for i, b in enumerate(self.eqs):
113
113
  y[i] = self.Ps[b] - self.P(b) if i < self.n_P else self.Qs[b] - self.Q(b)
@@ -144,13 +144,7 @@ class NewtonSolver(SolverBase):
144
144
  self._solve()
145
145
  except ValueError:
146
146
  return GridSolveResult.Failed, -1
147
- for l in self.grid.Lines:
148
- vi = self.grid.Bus(l.fBus).V_cpx
149
- vj = self.grid.Bus(l.tBus).V_cpx
150
- assert vi is not None and vj is not None
151
- i = (vi-vj)/l.Z
152
- l.I = abs(i)
153
- s = vi*i.conjugate()
154
- l.P = s.real
155
- l.Q = s.imag
147
+
148
+ self._calc_line_params()
149
+
156
150
  return GridSolveResult.OK, 0
@@ -1,7 +1,6 @@
1
1
  from typing import Optional, Union
2
- from feasytools import TimeFunc, SegFunc, ConstFunc, makeFunc
2
+ from feasytools import TimeFunc, SegFunc, ConstFunc
3
3
  from xml.etree.ElementTree import Element
4
- from typing import TextIO
5
4
 
6
5
 
7
6
  FloatVar = Optional[float]
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.2
2
+ Name: fpowerkit
3
+ Version: 0.2.3
4
+ Summary: A Distflow PDN solver based on Gurobi.
5
+ Author: fmy_xfk
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: feasytools>=0.0.21
13
+ Requires-Dist: numpy>=1.19.0
14
+ Dynamic: author
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: requires-dist
19
+ Dynamic: requires-python
20
+ Dynamic: summary
21
+
22
+ # FPowerKit - A power distribution network calculation component
23
+
24
+ This is a package designed for power distribution network solving.
25
+
26
+ This package is affiliated to V2Sim, an open-aource microscopic V2G simulation platform in urban power and transportation network. If you are using the modified DistFlow model in this package, please cite the [paper](https://ieeexplore.ieee.org/document/10970754):
27
+
28
+ ```
29
+ @ARTICLE{10970754,
30
+ author={Qian, Tao and Fang, Mingyu and Hu, Qinran and Shao, Chengcheng and Zheng, Junyi},
31
+ journal={IEEE Transactions on Smart Grid},
32
+ title={V2Sim: An Open-Source Microscopic V2G Simulation Platform in Urban Power and Transportation Network},
33
+ year={2025},
34
+ pages={1-1},
35
+ keywords={Vehicle-to-grid;Partial discharges;Microscopy;Batteries;Planning;Discharges (electric);Optimization;Vehicle dynamics;Transportation;Roads;EV charging load simulation;microscopic EV behavior;Vehicle-to-grid;charging station fault sensing},
36
+ doi={10.1109/TSG.2025.3560976}}
37
+
38
+ ```
39
+
40
+ There are 3 modes for this package to work:
41
+
42
+ - Optimal power flow (OPF): Use cvxpy to solve the optimal power flow and determine the output of the generators.
43
+
44
+ - Power flow calculation: Use OpenDSS/GridCal/Inner Newton-Raphson method to solve the power flow.
45
+
46
+ - Hybrid: Use OPF to determine the initial value, and then use OpenDSS/GridCal/Inner Newton-Raphson to perform accurate calculation.
47
+
48
+ Since this package is still under development, the API is unstable and may be changed anytime.
49
+
50
+ Please visit https://gitee.com/fmy_xfk/fpowerkit to read the detailed introduction and the usage.
@@ -0,0 +1,2 @@
1
+ feasytools>=0.0.21
2
+ numpy>=1.19.0
@@ -5,7 +5,7 @@ with open("desc.md", "r", encoding="utf8") as f:
5
5
 
6
6
  setup(
7
7
  name="fpowerkit",
8
- version="0.2.1",
8
+ version="0.2.3",
9
9
  author="fmy_xfk",
10
10
  packages=find_packages(),
11
11
  description="A Distflow PDN solver based on Gurobi.",
@@ -17,5 +17,5 @@ setup(
17
17
  "Operating System :: OS Independent",
18
18
  ],
19
19
  python_requires=">=3.8",
20
- install_requires=["feasytools>=0.0.21", "cvxpy>=1.0", "numpy>=1.20.0", "ecos"],
20
+ install_requires=["feasytools>=0.0.21", "numpy>=1.19.0"],
21
21
  )
fpowerkit-0.2.1/PKG-INFO DELETED
@@ -1,38 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: fpowerkit
3
- Version: 0.2.1
4
- Summary: A Distflow PDN solver based on Gurobi.
5
- Author: fmy_xfk
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Operating System :: OS Independent
9
- Requires-Python: >=3.8
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: feasytools>=0.0.21
13
- Requires-Dist: cvxpy>=1.0
14
- Requires-Dist: numpy>=1.20.0
15
- Requires-Dist: ecos
16
- Dynamic: author
17
- Dynamic: classifier
18
- Dynamic: description
19
- Dynamic: description-content-type
20
- Dynamic: requires-dist
21
- Dynamic: requires-python
22
- Dynamic: summary
23
-
24
- # FPowerKit - A power distribution network calculation component
25
-
26
- This is a package designed for power distribution network solving.
27
-
28
- There are 3 modes for this package to work:
29
-
30
- - Optimal power flow (OPF): Use cvxpy to solve the optimal power flow and determine the output of the generators.
31
-
32
- - Power flow calculation: Use OpenDSS or Netwon-Raphson method to solve the power flow with given generator ouputs.
33
-
34
- - Hybrid: Use OPF to determine the initial value, and then use OpenDSS or Newton method to perform accurate calculation.
35
-
36
- Since this package is still under development, the API is unstable and may be changed anytime.
37
-
38
- Please visit https://gitee.com/fmy_xfk/fpowerkit to read the detailed introduction and the usage.
fpowerkit-0.2.1/README.md DELETED
@@ -1,44 +0,0 @@
1
- # FPowerKit 配电网运算组件
2
- **本仓库已上线PyPI**,您可以通过`pip install fpowerkit`直接以Python包的形式安装使用本仓库的代码!
3
-
4
- 这个项目是[V2Sim](https://gitee.com/fmy_xfk/v2sim)的附属项目。V2Sim的论文请见arXiv: https://arxiv.org/abs/2412.09808
5
-
6
- IEEE33和IEEE69节点的配网数据从公开渠道收集。除配网数据以外,本仓库代码均遵循LGPL3.0协议使用。
7
-
8
- ## 简介
9
- - 依赖于feasytools和gurobipy: `pip install feasytools gurobipy`(请自行安装Gurobi并申请许可证)
10
- - 包含电网的描述(含母线、发电机、线路等)和采用Gurobi的配电网DistFlow模型求解。
11
- - 优化目标为“发电成本最小”。发电成本模型为二次函数$f(x)=ax^2+bx+c$。
12
- - 内含IEEE 33节点配电网和IEEE 69节点配电网,可通过以下方式快速创建:
13
- ```py
14
- from fpowerkit import PDNCases
15
- grid_obj33 = PDNCases.IEEE33()
16
- grid_obj69 = PDNCases.IEEE69()
17
- ```
18
-
19
- ## 使用
20
-
21
- 克隆本仓库,并输入以下命令开始求解:
22
-
23
- ```bash
24
- python main.py -g cases/33base.xml
25
- ```
26
-
27
- 请注意上述命令不适用于pip安装的版本。
28
-
29
- `33base`描述了IEEE 33节点配电网模型。换成`3nodes`则是一个极简版3节点辐射形配电网模型,结构如下:
30
-
31
- ```
32
- G0 G1
33
- | |
34
- B0->B1->B2
35
- | |
36
- L1 L2
37
- ```
38
-
39
- 您也换成自己的配电网文件来求解,例如`python main.py -g path/to/your_zipfile.zip`
40
-
41
- ## 配电网文件格式
42
- [XML格式](docs/xml_file.md)
43
-
44
- ZIP格式已经不再支持。
@@ -1,38 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: fpowerkit
3
- Version: 0.2.1
4
- Summary: A Distflow PDN solver based on Gurobi.
5
- Author: fmy_xfk
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Operating System :: OS Independent
9
- Requires-Python: >=3.8
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: feasytools>=0.0.21
13
- Requires-Dist: cvxpy>=1.0
14
- Requires-Dist: numpy>=1.20.0
15
- Requires-Dist: ecos
16
- Dynamic: author
17
- Dynamic: classifier
18
- Dynamic: description
19
- Dynamic: description-content-type
20
- Dynamic: requires-dist
21
- Dynamic: requires-python
22
- Dynamic: summary
23
-
24
- # FPowerKit - A power distribution network calculation component
25
-
26
- This is a package designed for power distribution network solving.
27
-
28
- There are 3 modes for this package to work:
29
-
30
- - Optimal power flow (OPF): Use cvxpy to solve the optimal power flow and determine the output of the generators.
31
-
32
- - Power flow calculation: Use OpenDSS or Netwon-Raphson method to solve the power flow with given generator ouputs.
33
-
34
- - Hybrid: Use OPF to determine the initial value, and then use OpenDSS or Newton method to perform accurate calculation.
35
-
36
- Since this package is still under development, the API is unstable and may be changed anytime.
37
-
38
- Please visit https://gitee.com/fmy_xfk/fpowerkit to read the detailed introduction and the usage.
@@ -1,4 +0,0 @@
1
- feasytools>=0.0.21
2
- cvxpy>=1.0
3
- numpy>=1.20.0
4
- ecos
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes