Skip to content

Commit

Permalink
Merge pull request #106 from tbody-cfs/current_lims
Browse files Browse the repository at this point in the history
Require current lims for all coils
  • Loading branch information
bendudson authored Feb 13, 2024
2 parents 7e19b06 + 7abc1d4 commit 82081a7
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 82081a7

Please sign in to comment.