freegs.machine.Machine#

class freegs.machine.Machine(coils, wall=None, sensors=None, nlimit=500)[source]#

Bases: object

Represents the machine (Tokamak), including coils and power supply circuits

coils[(label, Coil|Circuit|Solenoid] - List of coils

Note: a list is used rather than a dict, so that the coils remain ordered, and so can be updated easily by the control system. Instead __getitem__ is implemented to allow access to coils

__init__(coils, wall=None, sensors=None, nlimit=500)[source]#

coils - A list of coils [(label, Coil|Circuit|Solenoid)] sensors - A list of sensors

Methods

Br(R, Z)

Radial magnetic field at given points

Bz(R, Z)

Vertical magnetic field

__init__(coils[, wall, sensors, nlimit])

coils - A list of coils [(label, Coil|Circuit|Solenoid)] sensors - A list of sensors

calcPsiFromGreens(pgreen)

Uses the object returned by createPsiGreens to quickly compute the plasma psi

controlAdjust(current_change)

Add given currents to the controls.

controlBr(R, Z)

Returns a list of control responses for Br at the given (R,Z) location(s).

controlBz(R, Z)

Returns a list of control responses for Bz at the given (R,Z) location(s)

controlCurrents()

Return a list of coil currents for the coils being controlled

controlPsi(R, Z)

Returns a list of control responses for psi at the given (R,Z) location(s)

createPsiGreens(R, Z)

An optimisation, which pre-computes the Greens functions and puts into arrays for each coil.

generate_limit_points(nlimit)

Generate points along the machine wall that may be used to check if the plasma is limited or not.

getCurrents()

Returns a dictionary of coil label -> current in Amps

getForces([equilibrium])

Calculate forces on the coils, given the plasma equilibrium.

plot([axis, show])

Plot the machine coils

printCurrents()

printMeasurements([eq])

Method for calling the takeMeasurements method, then printing the results

psi(R, Z)

Poloidal flux due to coils

setControlCurrents(currents)

Sets the currents in the coils being controlled.

takeMeasurements([eq])

Method calling the measure method of each sensor on the machine

Br(R, Z)[source]#

Radial magnetic field at given points

Bz(R, Z)[source]#

Vertical magnetic field

calcPsiFromGreens(pgreen)[source]#

Uses the object returned by createPsiGreens to quickly compute the plasma psi

controlAdjust(current_change)[source]#

Add given currents to the controls. Given iterable must be the same length as the list returned by controlBr, controlBz

controlBr(R, Z)[source]#

Returns a list of control responses for Br at the given (R,Z) location(s).

controlBz(R, Z)[source]#

Returns a list of control responses for Bz at the given (R,Z) location(s)

controlCurrents()[source]#

Return a list of coil currents for the coils being controlled

controlPsi(R, Z)[source]#

Returns a list of control responses for psi at the given (R,Z) location(s)

createPsiGreens(R, Z)[source]#

An optimisation, which pre-computes the Greens functions and puts into arrays for each coil. This map can then be called at a later time, and quickly return the field

generate_limit_points(nlimit)[source]#

Generate points along the machine wall that may be used to check if the plasma is limited or not.

getCurrents()[source]#

Returns a dictionary of coil label -> current in Amps

getForces(equilibrium=None)[source]#

Calculate forces on the coils, given the plasma equilibrium. If no plasma equilibrium given then the forces due to the coils alone will be calculated.

Returns a dictionary of coil label -> force

plot(axis=None, show=True)[source]#

Plot the machine coils

printCurrents()[source]#
printMeasurements(eq=None)[source]#

Method for calling the takeMeasurements method, then printing the results

psi(R, Z)[source]#

Poloidal flux due to coils

setControlCurrents(currents)[source]#

Sets the currents in the coils being controlled. Input list must be of the same length as the list returned by controlCurrents

takeMeasurements(eq=None)[source]#

Method calling the measure method of each sensor on the machine