# Tap changers

## Phase tap changer

This example shows how to add a phase tap changer to a two windings transformer:

twoWindingsTransformer.newPhaseTapChanger()
.setLowTapPosition(-1)
.setTapPosition(0)
.setRegulating(true)
.setRegulationMode(PhaseTapChanger.RegulationMode.CURRENT_LIMITER)
.setRegulationValue(25)
.setRegulationTerminal(twoWindingsTransformer.getTerminal2())
.beginStep()
.setAlpha(-10)
.setRho(0.99)
.setR(1.)
.setX(2.)
.setG(0.5)
.setB(0.5)
.endStep()
.beginStep()
.setAlpha(0)
.setRho(1)
.setR(1.)
.setX(2.)
.setG(0.5)
.setB(0.5)
.endStep()
.beginStep()
.setAlpha(10)
.setRho(1.01)
.setR(1.)
.setX(2.)
.setG(0.5)
.setB(0.5)
.endStep()


## Ratio tap changer

This example shows how to add a ratio tap changer to a two windings transformer:

twoWindingsTransformer.newRatioTapChanger()
.setLowTapPosition(-1)
.setTapPosition(0)
.setRegulating(true)
.setTargetV(25)
.setRegulationTerminal(twoWindingsTransformer.getTerminal1())
.beginStep()
.setRho(0.95)
.setR(1.)
.setX(2.)
.setG(0.5)
.setB(0.5)
.endStep()
.beginStep()
.setRho(1)
.setR(1.)
.setX(2.)
.setG(0.5)
.setB(0.5)
.endStep()
.beginStep()
.setRho(1.05)
.setR(1.)
.setX(2.)
.setG(0.5)
.setB(0.5)
.endStep()