Module: motorThermal¶
Executive Summary¶
Module that computes the motor temperature. It takes into account mechanical power efficiency, as well as friction, as sources of heat. There is also a dissipative term due to the temperature gradient between the motor and the air surrounding it.
Message Connection Descriptions¶
The following table lists all the module input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name 
Msg Type 
Description 

rwStateInMsg 
Input reaction wheel state message. It contains the mechanical torque, friction torque and wheel speed information to compute the mechanical power. 

temperatureOutMsg 
Output temperature message. 
Detailed Module Description¶
This module is a simulation environment module which simulates the temperature of a motor. Temperature is computed as a function of the net power to the motor and the motor’s heat capacity, which maps the net power to a temperature variation. The heat generation component is composed of two factors: mechanical power inefficiencies (loss through current, etc) and friction contributions. The mechanical power \(P_{mec}\) is given by:
where \(\Omega\) is the motor angular velocity and \(u_s\) represents the applied torque. Given the mechanical efficiency \(\eta\), we can convert mechanical power into thermal power as follows:
Similarly to the mechanical power, the friction dissipation is given by:
where \(\tau_f\) represents the friction torque. The absolute value of these two terms added together represents the thermal power generation. As for the power dissipation, we assume a temperature gradient between the motor and the surrounding environment. For simplicity, a constant ambient temperature is considered. The thermal power dissipation is calculated using the temperature difference between the motor and the environment, scaled by the ambient’s thermal resistance \(R_{ambient}\):
The subscript k in the temperature implies that it is the motor’s temperature at time k. For the final calculation, we need to convert power into heat. This is done through a simple Euler integration:
where \(Q\) represents the heat, \(P\) is the power and \(\Delta t\) is the integration time interval, which is the same as the simulation time step. Finally, the new motor temperature can be calculated using the temperature at the previous time step plus the net heat scaled by the motor’s heat capacity:
where, again, the k+1 subscript denotes the temperature at the next time step.
Tips for estimating \(C_{motor}\) and \(R_{ambient}\)¶
The motor’s heat capacity can be estimated from its mass and specific heat capacity:
The constant \(c\) is specific to each material. For example, steel has a specific heat capacity of 466 \(Jkg^{1}Celsius^{1}\). As for the ambient thermal resistance, it can be estimated using the following equation:
where \(A\) is the area where the heat is being dissipated (for example, the area of a cilinder) and \(h\) represents the convection coefficient, which for air should be around 100 \(Wm^{2}Celsius^{1}\).
Model Functions¶
The functions of the temperature model are:
Temperature Modelling: Simulates the motor’s temperature given previous temperature, motor characteristics and ambient conditions.
Model Assumptions and Limitations¶
This code makes the following assumptions:
Ambient temperature is constant: Ambient temperature is not affected by the motor’s temperature.
Ambient thermal resistance is constant: Ambient thermal resistance does not change with temperature, pressure, etc.
Motor heat capacity is constant: Motor heat capacity does not change with temperature.
User Guide¶
This section contains conceptual overviews of the code and clear examples for the prospective user.
Module Setup¶
The temperature module is created in python using:
1thermalModel = motorThermal.MotorThermal()
2thermalModel.ModelTag = 'rwThermals'
A sample setup is done using:
1thermalModel.currentTemperature = 40 # [Celsius]
2thermalModel.ambientTemperature = 20 # [Celsius]
3thermalModel.efficiency = 0.7
4thermalModel.ambientThermalResistance = 5 # Air Thermal Resistance
5thermalModel.motorHeatCapacity = 50 # Motor Heat Capacity

class MotorThermal : public SysModel¶
 #include <motorThermal.h>
Motor temperature module. It simulates the heating and cooling of a motor based on ambient temperature, as well as heat generated during spinup or breaking.
Public Functions

MotorThermal()¶
This is the constructor for the module class. It sets default variable values and initializes the various parts of the model

~MotorThermal()¶
Module Destructor.

void Reset(uint64_t CurrentSimNanos)¶
This method is used to reset the module.
 Returns
void

void UpdateState(uint64_t CurrentSimNanos)¶
This method is used to update the module.

void readInputMessages()¶
This method reads the reaction wheel state input message

void writeOutputMessages(uint64_t CurrentClock)¶
This method writes the motor temperature output state message.
 Parameters
CurrentClock – The clock time associated with the model call
 Returns
void

void computeTemperature(uint64_t CurrentSimNanos)¶
This method computes the reaction wheel temperature
Public Members

Message<TemperatureMsgPayload> temperatureOutMsg¶
[Celsius] temperature output message

ReadFunctor<RWConfigLogMsgPayload> rwStateInMsg¶
reaction wheel state input message

double efficiency¶
efficiency factor to convert power into mechanical power

double currentTemperature¶
[Celsius] stored temperature

double ambientTemperature¶
[Celsius] ambient temperature for heat dissipation

double ambientThermalResistance¶
[W/Celsius] ambient thermal resistance to convert heat into temperature

double motorHeatCapacity¶
[J/Celsius] motor heat caapcity to convert heat into temperature

BSKLogger bskLogger¶
BSK Logging
Private Members

TemperatureMsgPayload temperatureBuffer¶
temperature buffer for internal calculations

RWConfigLogMsgPayload rwStateBuffer¶
reaction wheel state buffer

uint64_t prevTime¶
Previous simulation time observed

MotorThermal()¶