 |
SimpleFOClibrary
2.1
|
Go to the documentation of this file.
13 shunt_resistor = _shunt_resistor;
15 volts_to_amps_ratio = 1.0 /_shunt_resistor / _gain;
17 gain_a = volts_to_amps_ratio;
18 gain_b = volts_to_amps_ratio;
19 gain_c = volts_to_amps_ratio;
30 void InlineCurrentSense::calibrateOffsets(){
36 for (
int i = 0; i < 1000; i++) {
43 offset_ia = offset_ia / 1000.0;
44 offset_ib = offset_ib / 1000.0;
45 if(
_isset(pinC)) offset_ic = offset_ic / 500.0;
79 for (
int i = 0; i < 100; i++) {
81 c.
a = c.
a*0.6 + 0.4*c1.
a;
82 c.
b = c.
b*0.6 + 0.4*c1.
b;
83 c.
c = c.
c*0.6 + 0.4*c1.
c;
88 float ab_ratio = fabs(c.
a / c.
b);
89 float ac_ratio = c.
c ? fabs(c.
a / c.
c) : 0;
92 }
else if( ab_ratio < 0.7 ){
99 }
else if(
_isset(pinC) && ac_ratio < 0.7 ){
116 for (
int i = 0; i < 100; i++) {
118 c.
a = c.
a*0.6 + 0.4*c1.
a;
119 c.
b = c.
b*0.6 + 0.4*c1.
b;
120 c.
c = c.
c*0.6 + 0.4*c1.
c;
124 float ba_ratio = fabs(c.
b/c.
a);
125 float bc_ratio = c.
c ? fabs(c.
b / c.
c) : 0;
126 if( ba_ratio > 1.5 ){
128 }
else if( ba_ratio < 0.7 ){
135 }
else if(
_isset(pinC) && bc_ratio < 0.7 ){
154 for (
int i = 0; i < 50; i++) {
156 c.
c = (c.
c+c1.
c)/50.0;
@ voltage
Torque control using voltage.
void _delay(unsigned long ms)
bool skip_align
variable signaling that the phase current direction should be verified during initFOC()
void _configureADC(const int pinA, const int pinB, const int pinC=NOT_SET)
virtual void setPwm(float Ua, float Ub, float Uc)=0
InlineCurrentSense(float shunt_resistor, float gain, int pinA, int pinB, int pinC=NOT_SET)
PhaseCurrent_s getPhaseCurrents() override
float _readADCVoltage(const int pinA)
int driverAlign(BLDCDriver *driver, float voltage) override
int driverSync(BLDCDriver *driver) override