@@ -195,6 +195,59 @@ There are 4 **__main__** types of method you need to implement if you want to us
195195 be the case for *eg * :func: `grid2op.Observation.BaseObservation.simulate ` or
196196 for :class: `grid2op.simulator.Simulator `.
197197
198+ init function
199+ ----------------
200+
201+ The `__init__ ` function of your backend class should accept key-word arguments
202+ `detailed_infos_for_cascading_failures ` and `can_be_copied `.
203+
204+ It should also avoid regular arguments (some part of the code recreate backend instanced based on
205+ key-wrod arguments).
206+
207+ We recommend you do something like this :
208+
209+ .. code-block :: python
210+
211+ def __init__ (self ,
212+ detailed_infos_for_cascading_failures :bool = False ,
213+ can_be_copied :bool = True ,
214+ OTHER_KWARGS_1 ,
215+ OTHER_KWARGS_2 ,
216+ ETC ):
217+ Backend.__init__ (
218+ self ,
219+ detailed_infos_for_cascading_failures = detailed_infos_for_cascading_failures,
220+ can_be_copied = can_be_copied,
221+ OTHER_KWARGS_1 = OTHER_KWARGS_1 ,
222+ OTHER_KWARGS_2 = OTHER_KWARGS_2 ,
223+ )
224+
225+
226+ For example the top first lines of the code of PandaPowerBackend looks like:
227+
228+ .. code-block :: python
229+
230+ def __init__ (
231+ self ,
232+ detailed_infos_for_cascading_failures : bool = False ,
233+ lightsim2grid : bool = False , # use lightsim2grid as pandapower powerflow solver
234+ dist_slack : bool = False ,
235+ max_iter : int = 10 ,
236+ can_be_copied : bool = True ,
237+ with_numba : bool = NUMBA_ ,
238+ ):
239+
240+ # small irrelevant piece of code
241+
242+ Backend.__init__ (
243+ self ,
244+ detailed_infos_for_cascading_failures = detailed_infos_for_cascading_failures,
245+ can_be_copied = can_be_copied,
246+ lightsim2grid = lightsim2grid,
247+ dist_slack = dist_slack,
248+ max_iter = max_iter,
249+ with_numba = with_numba,
250+ )
198251
199252 .. _grid-description :
200253
0 commit comments