#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 (double heating_power, double ambient_temperature, double duration) |
Updates motor temperature estimate. More... | |
bool | update (const ethercat_hardware::MotorTraceSample &sample, const ethercat_hardware::ActuatorInfo &actuator_info, double ambient_temperature, double duration) |
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 154 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 216 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 274 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 399 of file motor_heating_model.cpp.
|
inline |
Gets current winding temperature estimate (for testing)
Definition at line 190 of file motor_heating_model.h.
|
inline |
Gets current winding temperature estimate (for testing)
Definition at line 188 of file motor_heating_model.h.
|
inline |
Not thread save, should be called by same thread that calls update()
Definition at line 186 of file motor_heating_model.h.
bool ethercat_hardware::MotorHeatingModel::loadTemperatureState | ( | ) |
Load saved temperature estimate from directory.
Definition at line 557 of file motor_heating_model.cpp.
void ethercat_hardware::MotorHeatingModel::reset | ( | ) |
Resets motor overheat flag.
Definition at line 390 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 671 of file motor_heating_model.cpp.
bool ethercat_hardware::MotorHeatingModel::startTemperaturePublisher | ( | ) |
Definition at line 256 of file motor_heating_model.cpp.
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 311 of file motor_heating_model.cpp.
|
inline |
Definition at line 177 of file motor_heating_model.h.
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 363 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 339 of file motor_heating_model.cpp.
|
protected |
name of actuator (ex. fl_caster_rotation_motor)
Definition at line 297 of file motor_heating_model.h.
|
protected |
Last recorded ambient temperature : in Celcius.
Definition at line 277 of file motor_heating_model.h.
|
protected |
Sum of (abient heat * time) over last sample interval.
Definition at line 288 of file motor_heating_model.h.
|
protected |
Time (in seconds) since late sample interval occurred.
Definition at line 290 of file motor_heating_model.h.
|
protected |
Sum of heat energy for last sample interval.
Definition at line 286 of file motor_heating_model.h.
|
protected |
Temperature estimate of motor housing : in Celcius.
Definition at line 275 of file motor_heating_model.h.
|
protected |
Inverse of thermal mass for motor housing : in Joules/C.
Definition at line 269 of file motor_heating_model.h.
|
protected |
Thermal conductance between motor housing and ambient : in Watt/C.
Definition at line 265 of file motor_heating_model.h.
|
protected |
Hardware ID of device (ex. 680500501000)
Definition at line 299 of file motor_heating_model.h.
|
protected |
Definition at line 296 of file motor_heating_model.h.
|
protected |
mutex protects values updates by realtime thread and used by diagnostics thread
Definition at line 280 of file motor_heating_model.h.
|
protected |
True if most has overheat, once set, will only clear when reset() is called.
Definition at line 283 of file motor_heating_model.h.
|
protected |
Sample interval for trace (in seconds)
realtime publisher for MotorHeatingSample
Definition at line 294 of file motor_heating_model.h.
|
protected |
path to file where temperature data will be saved
Definition at line 298 of file motor_heating_model.h.
|
protected |
Temperature estimate of motor winding : in Celcius.
Definition at line 273 of file motor_heating_model.h.
|
protected |
Inverse of thermal mass for motor winding : in Joules/C.
Definition at line 267 of file motor_heating_model.h.
|
protected |
Thermal conductance between motor winding and housing : in Watt/C.
Definition at line 263 of file motor_heating_model.h.