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.

BackendError

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

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.

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.

IllegalAction

This exception indicate that the grid2op.BaseAction is illegal.

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

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

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: grid2op.Exceptions.IllegalActionExceptions.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: grid2op.Exceptions.IllegalActionExceptions.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: grid2op.Exceptions.Grid2OpException.Grid2OpException

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

exception grid2op.Exceptions.AmbiguousAction[source]

Bases: grid2op.Exceptions.Grid2OpException.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.BackendError[source]

Bases: grid2op.Exceptions.Grid2OpException.Grid2OpException

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

exception grid2op.Exceptions.ChronicsError[source]

Bases: grid2op.Exceptions.Grid2OpException.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: grid2op.Exceptions.ChronicsExceptions.ChronicsError

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

exception grid2op.Exceptions.DivergingPowerFlow[source]

Bases: grid2op.Exceptions.Grid2OpException.Grid2OpException

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 connex

  • 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: grid2op.Exceptions.Grid2OpException.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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.IllegalAction[source]

Bases: grid2op.Exceptions.Grid2OpException.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.IncorrectNumberOfElements[source]

Bases: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.EnvExceptions.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: grid2op.Exceptions.ChronicsExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.IllegalActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.AmbiguousActionExceptions.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.MultiEnvException[source]

Bases: grid2op.Exceptions.Grid2OpException.Grid2OpException

General exception raised by grid2Op.MultiEnv.MultiEnvironment

exception grid2op.Exceptions.NoForecastAvailable[source]

Bases: grid2op.Exceptions.Grid2OpException.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.Grid2OpException.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.IllegalActionExceptions.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: grid2op.Exceptions.IllegalActionExceptions.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: grid2op.Exceptions.IllegalActionExceptions.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: grid2op.Exceptions.Grid2OpException.Grid2OpException

General error for the grid2op.Opponent

exception grid2op.Exceptions.PlotError[source]

Bases: grid2op.Exceptions.Grid2OpException.Grid2OpException

General exception raised by any class that handles plots

exception grid2op.Exceptions.UnitCommitorRedispachingNotAvailable[source]

Bases: grid2op.Exceptions.IllegalActionExceptions.IllegalAction

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

exception grid2op.Exceptions.UnknownEnv[source]

Bases: grid2op.Exceptions.Grid2OpException.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: grid2op.Exceptions.AmbiguousActionExceptions.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: grid2op.Exceptions.Grid2OpException.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: grid2op.Exceptions.IllegalActionExceptions.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