Skip to content

Commit

Permalink
Require current lims for all coils
Browse files Browse the repository at this point in the history
  • Loading branch information
tbody-cfs committed Feb 12, 2024
1 parent c17e466 commit 7abc1d4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions freegs/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ def __call__(self, eq):
for i in range(ncontrols):
current_change_bounds.append((-inf, inf))
else:
for i in range(ncontrols):
cur = tokamak.controlCurrents()[i]
lower_lim = self.current_lims[i][0] - cur
upper_lim = self.current_lims[i][1] - cur
current_change_bounds.append((lower_lim, upper_lim))
assert len(self.current_lims) == len(tokamak.coils), \
f"Should provide current limits for all coils. Provided {len(self.current_lims)} limits for {len(tokamak.coils)} coils."
for i, (_, coil) in enumerate(tokamak.coils):
if coil.control:
lower_lim = self.current_lims[i][0] - coil.current
upper_lim = self.current_lims[i][1] - coil.current
current_change_bounds.append((lower_lim, upper_lim))

current_change_bnds = array(current_change_bounds)

Expand Down

0 comments on commit 7abc1d4

Please sign in to comment.