@@ -115,40 +115,35 @@ def real_battery_capacity(self) -> float | None:
115115 and self .__custom_battery_capacity > 0
116116 ):
117117 return float (self .__custom_battery_capacity )
118+
119+ result : float | None = None
120+
118121 if self .series .startswith ("EH32" ):
119- return self .__mg4_real_battery_capacity ()
120- if self .series .startswith ("EP2" ):
121- return self .__mg5_real_battery_capacity ()
122- # Model: MG ZS EV 2021
123- if self .series .startswith ("ZS EV" ):
124- return self .__zs_ev_real_battery_capacity ()
125- LOG .warning (
126- f"Unknown battery capacity for car series='{ self .series } ' and model='{ self .model } '. "
127- "Please file an issue to improve data accuracy"
128- )
129- return None
122+ result = self .__mg4_real_battery_capacity
123+ elif self .series .startswith ("EP2" ):
124+ result = self .__mg5_real_battery_capacity
125+ elif self .series .startswith ("ZS EV" ):
126+ result = self .__zs_ev_real_battery_capacity
127+
128+ if result is None :
129+ LOG .warning (
130+ f"Unknown battery capacity for car series='{ self .series } ', model='{ self .model } ', "
131+ f"supports_target_soc={ self .supports_target_soc } . Please file an issue to improve data accuracy"
132+ )
133+ return result
130134
135+ @property
131136 def __mg4_real_battery_capacity (self ) -> float | None :
132- # MG4 high trim level
133- if self .series .startswith ("EH32 S" ):
134- if self .model .startswith ("EH32 X3" ):
135- # MG4 Trophy Extended Range
136- return 77.0
137- if self .supports_target_soc :
138- # MG4 high trim level with NMC battery
139- return 64.0
140- # MG4 High trim level with LFP battery
141- return 51.0
142- # MG4 low trim level
143- # Note: EH32 X/ is used for the 2023 MY with both NMC and LFP batter chem
144- if self .series .startswith ("EH32 L" ):
145- if self .supports_target_soc :
146- # MG4 low trim level with NMC battery
147- return 64.0
148- # MG4 low trim level with LFP battery
149- return 51.0
150- return None
137+ # MG4 Trophy Extended Range
138+ if self .model .startswith ("EH32 X3" ):
139+ return 77.0
140+ if self .supports_target_soc :
141+ # MG4 with NMC battery
142+ return 64.0
143+ # MG4 with LFP battery
144+ return 51.0
151145
146+ @property
152147 def __mg5_real_battery_capacity (self ) -> float | None :
153148 # Model: MG5 Electric, variant MG5 SR Comfort
154149 if self .series .startswith ("EP2CP3" ):
@@ -158,7 +153,9 @@ def __mg5_real_battery_capacity(self) -> float | None:
158153 return 61.1
159154 return None
160155
156+ @property
161157 def __zs_ev_real_battery_capacity (self ) -> float | None :
158+ # Model: MG ZS EV 2021
162159 if self .supports_target_soc :
163160 # Long Range with NMC battery
164161 return 68.3
0 commit comments