@@ -478,26 +478,36 @@ def convert_to_dto(scenario: Scenario):
478478 efficiencies = []
479479 inflow_direction = []
480480 # TODO: make sure the length is equal to the number of timesteps
481- for energy_vector in ["Electricity" , "Heat" ]:
482- if energy_vector in input_mapping :
483- # TODO get the case where get fails
484- inflow_direction .append (
485- input_connection .get (bus__type = energy_vector ).bus .name
486- )
487- if isinstance (cop , list ):
488- efficiency = (
489- (1 / np .array (cop )).tolist ()
490- if energy_vector == "Electricity"
491- else (1 - 1 / np .array (cop )).tolist ()
492- )
493- else :
494- efficiency = (
495- (1 / cop )
496- if energy_vector == "Electricity"
497- else (1 - 1 / cop )
481+ if len (input_mapping ) == 1 :
482+ # in MVS the coefficient are applied to the output bus and not the input bus
483+ # so for one unit electricity there should be "COP" unit of heat
484+ if isinstance (cop , list ):
485+ efficiency = np .array (cop ).tolist ()
486+ else :
487+ efficiency = cop
488+ inflow_direction = input_mapping
489+ efficiencies .append (efficiency )
490+ else :
491+ for energy_vector in ["Electricity" , "Heat" ]:
492+ if energy_vector in input_mapping :
493+ # TODO get the case where get fails
494+ inflow_direction .append (
495+ input_connection .get (bus__type = energy_vector ).bus .name
498496 )
499-
500- efficiencies .append (efficiency )
497+ if isinstance (cop , list ):
498+ efficiency = (
499+ (1 / np .array (cop )).tolist ()
500+ if energy_vector == "Electricity"
501+ else (1 - 1 / np .array (cop )).tolist ()
502+ )
503+ else :
504+ efficiency = (
505+ (1 / cop )
506+ if energy_vector == "Electricity"
507+ else (1 - 1 / cop )
508+ )
509+
510+ efficiencies .append (efficiency )
501511
502512 if len (efficiencies ) == 0 :
503513 print ("ERROR, a heat pump should at least have one electrical input!" )
0 commit comments