Skip to content

Commit 1cd3479

Browse files
authored
Merge pull request #12 from Candas1/dev
Dev
2 parents 8442e43 + 186e5cf commit 1cd3479

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/BLDCMotor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ BLDCMotor::BLDCMotor(int pp, float _R, float _KV, float _inductance)
4646
// 1/sqrt(2) - rms value
4747
KV_rating = NOT_SET;
4848
if (_isset(_KV))
49-
KV_rating = _KV*_SQRT2;
49+
KV_rating = _KV;
5050
// save phase inductance
5151
phase_inductance = _inductance;
5252

@@ -396,7 +396,7 @@ void BLDCMotor::move(float new_target) {
396396
if(_isset(new_target)) target = new_target;
397397

398398
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
399-
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/KV_rating/_RPM_TO_RADS;
399+
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
400400
// estimate the motor current if phase reistance available and current_sense not available
401401
if(!current_sense && _isset(phase_resistance)) current.q = (voltage.q - voltage_bemf)/phase_resistance;
402402

src/StepperMotor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ StepperMotor::StepperMotor(int pp, float _R, float _KV, float _inductance)
1616
phase_resistance = _R;
1717
// save back emf constant KV = 1/K_bemf
1818
// usually used rms
19-
KV_rating = _KV*_SQRT2;
19+
KV_rating = _KV;
2020
// save phase inductance
2121
phase_inductance = _inductance;
2222

@@ -292,7 +292,7 @@ void StepperMotor::move(float new_target) {
292292
if(_isset(new_target) ) target = new_target;
293293

294294
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
295-
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/KV_rating/_RPM_TO_RADS;
295+
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
296296
// estimate the motor current if phase reistance available and current_sense not available
297297
if(!current_sense && _isset(phase_resistance)) current.q = (voltage.q - voltage_bemf)/phase_resistance;
298298

0 commit comments

Comments
 (0)