rasProject_01 / weSweetHome
R. 240
process control / RasPi software by weinert-automation
|
Some functions for E-Car loading on a Raspberry Pi using pigpiod. More...
Macros | |
#define | CHS_CP_OFF_LEV |
loading off CP state (1: +12V, 0: -12V) | |
Functions | |
int | chsItoDutyC (float const ldCurrLim) |
Calculate CP dutycycle for current limit per phase. More... | |
void | initAsCPilot (int const thePi, unsigned const gpio, uint8_t init) |
Initialise a GPIO pin as pilot drive. More... | |
void | setChStControl (float const ldCurrLim) |
Control E-Car charging current limit per phase by PWM. More... | |
float | setChStLimit (float ldCurrLim) |
Set and get E-Car charging current limit per phase. More... | |
uint8_t | setChStNoPhases (uint8_t assumedNofPhases) |
Set and get charging E-Car's actual number of phases. More... | |
void | setCPilot (uint8_t set) |
Set CP signal to constant ON or OFF. More... | |
void | setCPilotPWM (int duty) |
Set CP signal PWM. More... | |
Some functions for E-Car loading on a Raspberry Pi using pigpiod.
Revision history
cross-compile by:
This is a supplementary library basic library to be used in conjunction with the pigpio library (link: -lpigpiod_if2 -lrt). For documentation see the include file weEcarLd.h and also http://abyz.me.uk/rpi/pigpio/pdif2.html by Joan NN.
void initAsCPilot | ( | int | thePi, |
unsigned | gpio, | ||
uint8_t | init | ||
) |
Initialise a GPIO pin as pilot drive.
This function initialises the GPIO pin like initAsHiDrive() and (additionally) sets the PWM frequency to 1kHz and the duty cyle range to 0..1000. The parameter init when 0 (FALSE) sets the CP output to -12V signalling EVSE being not ready. init when 1 (TRUE) sets the CP output to +12V signalling EVSE ready.
This function must be called before all other CP control functions, as it sets the CP's GPIO henceforth.
A value outside this range will turn the 1kHz CP signal off; see CHS_CP_OFF_LEV.
thePi | the Raspberry's identifier as got from initialising gpio(d) |
gpio | the GPIO number (0..53) |
init | 0: off (-12V) 1: on (+12V) |
void setCPilot | ( | uint8_t | set | ) |
Set CP signal to constant ON or OFF.
This function sets the CP either constant ON (+12V) or OFF (-12V). It will stop any 1kHz square wave.
set | 0: off (-12V) 1: on (+12V) |
void setCPilotPWM | ( | int | duty | ) |
Set CP signal PWM.
This function sets the CP duty cycle in the range 0..1000‰ applying offset (CHS_CP_OFFSET) and inversion (CHS_CP_INVERTED) if applicable.
Note: 50‰ (5%) signals the of a digital protocol (not implemented here).
The range for signalling current limit per phase is 10..970‰; see chsItoDutyC(float).
duty | dutycycle in ‰ (parts per mille) |
float setChStLimit | ( | float | ldCurrLim | ) |
Set and get E-Car charging current limit per phase.
This function sets the charging stations current limit in the range 6.0 ... CHS_CURRENT_LIM_MAX.
Note: This function just sets/changes the internal limit value. It will not influence any signal (CP) to the EVSE.
ldCurrLim | load current in A (per phase) |
int chsItoDutyC | ( | float | ldCurrLim | ) |
Calculate CP dutycycle for current limit per phase.
The IEC CP dutycycle(current) curve will be applied and the outcome limited to 100..970‰ resp. 6..80A per phase.
This function just implements the standard and its limits, that is without offsets or inversion in the CP signal handling. Those, if applicable will be handled by setCPilotPWM(int) and setChStControl(float).
ldCurrLim | the current limit |
void setChStControl | ( | float | ldCurrLim | ) |
Control E-Car charging current limit per phase by PWM.
This function sets the the control pilot (CP) PWM signal to the charging station.
This function should only be called with a current value within actual limits (6...32A, e.g.). It only limits the CP duty cycle to the range 10..97% corresponding to 6..80A.
ldCurrLim | current limit in A per phase |
uint8_t setChStNoPhases | ( | uint8_t | assumedNofPhases | ) |
Set and get charging E-Car's actual number of phases.
This function sets the (assumed) number of phases for E-Car AC charging in the range 1..CHS_MAX_PHASES. The default is CHS_BEG_PHASES.
The value set will be used to calculate and eventually limit the maximum loading power. The real number of phases depends on the car(s) connected.
Warning: There exist E-car types using only one phase even when offered three!
assumedNofPhases | number of phases 1.. CHS_MAX_PHASES |