#include <motor_heating_model.h>
Public Member Functions | |
double | calculateMotorHeatPower (const ethercat_hardware::MotorTraceSample &sample, const ethercat_hardware::ActuatorInfo &actuator_info) |
void | diagnostics (diagnostic_updater::DiagnosticStatusWrapper &d) |
Appends heating diagnostic data to status wrapper. More... | |
double | getHousingTemperature () |
Gets current winding temperature estimate (for testing) More... | |
double | getWindingTemperature () |
Gets current winding temperature estimate (for testing) More... | |
bool | hasOverheated () const |
Not thread save, should be called by same thread that calls update() More... | |
bool | loadTemperatureState () |
Load saved temperature estimate from directory. More... | |
MotorHeatingModel (const MotorHeatingModelParameters &motor_params, const std::string &actuator_name, const std::string &hwid, const std::string &save_directory) | |
Constructor. More... | |
void | reset () |
Resets motor overheat flag. More... | |
bool | saveTemperatureState () |
bool | startTemperaturePublisher () |
bool | update (const ethercat_hardware::MotorTraceSample &sample, const ethercat_hardware::ActuatorInfo &actuator_info, double ambient_temperature, double duration) |
bool | update (double heating_power, double ambient_temperature, double duration) |
Updates motor temperature estimate. More... | |
void | updateFromDowntime (double downtime, double saved_ambient_temperature) |
Updates estimated motor temperature for long period of off-time. More... | |
double | updateFromDowntimeWithInterval (double downtime, double saved_ambient_temperature, double interval, unsigned cycles) |
Updates estimated motor temperature for certain amount of downtime. More... | |
Protected Attributes | |
std::string | actuator_name_ |
name of actuator (ex. fl_caster_rotation_motor) More... | |
double | ambient_temperature_ |
Last recorded ambient temperature : in Celcius. More... | |
double | ambient_temperature_sum_ |
Sum of (abient heat * time) over last sample interval. More... | |
double | duration_since_last_sample_ |
Time (in seconds) since late sample interval occurred. More... | |
double | heating_energy_sum_ |
Sum of heat energy for last sample interval. More... | |
double | housing_temperature_ |
Temperature estimate of motor housing : in Celcius. More... | |
double | housing_thermal_mass_inverse_ |
Inverse of thermal mass for motor housing : in Joules/C. More... | |
double | housing_to_ambient_thermal_conductance_ |
Thermal conductance between motor housing and ambient : in Watt/C. More... | |
std::string | hwid_ |
Hardware ID of device (ex. 680500501000) More... | |
MotorHeatingModelParameters | motor_params_ |
boost::mutex | mutex_ |
mutex protects values updates by realtime thread and used by diagnostics thread More... | |
bool | overheat_ |
True if most has overheat, once set, will only clear when reset() is called. More... | |
realtime_tools::RealtimePublisher< ethercat_hardware::MotorTemperature > * | publisher_ |
Sample interval for trace (in seconds) More... | |
std::string | save_filename_ |
path to file where temperature data will be saved More... | |
double | winding_temperature_ |
Temperature estimate of motor winding : in Celcius. More... | |
double | winding_thermal_mass_inverse_ |
Inverse of thermal mass for motor winding : in Joules/C. More... | |
double | winding_to_housing_thermal_conductance_ |
Thermal conductance between motor winding and housing : in Watt/C. More... | |
Definition at line 186 of file motor_heating_model.h.
ethercat_hardware::MotorHeatingModel::MotorHeatingModel | ( | const MotorHeatingModelParameters & | motor_params, |
const std::string & | actuator_name, | ||
const std::string & | hwid, | ||
const std::string & | save_directory | ||
) |
Constructor.
motor_params | Heating parameters used by motor heating model |
actuator_name | Name of actuator (ex: fl_caster_roataion_motor) |
save_directory | Directory where motor temperature will be routinely saved |
device_position | Position of device on EtherCAT chain. Used to prevent multiple motor models from saving at same time |
Definition at line 248 of file motor_heating_model.cpp.
double ethercat_hardware::MotorHeatingModel::calculateMotorHeatPower | ( | const ethercat_hardware::MotorTraceSample & | sample, |
const ethercat_hardware::ActuatorInfo & | actuator_info | ||
) |
Determines power being put into motor as heat (in Watts)
Definition at line 306 of file motor_heating_model.cpp.
void ethercat_hardware::MotorHeatingModel::diagnostics | ( | diagnostic_updater::DiagnosticStatusWrapper & | d | ) |
Appends heating diagnostic data to status wrapper.
Definition at line 431 of file motor_heating_model.cpp.
|
inline |
Gets current winding temperature estimate (for testing)
Definition at line 222 of file motor_heating_model.h.
|
inline |
Gets current winding temperature estimate (for testing)
Definition at line 220 of file motor_heating_model.h.
|
inline |
Not thread save, should be called by same thread that calls update()
Definition at line 218 of file motor_heating_model.h.
bool ethercat_hardware::MotorHeatingModel::loadTemperatureState | ( | ) |
Load saved temperature estimate from directory.
Definition at line 589 of file motor_heating_model.cpp.
void ethercat_hardware::MotorHeatingModel::reset | ( | ) |
Resets motor overheat flag.
Definition at line 422 of file motor_heating_model.cpp.
bool ethercat_hardware::MotorHeatingModel::saveTemperatureState | ( | ) |
Saves current temperature estimate to file given directory.
Filename will be named : <actuator_name>_motor_temp Update of file should be atomic.
Definition at line 703 of file motor_heating_model.cpp.
bool ethercat_hardware::MotorHeatingModel::startTemperaturePublisher | ( | ) |
Definition at line 288 of file motor_heating_model.cpp.
|
inline |
Definition at line 209 of file motor_heating_model.h.
bool ethercat_hardware::MotorHeatingModel::update | ( | double | heating_power, |
double | ambient_temperature, | ||
double | duration | ||
) |
Updates motor temperature estimate.
This uses motor data to determine how much heat power was put into motor over last control cycle. The control cycle is assumed to be relatively short so the update is done as a linear estimation of differential equation
Returns true if motor winding temperature is below acceptable limit, false if motor has overheated and halting enabled.
Definition at line 343 of file motor_heating_model.cpp.
void ethercat_hardware::MotorHeatingModel::updateFromDowntime | ( | double | downtime, |
double | saved_ambient_temperature | ||
) |
Updates estimated motor temperature for long period of off-time.
Between runs of this program the motor temperature estimate is stored to a file. When the program is run again this saved temperature estimate needs to be updated base on time between runs.
This function makes the assumption that no power was being put into motor between runs.
Because the motor may have been disabled for a long time, this function does not always use a interative approach to calculate new temperature
Definition at line 395 of file motor_heating_model.cpp.
double ethercat_hardware::MotorHeatingModel::updateFromDowntimeWithInterval | ( | double | downtime, |
double | saved_ambient_temperature, | ||
double | interval, | ||
unsigned | cycles | ||
) |
Updates estimated motor temperature for certain amount of downtime.
Runs motor temperture simulation with a certain step interval and for a given number of cycles. Will stop early if downtime reaches 0.
Returns remaining downtime
Definition at line 371 of file motor_heating_model.cpp.
|
protected |
name of actuator (ex. fl_caster_rotation_motor)
Definition at line 329 of file motor_heating_model.h.
|
protected |
Last recorded ambient temperature : in Celcius.
Definition at line 309 of file motor_heating_model.h.
|
protected |
Sum of (abient heat * time) over last sample interval.
Definition at line 320 of file motor_heating_model.h.
|
protected |
Time (in seconds) since late sample interval occurred.
Definition at line 322 of file motor_heating_model.h.
|
protected |
Sum of heat energy for last sample interval.
Definition at line 318 of file motor_heating_model.h.
|
protected |
Temperature estimate of motor housing : in Celcius.
Definition at line 307 of file motor_heating_model.h.
|
protected |
Inverse of thermal mass for motor housing : in Joules/C.
Definition at line 301 of file motor_heating_model.h.
|
protected |
Thermal conductance between motor housing and ambient : in Watt/C.
Definition at line 297 of file motor_heating_model.h.
|
protected |
Hardware ID of device (ex. 680500501000)
Definition at line 331 of file motor_heating_model.h.
|
protected |
Definition at line 328 of file motor_heating_model.h.
|
protected |
mutex protects values updates by realtime thread and used by diagnostics thread
Definition at line 312 of file motor_heating_model.h.
|
protected |
True if most has overheat, once set, will only clear when reset() is called.
Definition at line 315 of file motor_heating_model.h.
|
protected |
Sample interval for trace (in seconds)
realtime publisher for MotorHeatingSample
Definition at line 326 of file motor_heating_model.h.
|
protected |
path to file where temperature data will be saved
Definition at line 330 of file motor_heating_model.h.
|
protected |
Temperature estimate of motor winding : in Celcius.
Definition at line 305 of file motor_heating_model.h.
|
protected |
Inverse of thermal mass for motor winding : in Joules/C.
Definition at line 299 of file motor_heating_model.h.
|
protected |
Thermal conductance between motor winding and housing : in Watt/C.
Definition at line 295 of file motor_heating_model.h.