#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. | |
double | getHousingTemperature () |
Gets current winding temperature estimate (for testing) | |
double | getWindingTemperature () |
Gets current winding temperature estimate (for testing) | |
bool | hasOverheated () const |
Not thread save, should be called by same thread that calls update() | |
bool | loadTemperatureState () |
Load saved temperature estimate from directory. | |
MotorHeatingModel (const MotorHeatingModelParameters &motor_params, const std::string &actuator_name, const std::string &hwid, const std::string &save_directory) | |
Constructor. | |
void | reset () |
Resets motor overheat flag. | |
bool | saveTemperatureState () |
bool | startTemperaturePublisher () |
bool | update (double heating_power, double ambient_temperature, double duration) |
Updates motor temperature estimate. | |
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. | |
double | updateFromDowntimeWithInterval (double downtime, double saved_ambient_temperature, double interval, unsigned cycles) |
Updates estimated motor temperature for certain amount of downtime. | |
Protected Attributes | |
std::string | actuator_name_ |
name of actuator (ex. fl_caster_rotation_motor) | |
double | ambient_temperature_ |
Last recorded ambient temperature : in Celcius. | |
double | ambient_temperature_sum_ |
Sum of (abient heat * time) over last sample interval. | |
double | duration_since_last_sample_ |
Time (in seconds) since late sample interval occurred. | |
double | heating_energy_sum_ |
Sum of heat energy for last sample interval. | |
double | housing_temperature_ |
Temperature estimate of motor housing : in Celcius. | |
double | housing_thermal_mass_inverse_ |
Inverse of thermal mass for motor housing : in Joules/C. | |
double | housing_to_ambient_thermal_conductance_ |
Thermal conductance between motor housing and ambient : in Watt/C. | |
std::string | hwid_ |
Hardware ID of device (ex. 680500501000) | |
MotorHeatingModelParameters | motor_params_ |
boost::mutex | mutex_ |
mutex protects values updates by realtime thread and used by diagnostics thread | |
bool | overheat_ |
True if most has overheat, once set, will only clear when reset() is called. | |
realtime_tools::RealtimePublisher < ethercat_hardware::MotorTemperature > * | publisher_ |
Sample interval for trace (in seconds) | |
std::string | save_filename_ |
path to file where temperature data will be saved | |
double | winding_temperature_ |
Temperature estimate of motor winding : in Celcius. | |
double | winding_thermal_mass_inverse_ |
Inverse of thermal mass for motor winding : in Joules/C. | |
double | winding_to_housing_thermal_conductance_ |
Thermal conductance between motor winding and housing : in Watt/C. |
Definition at line 153 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 214 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 272 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 397 of file motor_heating_model.cpp.
double ethercat_hardware::MotorHeatingModel::getHousingTemperature | ( | ) | [inline] |
Gets current winding temperature estimate (for testing)
Definition at line 189 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::getWindingTemperature | ( | ) | [inline] |
Gets current winding temperature estimate (for testing)
Definition at line 187 of file motor_heating_model.h.
bool ethercat_hardware::MotorHeatingModel::hasOverheated | ( | ) | const [inline] |
Not thread save, should be called by same thread that calls update()
Definition at line 185 of file motor_heating_model.h.
Load saved temperature estimate from directory.
Definition at line 555 of file motor_heating_model.cpp.
Resets motor overheat flag.
Definition at line 388 of file motor_heating_model.cpp.
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 669 of file motor_heating_model.cpp.
Definition at line 254 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 309 of file motor_heating_model.cpp.
bool ethercat_hardware::MotorHeatingModel::update | ( | const ethercat_hardware::MotorTraceSample & | sample, |
const ethercat_hardware::ActuatorInfo & | actuator_info, | ||
double | ambient_temperature, | ||
double | duration | ||
) | [inline] |
Definition at line 176 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 361 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 337 of file motor_heating_model.cpp.
std::string ethercat_hardware::MotorHeatingModel::actuator_name_ [protected] |
name of actuator (ex. fl_caster_rotation_motor)
Definition at line 296 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::ambient_temperature_ [protected] |
Last recorded ambient temperature : in Celcius.
Definition at line 276 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::ambient_temperature_sum_ [protected] |
Sum of (abient heat * time) over last sample interval.
Definition at line 287 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::duration_since_last_sample_ [protected] |
Time (in seconds) since late sample interval occurred.
Definition at line 289 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::heating_energy_sum_ [protected] |
Sum of heat energy for last sample interval.
Definition at line 285 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::housing_temperature_ [protected] |
Temperature estimate of motor housing : in Celcius.
Definition at line 274 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::housing_thermal_mass_inverse_ [protected] |
Inverse of thermal mass for motor housing : in Joules/C.
Definition at line 268 of file motor_heating_model.h.
Thermal conductance between motor housing and ambient : in Watt/C.
Definition at line 264 of file motor_heating_model.h.
std::string ethercat_hardware::MotorHeatingModel::hwid_ [protected] |
Hardware ID of device (ex. 680500501000)
Definition at line 298 of file motor_heating_model.h.
Definition at line 295 of file motor_heating_model.h.
boost::mutex ethercat_hardware::MotorHeatingModel::mutex_ [protected] |
mutex protects values updates by realtime thread and used by diagnostics thread
Definition at line 279 of file motor_heating_model.h.
bool ethercat_hardware::MotorHeatingModel::overheat_ [protected] |
True if most has overheat, once set, will only clear when reset() is called.
Definition at line 282 of file motor_heating_model.h.
realtime_tools::RealtimePublisher<ethercat_hardware::MotorTemperature>* ethercat_hardware::MotorHeatingModel::publisher_ [protected] |
Sample interval for trace (in seconds)
realtime publisher for MotorHeatingSample
Definition at line 293 of file motor_heating_model.h.
std::string ethercat_hardware::MotorHeatingModel::save_filename_ [protected] |
path to file where temperature data will be saved
Definition at line 297 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::winding_temperature_ [protected] |
Temperature estimate of motor winding : in Celcius.
Definition at line 272 of file motor_heating_model.h.
double ethercat_hardware::MotorHeatingModel::winding_thermal_mass_inverse_ [protected] |
Inverse of thermal mass for motor winding : in Joules/C.
Definition at line 266 of file motor_heating_model.h.
Thermal conductance between motor winding and housing : in Watt/C.
Definition at line 262 of file motor_heating_model.h.