A grid code is a technical specification which defines the parameters a facility connected to a public electric grid has to meet to ensure safe, secure and economic proper functioning of the electric system. The facility can be an electricity generating plant, a consumer, or another network.
The grid code is specified by an authority responsible for the system integrity and network operation.
Its elaboration usually implicates network operators (distribution or transmission system operators), representatives of users and, to an extent varying between countries, the regulating body.
Contents of a grid code vary depending on the transmission company's requirements. Typically, a grid code will specify the required behavior of a connected generator during system disturbances. These include voltage regulation, power factor limits and reactive power supply, response to a system fault (e.g. short-circuit), response to frequency changes on the grid, and requirement to "ride through" short i