freegs.control.constrain#
- class freegs.control.constrain(xpoints=[], gamma=1e-12, isoflux=[], psivals=[], current_lims=None, max_total_current=None)[source]#
Bases:
objectAdjust coil currents using constraints. To use this class, first create an instance by specifying the constraints
>>> controlsystem = constrain(xpoints = [(1.0, 1.1), (1.0,-1.0)])
controlsystem will now attempt to create x-points at (R,Z) = (1.0, 1.1) and (1.0, -1.1) in any Equilibrium
>>> controlsystem(eq)
where eq is an Equilibrium object which is modified by the call.
The constraints which can be set are:
xpoints - A list of X-point (R,Z) locations
isoflux - A list of tuples (R1,Z1, R2,Z2)
psivals - A list of (R,Z,psi) values
At least one of the above constraints must be included.
gamma - A scalar, minimises the magnitude of the coil currents
The following constraitns are entirely optional:
current_lims - A list of tuples [(l1,u1),(l2,u2)…(lN,uN)] for the upper and lower bounds on the currents in each coil.
max_total_current - The maximum total current through the coilset.
- __init__(xpoints=[], gamma=1e-12, isoflux=[], psivals=[], current_lims=None, max_total_current=None)[source]#
Create an instance, specifying the constraints to apply
Methods