[docs]classWorkConnector:""" A class to handle transfer of work power. **Attributes**: W_dot : float, optional Work power in W. N : float, optional Speed in rpm. C : float, optional Torque in Nm. variables_input : list of lists A list of the variables used to define the work connector. Each entry is a list of [variable_name, value]. **Methods**: __init__(self): Initializes the WorkConnector object with. set_W_dot(self, value): Sets the work power and updates the list of known variables. set_N(self, value): Sets the speed and updates the list of known variables. set_C(self, value): Sets the torque and updates the list of known variables. print_resume(self): Print a summary of the work connector properties. """def__init__(self):self.variables_input=[]self.W_dot=None# Work power [W]self.w=None# Specific work [J/kg]self.N_rot=None# Speed [rpm]self.C=None# Torque [Nm]self.W_dot_el=None# Electrical power [W]defset_properties(self,**kwargs):forkey,valueinkwargs.items():ifkey=='W_dot':self.set_W_dot(value)elifkey=='w':self.set_w(value)elifkey=='N_rot':self.set_N_rot(value)elifkey=='C':self.set_C(value)elifkey=='W_dot_el':self.set_W_dot_el(value)else:warnings.warn(f"Error: Invalid property '{key}'")defcalculate_properties(self):passdefset_W_dot(self,value):self.W_dot=valueself.variables_input=self.variables_input+[['W_dot',value]]self.calculate_properties()defset_w(self,value):#Specific work [J/kg]self.w=valueself.variables_input=self.variables_input+[['w',value]]self.calculate_properties()defset_N_rot(self,value):self.N_rot=valueself.variables_input=self.variables_input+[['N_rot',value]]self.calculate_properties()defset_C(self,value):self.C=valueself.variables_input=self.variables_input+[['C',value]]self.calculate_properties()defset_W_dot_el(self,value):self.W_dot_el=valueself.variables_input=self.variables_input+[['W_dot_el',value]]self.calculate_properties()defprint_resume(self):""" Print a summary of the work connector properties """print("Work power: "+str(self.W_dot)+" [W]")print("Specific work: "+str(self.w)+" [J/kg]")print("Speed: "+str(self.N_rot)+" [rpm]")print("Torque: "+str(self.C)+" [Nm]")print("Electrical power: "+str(self.W_dot_el)+" [W]")