SimpleFOClibrary  2.1
InlineCurrentSense Class Reference

#include <InlineCurrentSense.h>

Inheritance diagram for InlineCurrentSense:
CurrentSense

Public Member Functions

 InlineCurrentSense (float shunt_resistor, float gain, int pinA, int pinB, int pinC=NOT_SET)
 
void init () override
 
PhaseCurrent_s getPhaseCurrents () override
 
int driverSync (BLDCDriver *driver) override
 
int driverAlign (BLDCDriver *driver, float voltage) override
 
- Public Member Functions inherited from CurrentSense
virtual float getDCCurrent (float angle_el=0)
 
DQCurrent_s getFOCCurrents (float angle_el)
 

Public Attributes

int gain_a
 phase A gain More...
 
int gain_b
 phase B gain More...
 
int gain_c
 phase C gain More...
 
- Public Attributes inherited from CurrentSense
bool skip_align = false
 variable signaling that the phase current direction should be verified during initFOC() More...
 

Detailed Description

Definition at line 11 of file InlineCurrentSense.h.

Constructor & Destructor Documentation

◆ InlineCurrentSense()

InlineCurrentSense::InlineCurrentSense ( float  shunt_resistor,
float  gain,
int  pinA,
int  pinB,
int  pinC = NOT_SET 
)

InlineCurrentSense class constructor

Parameters
shunt_resistorshunt resistor value
gaincurrent-sense op-amp gain
phAA phase adc pin
phBB phase adc pin
phCC phase adc pin (optional)

Definition at line 8 of file InlineCurrentSense.cpp.

Member Function Documentation

◆ driverAlign()

int InlineCurrentSense::driverAlign ( BLDCDriver driver,
float  voltage 
)
overridevirtual

Function intended to verify if:

  • phase current are oriented properly
  • if their order is the same as driver phases

This function corrects the alignment errors if possible ans if no such thing is needed it can be left empty (return 1)

Returns
- 0 - for failure & positive number (with status) - for success

Implements CurrentSense.

Definition at line 70 of file InlineCurrentSense.cpp.

◆ driverSync()

int InlineCurrentSense::driverSync ( BLDCDriver driver)
overridevirtual

Function intended to implement all that is needed to sync and current sensing with the driver. If no such thing is needed it can be left empty (return 1)

Returns
- 0 - for failure & 1 - for success

Implements CurrentSense.

Definition at line 58 of file InlineCurrentSense.cpp.

◆ getPhaseCurrents()

PhaseCurrent_s InlineCurrentSense::getPhaseCurrents ( )
overridevirtual

Function rading the phase currents a, b and c This function will be used with the foc control throught the function CurrentSense::getFOCCurrents(electrical_angle)

  • it returns current c equal to 0 if only two phase measurements available
Returns
PhaseCurrent_s current values

Implements CurrentSense.

Definition at line 49 of file InlineCurrentSense.cpp.

◆ init()

void InlineCurrentSense::init ( )
overridevirtual

Function intialising the CurrentSense class All the necessary intialisations of adc and sync should be implemented here

Implements CurrentSense.

Definition at line 23 of file InlineCurrentSense.cpp.

Member Data Documentation

◆ gain_a

int InlineCurrentSense::gain_a

phase A gain

Definition at line 32 of file InlineCurrentSense.h.

◆ gain_b

int InlineCurrentSense::gain_b

phase B gain

Definition at line 33 of file InlineCurrentSense.h.

◆ gain_c

int InlineCurrentSense::gain_c

phase C gain

Definition at line 34 of file InlineCurrentSense.h.


The documentation for this class was generated from the following files: