[docs]classHeatConnector:""" A class to handle transfer of heat power. **Attributes**: Q_dot : float, optional Heat power in W. T_hot : float, optional Hot temperature in K. T_cold : float, optional Cold temperature in K. variables_input : list of lists A list of the variables used to define the heat connector. Each entry is a list of [variable_name, value]. **Methods**: __init__(self): Initializes the HeatConnector object with. set_Q_dot(self, value): Sets the heat power and updates the list of known variables. set_T_hot(self, value): Sets the hot temperature of the heat transfer and updates the list of known variables. set_T_cold(self, value): Sets the cold temperature of the heat transfer and updates the list of known variables. print_resume(self): Print a summary of the heat connector properties. """def__init__(self):self.variables_input=[]# List of the variables used to define the heat connector. Each entry is a list of [variable_name, value].self.Q_dot=None# Heat power [W]self.T_hot=None# Hot temperature [K]self.T_cold=None# Cold temperature [K]self.T_amb=None# Ambient temperature [K]defset_properties(self,**kwargs):print("heat connector:",kwargs)forkey,valueinkwargs.items():ifkey=='Q_dot':self.set_Q_dot(value)elifkey=='T_hot':self.set_T_hot(value)elifkey=='T_cold':self.set_T_cold(value)elifkey=='T_amb':self.set_T_amb(value)else:warnings.warn(f"Error: Invalid property '{key}'")defcalculate_properties(self):passdefset_Q_dot(self,value):self.Q_dot=valueself.variables_input=self.variables_input+[['Q_dot',value]]self.calculate_properties()defset_T_hot(self,value):ifself.T_hot!=None:# If the temperature is already known, update the value and the corresponding variable in the listself.T_hot=valuefori,varinenumerate(self.variables_input):ifvar[0]=='T_hot':self.variables_input[i][1]=valuebreakelse:# If the temperature is not known, set the value and add the variable to the listself.T_hot=valueself.variables_input=self.variables_input+[['T_hot',value]]self.calculate_properties()defset_T_cold(self,value):ifself.T_cold!=None:# If the temperature is already known, update the value and the corresponding variable in the listself.T_cold=valuefori,varinenumerate(self.variables_input):ifvar[0]=='T_cold':self.variables_input[i][1]=valuebreakelse:# If the temperature is not known, set the value and add the variable to the listself.T_cold=valueself.variables_input=self.variables_input+[['T_cold',value]]self.calculate_properties()defset_T_amb(self,value):ifself.T_amb!=None:# If the temperature is already known, update the value and the corresponding variable in the listself.T_amb=valuefori,varinenumerate(self.variables_input):ifvar[0]=='T_amb':self.variables_input[i][1]=valuebreakelse:# If the temperature is not known, set the value and add the variable to the listself.T_amb=valueself.variables_input=self.variables_input+[['T_amb',value]]self.calculate_properties()defprint_resume(self):""" Print a summary of the heat connector properties """print("Heat power: "+str(self.Q_dot)+" [W]")