/
AmbiguousActionExceptions.py
115 lines (87 loc) · 3.94 KB
/
AmbiguousActionExceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright (c) 2019-2020, RTE (https://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
# If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,
# you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of Grid2Op, Grid2Op a testbed platform to model sequential decision making in power systems.
from grid2op.Exceptions.Grid2OpException import Grid2OpException
# ambiguous action
class AmbiguousAction(Grid2OpException):
"""
This exception indicate that the :class:`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
:class:`grid2op.BaseAction.BaseAction` in
the :func:`grid2op.BaseAction.update` and :func:`grid2op.BaseAction.__call__` methods.
As opposed to a :class:`IllegalAction` an :class:`AmbiguousAction` is forbidden for all the backend,
in all the scenarios.
It doesn't depend on the implemented rules.
"""
pass
class InvalidLineStatus(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction` is
ambiguous due to powerlines manipulation.
"""
pass
class UnrecognizedAction(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction` is
ambiguous due to the bad formatting of the action.
"""
pass
class InvalidNumberOfLoads(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction`
is ambiguous because an incorrect number of loads tries to be modified.
"""
pass
class InvalidNumberOfGenerators(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction`
is ambiguous because an incorrect number of generator tries to be modified.
"""
pass
class InvalidNumberOfLines(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction`
is ambiguous because an incorrect number of lines tries to be modified.
"""
pass
class InvalidNumberOfObjectEnds(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction`
is ambiguous because an incorrect number of object at a substation try to be modified.
"""
pass
class InvalidBusStatus(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction`
try to both "set" and "switch" some bus to which an object is connected.
"""
pass
class InvalidRedispatching(AmbiguousAction):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that the :class:`grid2op.BaseAction.BaseAction`
try to apply an invalid redispatching strategy.
"""
pass
class GeneratorTurnedOnTooSoon(InvalidRedispatching):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that a generator has been turned on
before gen_min_up_time time steps.
"""
pass
class GeneratorTurnedOffTooSoon(InvalidRedispatching):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that a generator has been turned off
before gen_min_down_time time steps.
"""
pass
class NotEnoughGenerators(InvalidRedispatching):
"""
This is a more precise exception than :class:`AmbiguousAction` indicating that there is not enough turned off
generators to meet the demand.
"""
pass