@@ -440,7 +440,7 @@ def __init__(self):
440440 self ._subs_impacted = None
441441
442442 # shunts
443- if self .shunts_data_available :
443+ if type ( self ) .shunts_data_available :
444444 self .shunt_p = np .full (
445445 shape = self .n_shunt , fill_value = np .NaN , dtype = dt_float
446446 )
@@ -495,6 +495,12 @@ def copy(self) -> "BaseAction":
495495 # sometimes this method is used...
496496 return self .__deepcopy__ ()
497497
498+ def shape (self ):
499+ return type (self ).shapes ()
500+
501+ def dtype (self ):
502+ return type (self ).dtypes ()
503+
498504 def _aux_copy (self , other ):
499505 attr_simple = [
500506 "_modif_inj" ,
@@ -524,7 +530,7 @@ def _aux_copy(self, other):
524530 "_raise_alert" ,
525531 ]
526532
527- if self .shunts_data_available :
533+ if type ( self ) .shunts_data_available :
528534 attr_vect += ["shunt_p" , "shunt_q" , "shunt_bus" ]
529535
530536 for attr_nm in attr_simple :
@@ -1050,7 +1056,7 @@ def __eq__(self, other) -> bool:
10501056 return False
10511057
10521058 # shunts are the same
1053- if self .shunts_data_available :
1059+ if type ( self ) .shunts_data_available :
10541060 if self .n_shunt != other .n_shunt :
10551061 return False
10561062 is_ok_me = np .isfinite (self .shunt_p )
@@ -1455,7 +1461,7 @@ def reset(self):
14551461 self ._subs_impacted = None
14561462
14571463 # shunts
1458- if self .shunts_data_available :
1464+ if type ( self ) .shunts_data_available :
14591465 self .shunt_p [:] = np .NaN
14601466 self .shunt_q [:] = np .NaN
14611467 self .shunt_bus [:] = 0
@@ -1631,7 +1637,7 @@ def __iadd__(self, other):
16311637 self ._assign_iadd_or_warn ("_change_bus_vect" , me_change )
16321638
16331639 # shunts
1634- if self .shunts_data_available :
1640+ if type ( self ) .shunts_data_available :
16351641 val = other .shunt_p
16361642 ok_ind = np .isfinite (val )
16371643 shunt_p = 1.0 * self .shunt_p
@@ -1763,7 +1769,7 @@ def __call__(self) -> Tuple[dict, np.ndarray, np.ndarray, np.ndarray, np.ndarray
17631769 storage_power = self ._storage_power
17641770 # remark: curtailment is handled by an algorithm in the environment, so don't need to be returned here
17651771 shunts = {}
1766- if self .shunts_data_available :
1772+ if type ( self ) .shunts_data_available :
17671773 shunts ["shunt_p" ] = self .shunt_p
17681774 shunts ["shunt_q" ] = self .shunt_q
17691775 shunts ["shunt_bus" ] = self .shunt_bus
@@ -1780,7 +1786,7 @@ def __call__(self) -> Tuple[dict, np.ndarray, np.ndarray, np.ndarray, np.ndarray
17801786 )
17811787
17821788 def _digest_shunt (self , dict_ ):
1783- if not self .shunts_data_available :
1789+ if not type ( self ) .shunts_data_available :
17841790 return
17851791
17861792 if "shunt" in dict_ :
@@ -2664,7 +2670,7 @@ def _check_for_ambiguity(self):
26642670 "which it is connected. This is ambiguous. You must *set* this bus instead."
26652671 )
26662672
2667- if self .shunts_data_available :
2673+ if type ( self ) .shunts_data_available :
26682674 if self .shunt_p .shape [0 ] != self .n_shunt :
26692675 raise IncorrectNumberOfElements (
26702676 "Incorrect number of shunt (for shunt_p) in your action."
@@ -3396,7 +3402,7 @@ def get_types(self) -> Tuple[bool, bool, bool, bool, bool, bool, bool]:
33963402 """
33973403 injection = "load_p" in self ._dict_inj or "prod_p" in self ._dict_inj
33983404 voltage = "prod_v" in self ._dict_inj
3399- if self .shunts_data_available :
3405+ if type ( self ) .shunts_data_available :
34003406 voltage = voltage or np .isfinite (self .shunt_p ).any ()
34013407 voltage = voltage or np .isfinite (self .shunt_q ).any ()
34023408 voltage = voltage or (self .shunt_bus != 0 ).any ()
0 commit comments