@@ -119,6 +119,7 @@ def __init__(self, configfile):
119119 )
120120
121121 self .load_profile = config ['consumption_forecast' ]['load_profile' ]
122+ self .solar_web_export = config ['consumption_forecast' ]['solar_web_export' ]
122123 try :
123124 annual_consumption = config ['consumption_forecast' ]['annual_consumption' ]
124125 except KeyError :
@@ -306,7 +307,7 @@ def load_config(self, configfile):
306307 if config ['inverter' ]['type' ] in VALID_INVERTERS :
307308 pass
308309 else :
309- raise RuntimeError ('Unkown inverter' )
310+ raise RuntimeError ('Unknown inverter type ' )
310311
311312 if config ['pvinstallations' ]:
312313 pass
@@ -323,12 +324,46 @@ def load_config(self, configfile):
323324 )
324325 config ['consumption_forecast' ]['load_profile' ] = 'default_load_profile.csv'
325326
327+ # Check if solar_web_export is provided and if the load_profile file does not exist
328+ if 'solar_web_export' in config ['consumption_forecast' ]:
329+ solar_web_export_path = 'config/' + config ['consumption_forecast' ][
330+ 'solar_web_export' ]
331+
332+ load_profile_path = config ['consumption_forecast' ]['load_profile' ]
333+
334+ if os .path .isfile (solar_web_export_path ) and not os .path .isfile (load_profile_path ):
335+ forecastconsumption .SolarWebExportProcessor (solar_web_export_path ,load_profile_path )
336+
326337 if not os .path .isfile (config ['consumption_forecast' ]['load_profile' ]):
327338 raise RuntimeError (
328339 "[Config] Specified Load Profile file " +
329340 f"'{ config ['consumption_forecast' ]['load_profile' ]} ' not found"
330341 )
331342
343+ try :
344+ config ['consumption_forecast' ]['solar_web_export' ] = 'config/' + \
345+ config ['consumption_forecast' ]['solar_web_export' ]
346+ except :
347+ logger .info (
348+ "[Config] No Solar Web Export provided." )
349+
350+ # # Check if the load profile exists
351+ # if not os.path.isfile(config['consumption_forecast']['solar_web_export']):
352+ # logger.info(f"[Config] Load profile '{self.load_profile}' not found.")
353+ # solar_web_export = config['consumption_forecast'].get('solar_web_export')
354+ # if solar_web_export and os.path.isfile(solar_web_export):
355+ # # Generate the load profile from Solar Web export
356+ # logger.info(
357+ # f"[Config] Generating load profile from Solar Web export: {solar_web_export}")
358+ # self.generate_load_profile_from_solar_web(solar_web_export, load_profile)
359+ # else:
360+ # raise RuntimeError(
361+ # f"[Config] No load profile found and no valid SolarWeb export file provided. "
362+ # f"Could not create '{load_profile}'"
363+ # )
364+ #
365+
366+
332367 try :
333368 tzstring = config ['timezone' ]
334369 except KeyError :
0 commit comments