Exception

This page is organized as follow:

Objectives

Grid2op defined some specific kind of exception to help debugging programs that lead didn’t execute properly.

Detailed Documentation by class

Exceptions:

ActiveSetPointAbovePmax

This is a more precise exception than OnProduction indicating that the action is illegal because the setpoint active power of a production is set to be higher than Pmax.

ActiveSetPointBelowPmin

This is a more precise exception than OnProduction indicating that the action is illegal because the setpoint active power of a production is set to be lower than Pmin.

AgentError

This exception indicate that there is an error in the creation of an agent

AmbiguousAction

This exception indicate that the grid2op.BaseAction is ambiguous.

AmbiguousActionRaiseAlert

Raise if the type of action is ambiguous due to the 'raiseAlert' part

BackendError

Base class of all error regarding the Backend that might be badly configured.

BaseObservationError

Generic type of exceptions raised by the observation

ChronicsError

Base class of all error regarding the chronics and the gridValue (see grid2op.ChronicsHandler.GridValue for more information)

ChronicsNotFoundError

This exception is raised where there are no chronics folder found at the indicated location.

DisconnectedGenerator

Specific error raised by the backend when a generator is disconnected

DisconnectedLoad

Specific error raised by the backend when a load is disconnected

DivergingPowerflow

This exception indicate that the grid2op.Backend.Backend is not able to find a valid solution to the

EnvError

This exception indicate that the grid2op.Environment.Environment is poorly configured.

GeneratorTurnedOffTooSoon

This is a more precise exception than AmbiguousAction indicating that a generator has been turned off before gen_min_down_time time steps.

GeneratorTurnedOnTooSoon

This is a more precise exception than AmbiguousAction indicating that a generator has been turned on before gen_min_up_time time steps.

Grid2OpException

Base Exception from which all Grid2Op raise exception derived.

HandlerError

This class indicates that the "handler" you are trying to use is not suitable.

IllegalAction

This exception indicate that the grid2op.BaseAction is illegal.

ImpossibleTopology

Specific error raised by the backend grid2op.Backend.Backend.apply_action() when the player asked a topology (for example using set_bus) that cannot be applied by the backend.

IncorrectNumberOfElements

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of elements of the powergrid.

IncorrectNumberOfGenerators

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of generators of the powergrid.

IncorrectNumberOfLines

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of

IncorrectNumberOfLoads

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of loads of the powergrid.

IncorrectNumberOfStorages

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of storage of the powergrid.

IncorrectNumberOfSubstation

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of substation of the powergrid.

IncorrectPositionOfGenerators

This is a more precise exception than EnvError indicating that there is a mismatch in the number of generators at a substation.

IncorrectPositionOfLines

This is a more precise exception than EnvError indicating that there is a mismatch in the number of power lines at a substation.

IncorrectPositionOfLoads

This is a more precise exception than EnvError indicating that there is a mismatch in the number of loads at a substation.

IncorrectPositionOfStorages

This is a more precise exception than EnvError indicating that there is a mismatch in the number of storage unit at a substation.

InsufficientData

This exception is raised where there are not enough data compare to the size of the episode asked.

InvalidBusStatus

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction try to both "set" and "switch" some bus to which an object is connected.

InvalidCurtailment

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction try to apply an invalid curtailment strategy.

InvalidLineStatus

This is a more precise exception than AmbiguousAction indicating that the

InvalidNumberOfGenerators

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of generator tries to be modified.

InvalidNumberOfLines

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of lines tries to be modified.

InvalidNumberOfLoads

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of loads tries to be modified.

InvalidNumberOfObjectEnds

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of object at a substation try to be modified.

InvalidReconnection

This is a more precise exception than OnLines indicating that the grid2op.BaseAgent tried to reconnect a powerline illegally.

InvalidRedispatching

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction try to apply an invalid redispatching strategy.

InvalidStorage

This is a more precise exception than AmbiguousAction indicating that the

IslandedGrid

Specific error when then backend "fails" because of an islanded grid

IsolatedElement

Specific error that should be raised when a element is alone on a bus (islanded grid when only one element is islanded)

MultiEnvException

General exception raised by grid2Op.MultiEnv.MultiEnvironment

NoForecastAvailable

This exception is mainly raised by the grid2op.Observation.BaseObservation.

NonFiniteElement

This is a more precise exception than AmbiguousAction indicating that an action / observation non initialized (full of Nan) has been loaded by the "from_vect" method.

NotEnoughAttentionBudget

This exception is raised when the player attempted to alert the "human operator" but it has not enough budget to do so.

NotEnoughGenerators

This is a more precise exception than AmbiguousAction indicating that there is not enough turned off generators to meet the demand.

OnLines

This is a more precise exception than IllegalAction indicating that the action is illegal due to setting

OnLoad

This is a more precise exception than IllegalAction indicating that the action is illegal due to setting wrong values to loads.

OnProduction

This is a more precise exception than IllegalAction indicating that the action is illegal due to setting wrong values to generators.

OpponentError

General error for the grid2op.Opponent

PlotError

General exception raised by any class that handles plots

SimulateError

This is the generic exception related to grid2op.Observation.BaseObservation.simulate() function

SimulateUsedTooMuchThisEpisode

This exception is raised by the grid2op.Observation.BaseObservation when using "obs.simulate(...)".

SimulateUsedTooMuchThisStep

This exception is raised by the grid2op.Observation.BaseObservation when using "obs.simulate(...)".

SimulatorError

This exception indicate that the simulator you are trying to use is not initialized.

UnitCommitorRedispachingNotAvailable

attempt to use redispatching or unit commit method in an environment not set up.

UnknownEnv

This exception indicate that a bad argument has been sent to the grid2op.make() function.

UnrecognizedAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous due to the bad formatting of the action.

UsedRunnerError

This exception indicate that runner (object of grid2op.Runner.Runner) has already been used.

VSetpointModified

This is a more precise exception than OnProduction indicating that the action is illegal because the

exception grid2op.Exceptions.ActiveSetPointAbovePmax[source]

Bases: OnProduction

This is a more precise exception than OnProduction indicating that the action is illegal because the setpoint active power of a production is set to be higher than Pmax.

exception grid2op.Exceptions.ActiveSetPointBelowPmin[source]

Bases: OnProduction

This is a more precise exception than OnProduction indicating that the action is illegal because the setpoint active power of a production is set to be lower than Pmin.

exception grid2op.Exceptions.AgentError[source]

Bases: Grid2OpException

This exception indicate that there is an error in the creation of an agent

exception grid2op.Exceptions.AmbiguousAction[source]

Bases: Grid2OpException

This exception indicate that the grid2op.BaseAction is ambiguous. It could be understood differently according to the backend used.

Such a kind of action are forbidden in this package. These kind of exception are mainly thrown by the grid2op.BaseAction.BaseAction in the grid2op.BaseAction.update() and grid2op.BaseAction.__call__() methods.

As opposed to a IllegalAction an AmbiguousAction is forbidden for all the backend, in all the scenarios.

It doesn’t depend on the implemented rules.

exception grid2op.Exceptions.AmbiguousActionRaiseAlert[source]

Bases: AmbiguousAction

Raise if the type of action is ambiguous due to the ‘raiseAlert’ part

exception grid2op.Exceptions.BackendError[source]

Bases: Grid2OpException

Base class of all error regarding the Backend that might be badly configured.

exception grid2op.Exceptions.BaseObservationError[source]

Bases: Grid2OpException

Generic type of exceptions raised by the observation

exception grid2op.Exceptions.ChronicsError[source]

Bases: Grid2OpException

Base class of all error regarding the chronics and the gridValue (see grid2op.ChronicsHandler.GridValue for more information)

exception grid2op.Exceptions.ChronicsNotFoundError[source]

Bases: ChronicsError

This exception is raised where there are no chronics folder found at the indicated location.

exception grid2op.Exceptions.DisconnectedGenerator[source]

Bases: BackendError

Specific error raised by the backend when a generator is disconnected

exception grid2op.Exceptions.DisconnectedLoad[source]

Bases: BackendError

Specific error raised by the backend when a load is disconnected

exception grid2op.Exceptions.DivergingPowerflow[source]

Bases: BackendError

This exception indicate that the grid2op.Backend.Backend is not able to find a valid solution to the

physical _grid it represents.

This divergence can be due to:

  • the system is not feasible: there is no solution to Kirchhoff’s law given the state

  • the powergrid is not connected and some area of the grid do not have slack buses

  • there is a “voltage collapse” : the voltages are ill conditioned making the _grid un realistic.

  • the method to solve the powerflow fails to find a valid solution. In this case, adopting a different grid2op.Backend.Backend might solve the problem.

exception grid2op.Exceptions.EnvError[source]

Bases: Grid2OpException

This exception indicate that the grid2op.Environment.Environment is poorly configured.

It is for example thrown when assessing if a backend is properly set up with grid2op.Backend.Backend.assert_grid_correct()

exception grid2op.Exceptions.GeneratorTurnedOffTooSoon[source]

Bases: InvalidRedispatching

This is a more precise exception than AmbiguousAction indicating that a generator has been turned off before gen_min_down_time time steps.

exception grid2op.Exceptions.GeneratorTurnedOnTooSoon[source]

Bases: InvalidRedispatching

This is a more precise exception than AmbiguousAction indicating that a generator has been turned on before gen_min_up_time time steps.

exception grid2op.Exceptions.Grid2OpException[source]

Bases: RuntimeError

Base Exception from which all Grid2Op raise exception derived.

__repr__()[source]

Return repr(self).

__str__()[source]

Return str(self).

__weakref__

list of weak references to the object (if defined)

exception grid2op.Exceptions.HandlerError[source]

Bases: ChronicsError

This class indicates that the “handler” you are trying to use is not suitable.

exception grid2op.Exceptions.IllegalAction[source]

Bases: Grid2OpException

This exception indicate that the grid2op.BaseAction is illegal.

It is for example thrown when an grid2op.BaseAgent tries to perform an action against the rule. This is handled in grid2op.Environment.Environment.step()

An grid2op.BaseAction is said to be illegal depending on some rules implemented in grid2op.BaseAction.ActionSpace.is_legal() method. An action can be legal in some context, but illegal in others.

exception grid2op.Exceptions.ImpossibleTopology[source]

Bases: BackendError

Specific error raised by the backend grid2op.Backend.Backend.apply_action() when the player asked a topology (for example using set_bus) that cannot be applied by the backend.

exception grid2op.Exceptions.IncorrectNumberOfElements[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of elements of the powergrid.

exception grid2op.Exceptions.IncorrectNumberOfGenerators[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of generators of the powergrid.

exception grid2op.Exceptions.IncorrectNumberOfLines[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of

powerlines of the powergrid.

exception grid2op.Exceptions.IncorrectNumberOfLoads[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of loads of the powergrid.

exception grid2op.Exceptions.IncorrectNumberOfStorages[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of storage of the powergrid.

exception grid2op.Exceptions.IncorrectNumberOfSubstation[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the total number of substation of the powergrid.

exception grid2op.Exceptions.IncorrectPositionOfGenerators[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the number of generators at a substation.

exception grid2op.Exceptions.IncorrectPositionOfLines[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the number of power lines at a substation.

exception grid2op.Exceptions.IncorrectPositionOfLoads[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the number of loads at a substation.

exception grid2op.Exceptions.IncorrectPositionOfStorages[source]

Bases: EnvError

This is a more precise exception than EnvError indicating that there is a mismatch in the number of storage unit at a substation.

exception grid2op.Exceptions.InsufficientData[source]

Bases: ChronicsError

This exception is raised where there are not enough data compare to the size of the episode asked.

exception grid2op.Exceptions.InvalidBusStatus[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction try to both “set” and “switch” some bus to which an object is connected.

exception grid2op.Exceptions.InvalidCurtailment[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction try to apply an invalid curtailment strategy.

exception grid2op.Exceptions.InvalidLineStatus[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the

grid2op.BaseAction.BaseAction is ambiguous due to powerlines manipulation.

exception grid2op.Exceptions.InvalidNumberOfGenerators[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of generator tries to be modified.

exception grid2op.Exceptions.InvalidNumberOfLines[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of lines tries to be modified.

exception grid2op.Exceptions.InvalidNumberOfLoads[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of loads tries to be modified.

exception grid2op.Exceptions.InvalidNumberOfObjectEnds[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous because an incorrect number of object at a substation try to be modified.

exception grid2op.Exceptions.InvalidReconnection[source]

Bases: OnLines

This is a more precise exception than OnLines indicating that the grid2op.BaseAgent tried to reconnect a powerline illegally.

exception grid2op.Exceptions.InvalidRedispatching[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction try to apply an invalid redispatching strategy.

exception grid2op.Exceptions.InvalidStorage[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the

grid2op.BaseAction.BaseAction is ambiguous due to storage unit manipulation.

exception grid2op.Exceptions.IslandedGrid[source]

Bases: BackendError

Specific error when then backend “fails” because of an islanded grid

exception grid2op.Exceptions.IsolatedElement[source]

Bases: IslandedGrid

Specific error that should be raised when a element is alone on a bus (islanded grid when only one element is islanded)

exception grid2op.Exceptions.MultiEnvException[source]

Bases: Grid2OpException

General exception raised by grid2Op.MultiEnv.MultiEnvironment

exception grid2op.Exceptions.NoForecastAvailable[source]

Bases: Grid2OpException

This exception is mainly raised by the grid2op.Observation.BaseObservation. It specifies the grid2op.Agent.BaseAgent that the grid2op.Chronics.GridValue doesn’t produce any forecasts.

In that case it is not possible to use the grid2op.Observation.BaseObservation.forecasts() method.

exception grid2op.Exceptions.NonFiniteElement[source]

Bases: InvalidRedispatching

This is a more precise exception than AmbiguousAction indicating that an action / observation non initialized (full of Nan) has been loaded by the “from_vect” method.

exception grid2op.Exceptions.NotEnoughAttentionBudget[source]

Bases: Grid2OpException

This exception is raised when the player attempted to alert the “human operator” but it has not enough budget to do so.

exception grid2op.Exceptions.NotEnoughGenerators[source]

Bases: InvalidRedispatching

This is a more precise exception than AmbiguousAction indicating that there is not enough turned off generators to meet the demand.

exception grid2op.Exceptions.OnLines[source]

Bases: IllegalAction

This is a more precise exception than IllegalAction indicating that the action is illegal due to setting

wrong values to lines (reconnection impossible, disconnection impossible etc).

exception grid2op.Exceptions.OnLoad[source]

Bases: IllegalAction

This is a more precise exception than IllegalAction indicating that the action is illegal due to setting wrong values to loads.

exception grid2op.Exceptions.OnProduction[source]

Bases: IllegalAction

This is a more precise exception than IllegalAction indicating that the action is illegal due to setting wrong values to generators.

exception grid2op.Exceptions.OpponentError[source]

Bases: Grid2OpException

General error for the grid2op.Opponent

exception grid2op.Exceptions.PlotError[source]

Bases: Grid2OpException

General exception raised by any class that handles plots

exception grid2op.Exceptions.SimulateError[source]

Bases: BaseObservationError

This is the generic exception related to grid2op.Observation.BaseObservation.simulate() function

exception grid2op.Exceptions.SimulateUsedTooMuchThisEpisode[source]

Bases: SimulateUsedTooMuch

This exception is raised by the grid2op.Observation.BaseObservation when using “obs.simulate(…)”.

It is raised when the total number of calls to obs.simulate(…) exceeds the maximum number of allowed calls to it for this episode.

The only way to use “obs.simulate(…)” again is to call “env.reset(…)”

exception grid2op.Exceptions.SimulateUsedTooMuchThisStep[source]

Bases: SimulateUsedTooMuch

This exception is raised by the grid2op.Observation.BaseObservation when using “obs.simulate(…)”.

It is raised when the total number of calls to obs.simulate(…) exceeds the maximum number of allowed calls to it, for a given step.

You can do more “obs.simulate” if you call “env.step”.

exception grid2op.Exceptions.SimulatorError[source]

Bases: Grid2OpException

This exception indicate that the simulator you are trying to use is not initialized.

You might want to call simulator.set_state(…) before using it.

exception grid2op.Exceptions.UnitCommitorRedispachingNotAvailable[source]

Bases: IllegalAction

attempt to use redispatching or unit commit method in an environment not set up.

exception grid2op.Exceptions.UnknownEnv[source]

Bases: Grid2OpException

This exception indicate that a bad argument has been sent to the grid2op.make() function.

It does not recognize the name of the grid2op.Environment.Environment.

exception grid2op.Exceptions.UnrecognizedAction[source]

Bases: AmbiguousAction

This is a more precise exception than AmbiguousAction indicating that the grid2op.BaseAction.BaseAction is ambiguous due to the bad formatting of the action.

exception grid2op.Exceptions.UsedRunnerError[source]

Bases: Grid2OpException

This exception indicate that runner (object of grid2op.Runner.Runner) has already been used.

This behaviour is not supported on windows / macos given the way the Multiprocessing package works (spawning a process where grid2op objects are made is not completly supported at the moment).

The best solution is to recreate a runner, and then use this new one.

exception grid2op.Exceptions.VSetpointModified[source]

Bases: OnProduction

This is a more precise exception than OnProduction indicating that the action is illegal because the

setpoint voltage magnitude of a production has been changed.

If you still can’t find what you’re looking for, try in one of the following pages:

Still trouble finding the information ? Do not hesitate to send a github issue about the documentation at this link: Documentation issue template