inverter_model = inverter_parameters['pvGInverter']['pvCommercial']['Manufacturer']
nominal_ac_voltage = float(inverter_parameters['pvGInverter']['TConverter']['VOutConv'])
nominal_ac_power = float(inverter_parameters['pvGInverter']['TConverter']['PNomConv']) * 1000
nominal_dc_voltage = float(inverter_parameters['pvGInverter']['TConverter']['VmppNom'])
nominal_dc_power = float(inverter_parameters['pvGInverter']['TConverter']['PMaxOUT']) * 1000
maximum_dc_voltage = float(inverter_parameters['pvGInverter']['TConverter']['VMPPMax'])
maximum_dc_current = float(inverter_parameters['pvGInverter']['TConverter']['IMaxDC'])
mppt_low = float(inverter_parameters['pvGInverter']['TConverter']['VMppMin'])
mppt_high = float(inverter_parameters['pvGInverter']['TConverter']['VMPPMax'])
pso = float(inverter_parameters['pvGInverter']['TConverter']['PSeuil'])
p_nt = 0 #float(inverter_parameters['pvGInverter']['Night_Loss'])
inverter_voltages = inverter_parameters['pvGInverter']['TConverter']['VNomEff'].split(",")
powerThreshold = float(inverter_parameters['pvGInverter']['TConverter']['PSeuil'])
# dc voltage at min, nom and max
dc_voltage = [[float(inverter_voltages[0])], [float(inverter_voltages[1])], [float(inverter_voltages[2])]]
# calculate dc power
inverter_power = float(inverter_parameters['pvGInverter']['TConverter']['PMaxOUT'])
inverter_eff_vmin = inverter_parameters['pvGInverter']['TConverter']['ProfilPIOV1']
inverter_eff_vnom = inverter_parameters['pvGInverter']['TConverter']['ProfilPIOV2']
inverter_eff_vmax = inverter_parameters['pvGInverter']['TConverter']['ProfilPIOV3']
p_ac_min = [
float(inverter_eff_vmin['Point_1'].split(",")[1]),
float(inverter_eff_vmin['Point_2'].split(",")[1]),
float(inverter_eff_vmin['Point_3'].split(",")[1]),
float(inverter_eff_vmin['Point_4'].split(",")[1]),
float(inverter_eff_vmin['Point_5'].split(",")[1]),
float(inverter_eff_vmin['Point_6'].split(",")[1]),
float(inverter_eff_vmin['Point_7'].split(",")[1]),
float(inverter_eff_vmin['Point_8'].split(",")[1]),
]
p_ac_nom = [
float(inverter_eff_vnom['Point_1'].split(",")[1]),
float(inverter_eff_vnom['Point_2'].split(",")[1]),
float(inverter_eff_vnom['Point_3'].split(",")[1]),
float(inverter_eff_vnom['Point_4'].split(",")[1]),
float(inverter_eff_vnom['Point_5'].split(",")[1]),
float(inverter_eff_vnom['Point_6'].split(",")[1]),
float(inverter_eff_vnom['Point_7'].split(",")[1]),
float(inverter_eff_vnom['Point_8'].split(",")[1]),
]
p_ac_max = [
float(inverter_eff_vmax['Point_1'].split(",")[1]),
float(inverter_eff_vmax['Point_2'].split(",")[1]),
float(inverter_eff_vmax['Point_3'].split(",")[1]),
float(inverter_eff_vmax['Point_4'].split(",")[1]),
float(inverter_eff_vmax['Point_5'].split(",")[1]),
float(inverter_eff_vmax['Point_6'].split(",")[1]),
float(inverter_eff_vmax['Point_7'].split(",")[1]),
float(inverter_eff_vmax['Point_8'].split(",")[1]),
]
p_dc_min = [
float(inverter_eff_vmin['Point_1'].split(",")[0]),
float(inverter_eff_vmin['Point_2'].split(",")[0]),
float(inverter_eff_vmin['Point_3'].split(",")[0]),
float(inverter_eff_vmin['Point_4'].split(",")[0]),
float(inverter_eff_vmin['Point_5'].split(",")[0]),
float(inverter_eff_vmin['Point_6'].split(",")[0]),
float(inverter_eff_vmin['Point_7'].split(",")[0]),
float(inverter_eff_vmin['Point_8'].split(",")[0]),
]
p_dc_nom = [
float(inverter_eff_vnom['Point_1'].split(",")[0]),
float(inverter_eff_vnom['Point_2'].split(",")[0]),
float(inverter_eff_vnom['Point_3'].split(",")[0]),
float(inverter_eff_vnom['Point_4'].split(",")[0]),
float(inverter_eff_vnom['Point_5'].split(",")[0]),
float(inverter_eff_vnom['Point_6'].split(",")[0]),
float(inverter_eff_vnom['Point_7'].split(",")[0]),
float(inverter_eff_vnom['Point_8'].split(",")[0]),
]
p_dc_max = [
float(inverter_eff_vmax['Point_1'].split(",")[0]),
float(inverter_eff_vmax['Point_2'].split(",")[0]),
float(inverter_eff_vmax['Point_3'].split(",")[0]),
float(inverter_eff_vmax['Point_4'].split(",")[0]),
float(inverter_eff_vmax['Point_5'].split(",")[0]),
float(inverter_eff_vmax['Point_6'].split(",")[0]),
float(inverter_eff_vmax['Point_7'].split(",")[0]),
float(inverter_eff_vmax['Point_8'].split(",")[0]),
]
ac_power = np.array(p_ac_min + p_ac_nom + p_ac_max)
dc_power = np.array(p_dc_min + p_dc_nom + p_dc_max)
# save all necessary inverter data to a dictionary
sandia_params = {
"ac_power": ac_power,
"dc_power": dc_power,
"dc_voltage": np.array(dc_voltage[0] * 8 + dc_voltage[1] * 8 + dc_voltage[2] * 8),
"dc_voltage_level": np.array(["Vmin"] * 8 + ["Vnom"] * 8 + ["Vmax"] * 8),
"p_ac_0": inverter_power,
"p_nt": p_nt
}
inv_sandia_params = pvlib.inverter.fit_sandia(
sandia_params['ac_power'],
sandia_params['dc_power'],
sandia_params['dc_voltage'],
sandia_params['dc_voltage_level'],
sandia_params['p_ac_0'],
sandia_params['p_nt']
)
inverter_data = {
"name" : inverter_model,
"Vac": nominal_ac_voltage,
"Paco": nominal_ac_power,
"Vdco": nominal_dc_voltage,
"Pdco": nominal_dc_power,
"C0": inv_sandia_params['C0'],
"C1": inv_sandia_params['C1'],
"C2": inv_sandia_params['C2'],
"C3": inv_sandia_params['C3'],
"Pso": pso,
"Pnt": p_nt,
"Vdcmax": maximum_dc_voltage,
"Idcmax": maximum_dc_current,
"Mppt_low": mppt_low,
"Mppt_high": mppt_high
}