mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 02:51:47 +02:00
Fix oversights in modeling functions
This commit is contained in:
parent
ff80ebe4db
commit
62d4c6bdb0
@ -136,3 +136,15 @@ uint16_t LightDetection::readDLPT(photoTransistors sensor){
|
|||||||
digitalWrite(DL_PT_ENABLE,LOW);
|
digitalWrite(DL_PT_ENABLE,LOW);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
float LightDetection::modelCurrentConsumption(photoTransistors sensor){
|
||||||
|
if(sensor == DL_FRONT || sensor == DL_BOTTOM){
|
||||||
|
return PowerParameters::CurrentConsumptions::CURRENT_PT * 2;
|
||||||
|
} else {
|
||||||
|
return PowerParameters::CurrentConsumptions::CURRENT_PT * 4;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
float LightDetection::modelChargeConsumptionOn(photoTransistors sensor, uint16_t durationMs) {
|
||||||
|
return LightDetection::modelCurrentConsumption(sensor) * durationMs * 10e6;
|
||||||
|
}
|
@ -84,15 +84,16 @@ public:
|
|||||||
*
|
*
|
||||||
* @return float the current consumption of the PTs
|
* @return float the current consumption of the PTs
|
||||||
*/
|
*/
|
||||||
static float modelCurrentConsumption(void);
|
static float modelCurrentConsumption(photoTransistors sensor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Estimate the energy consumption of setting the specified led to
|
* @brief Estimate the energy consumption of enabling the selected PT for
|
||||||
* the passed color
|
* the given duration
|
||||||
* @param durationMs time the led will be on
|
* @param durationMs time the led will be on
|
||||||
* @return consumed energy in coloumbs
|
* @return consumed energy in coloumbs
|
||||||
*/
|
*/
|
||||||
float modelChargeConsumptionOn(uint16_t durationMs);
|
static float modelChargeConsumptionOn(photoTransistors sensor,
|
||||||
|
uint16_t durationMs);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const uint8_t IR_PT_FRONT_ADC = 3;
|
static const uint8_t IR_PT_FRONT_ADC = 3;
|
||||||
|
@ -71,7 +71,7 @@ class Motor{
|
|||||||
* @param durationMs time the display will be on
|
* @param durationMs time the display will be on
|
||||||
* @return consumed energy in coloumbs
|
* @return consumed energy in coloumbs
|
||||||
*/
|
*/
|
||||||
float modelChargeConsumptionOn(uint16_t duty, uint16_t durationMs);
|
float modelChargeConsumption(uint16_t duty, uint16_t durationMs);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -68,11 +68,11 @@ bool Motor::setSpeed(uint16_t duty) {
|
|||||||
|
|
||||||
uint16_t Motor::getSpeed(void) { return this->duty; };
|
uint16_t Motor::getSpeed(void) { return this->duty; };
|
||||||
|
|
||||||
float modelCurrentConsumption(uint16_t duty) {
|
float Motor::modelCurrentConsumption(uint16_t duty) {
|
||||||
const float dutyFactor = duty / static_cast<float>(1 << DUTY_RES);
|
const float dutyFactor = duty / static_cast<float>(1 << DUTY_RES);
|
||||||
return PowerParameters::CurrentConsumptions::CURRENT_MOTOR_T_ON * dutyFactor;
|
return PowerParameters::CurrentConsumptions::CURRENT_MOTOR_T_ON * dutyFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
float modelChargeConsumptionOn(uint16_t duty, uint16_t durationMs) {
|
float Motor::modelChargeConsumption(uint16_t duty, uint16_t durationMs) {
|
||||||
return modelCurrentConsumption(duty) * durationMs * 10e6;
|
return modelCurrentConsumption(duty) * durationMs * 10e6;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user