fpowerkit 0.3.1__tar.gz → 0.3.2__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 (25) hide show
  1. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/PKG-INFO +2 -9
  2. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/README.md +1 -1
  3. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/ess.py +6 -1
  4. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/pvwind.py +6 -2
  5. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/soldist.py +3 -3
  6. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit.egg-info/PKG-INFO +2 -9
  7. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/setup.py +1 -1
  8. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/LICENSE +0 -0
  9. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/__init__.py +0 -0
  10. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/bus.py +0 -0
  11. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/cases.py +0 -0
  12. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/gen.py +0 -0
  13. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/grid.py +0 -0
  14. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/island.py +0 -0
  15. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/line.py +0 -0
  16. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/solbase.py +0 -0
  17. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/solcmb.py +0 -0
  18. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/soldss.py +0 -0
  19. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/solnt.py +0 -0
  20. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit/utils.py +0 -0
  21. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit.egg-info/SOURCES.txt +0 -0
  22. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit.egg-info/dependency_links.txt +0 -0
  23. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit.egg-info/requires.txt +0 -0
  24. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/fpowerkit.egg-info/top_level.txt +0 -0
  25. {fpowerkit-0.3.1 → fpowerkit-0.3.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: fpowerkit
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: A PDN solver with multiple solutions.
5
5
  Author: fmy_xfk
6
6
  Classifier: Programming Language :: Python :: 3
@@ -11,13 +11,6 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: feasytools>=0.0.21
13
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
14
 
22
15
  # FPowerKit - A power distribution network calculation component
23
16
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  ## 简介
5
5
  - FPowerKit是一个配电网求解组件,它包含电网的描述(含母线、发电机、线路、光伏、风机和储能等)和多种内置和外部求解方案:
6
- + (内置) 改进DistFlow配电网最优潮流
6
+ + (内置) 改进DistFlow配电网最优潮流 ([原理介绍](docs/principle.md))
7
7
  + (内置) Newton-Raphson潮流计算
8
8
  + (外接) OpenDSS配电网潮流计算
9
9
  + 最优潮流+潮流计算核验的混合方案
@@ -72,9 +72,14 @@ class ESS:
72
72
  return self.Charge(self.P, dur)
73
73
  return 0
74
74
 
75
+ @property
76
+ def tanPhi(self) -> float:
77
+ '''tan φ = sqrt(1 - PF**2) / PF'''
78
+ return math.sqrt(1 - self._pf**2) / self._pf
79
+
75
80
  def __q(self, P: float) -> float:
76
81
  '''Calculate reactive power'''
77
- return P * math.sqrt(1 - self._pf**2)
82
+ return P * self.tanPhi
78
83
 
79
84
  def GetLoad(self, t: int, cprice:float, dprice:float) -> 'tuple[float, float]':
80
85
  '''
@@ -53,15 +53,19 @@ class PVWind:
53
53
 
54
54
  @property
55
55
  def PF(self):
56
- '''Power factor, cos(phi). Reactive output Q = P * sqrt(1 - PF**2)'''
56
+ '''Power factor, cos(phi). Reactive output Q = P * tan φ'''
57
57
  return self._pf
58
58
  @PF.setter
59
59
  def PF(self, pf: float):
60
60
  self._pf = pf
61
61
 
62
+ @property
63
+ def tanPhi(self):
64
+ return math.sqrt(1 - self._pf**2) / self._pf
65
+
62
66
  def Q(self, _t):
63
67
  '''Reactive power output, pu'''
64
- return self.P(_t) * math.sqrt(1 - self._pf**2)
68
+ return self.P(_t) * self.tanPhi
65
69
 
66
70
  def position(self):
67
71
  '''Return the position of the PV Panel'''
@@ -178,7 +178,7 @@ class DistFlowSolver(SolverBase):
178
178
  # Add PVW constraints
179
179
  for pID, p in island.PVWItems():
180
180
  cons.append(pvwp[pID] <= p.P(_t))
181
- cons.append(pvwp[pID] * math.sqrt(1 - p.PF**2) == pvwq[pID])
181
+ cons.append(pvwp[pID] * p.tanPhi == pvwq[pID])
182
182
 
183
183
  # Bind GEN vars to Bus
184
184
  pg: 'dict[str, list[VF]]' = {b: [] for b in island.Buses}
@@ -274,8 +274,8 @@ class DistFlowSolver(SolverBase):
274
274
  cp.quad_over_lin(cp.hstack([P[lid], Q[lid]]), v[i]) <= l[lid]
275
275
  )
276
276
 
277
- for pID, p in island.PVWItems():
278
- cons.append(pvwp[pID] + cp.sqrt(1 - p.PF**2) == pvwq[pID])
277
+ #for pID, p in island.PVWItems():
278
+ # cons.append(pvwp[pID] + cp.sqrt(1 - p.PF**2) == pvwq[pID])
279
279
 
280
280
  # Objective components
281
281
  decs = self.C * (cp.sum(list(Pdec.values())) +
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: fpowerkit
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: A PDN solver with multiple solutions.
5
5
  Author: fmy_xfk
6
6
  Classifier: Programming Language :: Python :: 3
@@ -11,13 +11,6 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: feasytools>=0.0.21
13
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
14
 
22
15
  # FPowerKit - A power distribution network calculation component
23
16
 
@@ -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.3.1",
8
+ version="0.3.2",
9
9
  author="fmy_xfk",
10
10
  packages=find_packages(),
11
11
  description="A PDN solver with multiple solutions.",
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