fpowerkit 0.0.3__tar.gz → 0.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fpowerkit
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: A Distflow PDN solver based on Gurobi.
5
5
  Author: fmy_xfk
6
6
  Classifier: Programming Language :: Python :: 3
@@ -569,7 +569,8 @@ class Grid:
569
569
  raise ValueError(f"Invalid power unit: {gens_unit}")
570
570
  return Grid(Sb, Ub, buses, lines, gens, holdShadowPrice)
571
571
 
572
- def solve(self, _t: int, /, *, max_v_pu:float = 1.1, min_v_pu: float = 0.9, max_I_kA: float = 0.866, source_buses:'list[BusID]' = []) -> 'tuple[bool, float]':
572
+ def solve(self, _t: int, /, *, max_v_pu:float = 1.1, min_v_pu: float = 0.9, max_I_kA: float = 0.866,
573
+ source_buses:'list[BusID]' = [], source_bus_V_pu:float = 1.0) -> 'tuple[bool, float]':
573
574
  '''Get the best result at time _t, return a tuple: (success?, optimal objective value)'''
574
575
  model = Model("model")
575
576
  max_v = max_v_pu ** 2
@@ -622,7 +623,7 @@ class Grid:
622
623
 
623
624
  assert len(source_buses) > 0, "No source bus specified"
624
625
  for b in source_buses:
625
- model.addConstr(v[b] == 1, f"v_{b}==1")
626
+ model.addConstr(v[b] == source_bus_V_pu, f"src_{b}")
626
627
 
627
628
  model.setObjective(
628
629
  quicksum(g.CostA(_t) * pg0[g.ID] ** 2 + g.CostB(_t) * pg0[g.ID] + g.CostC(_t) for g in self.Gens),
@@ -632,7 +633,9 @@ class Grid:
632
633
  model.update()
633
634
  model.optimize()
634
635
  if model.Status != GRB.Status.OPTIMAL:
635
- return False, 0
636
+ model.optimize()
637
+ if model.Status != GRB.Status.OPTIMAL:
638
+ return False, 0
636
639
 
637
640
  for bus in self.Buses:
638
641
  j = bus.ID
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fpowerkit
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: A Distflow PDN solver based on Gurobi.
5
5
  Author: fmy_xfk
6
6
  Classifier: Programming Language :: Python :: 3
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf8") as f:
5
5
 
6
6
  setup(
7
7
  name="fpowerkit",
8
- version="0.0.3",
8
+ version="0.0.4",
9
9
  author="fmy_xfk",
10
10
  packages=find_packages(),
11
11
  description="A Distflow PDN solver based on Gurobi.",
File without changes
File without changes
File without changes