Bar Logo Dual Active Bridge Development Board (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
pwrctrl_comm_interface.c
Go to the documentation of this file.
1
8#include "pwrctrl.h"
9
10
11
12
22
23
28void Dev_PwrCtrl_SetState(uint16_t reference)
29{
31
32 dab.State = reference;
33 //forcing change in SM state without proper context awareness can have dangerous glitches and consequences.
34 //switch off PWM signals for safe guard
35}
36
37
42void PwrCtrl_SetIReference(uint16_t reference)
43{
44 dab.Properties.IReference = reference;
45}
46
47
52void PwrCtrl_SetVSecReference(uint16_t reference)
53{
54 dab.Properties.VSecReference = reference;
55}
56
57
62void PwrCtrl_SetVPriReference(uint16_t reference)
63{
64 dab.Properties.VPriReference = reference;
65}
66
67
72void PwrCtrl_SetPwrReference(uint16_t reference)
73{
74 dab.Properties.PwrReference = reference;
75}
76
77
82void PwrCtrl_SetPeriodTarget(uint16_t reference)
83{
84 dab.Pwm.PBVPeriodTarget = reference;
85}
86
87
92void PwrCtrl_SetPhaseTarget(uint16_t reference)
93{
94 dab.Pwm.PBVControlPhaseTarget = reference;
95}
96
101void PwrCtrl_SetP2SPhaseTarget(uint16_t reference)
102{
103 dab.Pwm.ControlPhase_P2S_Target = reference;
104}
105
106
111void PwrCtrl_SetEnable(PWR_CTRL_CHARGE_STATE_t setVal)
112{
113 if(setVal) dab.Properties.Enable = true;
114 else dab.Properties.Enable = false;
115
116 if(dab.PowerDirection!=setVal)
117 {
118 if(dab.PowerDirection)//if converter running force stop before new mode
119 {
120 dab.Properties.Enable = false;
123 }
124 else //proceed with starting selected mode
125 {
126 if(setVal) dab.Properties.Enable = true;
127 else dab.Properties.Enable = false;
128 dab.PowerDirection = setVal;
129 }
130 }
131}
132
133
139{
140 return(dab.Data.ISensePrimary);
141}
142
143
149{
150 return(dab.Data.ISenseSecondary);
151}
152
153
159{
161}
162
163
169{
170 return(dab.Data.Temperature);
171}
172
173
179{
180 return(dab.Data.VRail_5V);
181}
182
183
189{
190 return(dab.Pwm.ControlPeriod);
191}
192
193
199{
200 return(dab.Pwm.ControlDutyCycle);
201}
202
203
209{
210 return(dab.State);
211}
212
213
219{
220 return(dab.PowerDirection);
221}
222
223
229{
230 return(dab.Status.value);
231}
232
233
240{
241 return(dab.Properties.Enable);
242}
243
244
250{
251 return(dab.Pwm.PBVPeriodTarget);
252}
253
254
260{
261 return(dab.Data.SecPower);
262}
263
269{
271}
272
278{
280}
281
282
288{
290}
POWER_CONTROL_t dab
Global data object for a DAB Converter.
Definition pwrctrl.c:28
AVERAGING_t iSecAveraging
Data Object of secondary current averaging.
AVERAGING_t vPrimAveraging
Data Object of primary voltage averaging.
AVERAGING_t vSecAveraging
Data Object of secondary voltage averaging.
void PwrCtrl_PWM_Disable(void)
Disable the PWM output.
uint16_t Dev_PwrCtrl_Get_State(void)
API function to get the current state of the state machine.
uint16_t Dev_PwrCtrl_GetAveraging_Isec(void)
API function to get the average value of the sampled ADC for secondary current.
uint16_t Dev_PwrCtrl_Get_PowerDir(void)
API function to get the direction of configure power flow.
uint16_t Dev_PwrCtrl_GetAveraging_Vsec(void)
API function to get the average value of the sampled ADC for secondary voltage.
void PwrCtrl_SetPwrReference(uint16_t reference)
API function to set the power controller reference.
uint16_t PwrCtrl_GetPhase_P2SDegree(void)
API function to set the power control State.
uint16_t PwrCtrl_GetAdc_Isec_avg(void)
API function to get the raw ADC value for secondary average current.
uint16_t PwrCtrl_GetAdc_Ipri_ct(void)
API function to get the raw ADC value for primary current transformer current.
uint16_t Dev_PwrCtrl_Get_Period(void)
API function to get the PWM period.
uint16_t Dev_PwrCtrl_GetAveraging_Vprim(void)
API function to get the average value of the sampled ADC for primary voltage.
void PwrCtrl_SetIReference(uint16_t reference)
API function to set the current controller reference.
void PwrCtrl_SetPeriodTarget(uint16_t reference)
API function to set the target period.
uint16_t Dev_PwrCtrl_Get_EnableFlag(void)
API function to get the state of the power control enable bit.
void PwrCtrl_SetP2SPhaseTarget(uint16_t reference)
API function to set the target prim to sec phase which will steer other modulation.
void PwrCtrl_SetVSecReference(uint16_t reference)
API function to set the secondary voltage controller reference.
uint16_t Dev_PwrCtrl_Get_Status(void)
API function to get the power control status.
uint16_t PwrCtrl_GetAdc_Isec_ct(void)
API function to get the raw ADC value for secondary current transformer current.
uint16_t PwrCtrl_GetAdc_Temperature(void)
API function to get the raw ADC value for temperature.
uint16_t Dev_PwrCtrl_Get_DutyCycle(void)
API function to get the PWM duty cycle.
void PwrCtrl_SetVPriReference(uint16_t reference)
API function to set the primary voltage controller reference, in reverse mode.
uint16_t Dev_PwrCtrl_Get_PwmprdTarget(void)
API function to get the PWM period target.
void PwrCtrl_SetEnable(PWR_CTRL_CHARGE_STATE_t setVal)
API function to set the power control state forward, reverse or stop.
void Dev_PwrCtrl_SetState(uint16_t reference)
API function to set the power control State.
void PwrCtrl_SetPhaseTarget(uint16_t reference)
API function to set the target PWM phase.
uint16_t PwrCtrl_GetAdc_Vrail_5V(void)
API function to get the raw ADC value for 5V rail.
uint16_t Dev_PwrCtrl_Get_SecPower(void)
API function to get the secondary power.
@ PWR_CTRL_STOP
uint16_t AverageValue
uint16_t ControlPhase_P2S_Target
Control phase value from control loop in degrees.
uint16_t ControlPeriod
Control period value from control loop.
uint16_t ControlPhase_P2S_Degreex10
Control phase value from control loop in 10 x degree, integer.
uint16_t ControlDutyCycle
Control Duty Cycle calculation based on Control Period.
uint16_t PBVPeriodTarget
Power Board Visualizer Set Control target.
uint16_t PBVControlPhaseTarget
Power Board Visualizer Set Control phase.
uint16_t ISecAverageRectified
Data value for average secondary current rectified.
uint16_t ISensePrimary
Data value for primary current as measured with CT.
int16_t SecPower
Data value for Secondary power (Watt)
uint16_t ISenseSecondary
Data value for secondary current as measured with CT.
uint16_t VRail_5V
Data value for 5V auxiliary rail.
uint16_t Temperature
Data value for temperature.
uint16_t PwrReference
User power reference setting used to control the converter controller.
bool Enable
Control Flag: When set, enables the converter triggering a startup sequence; When cleared,...
int16_t IReference
User current reference setting used to control the converter controller.
uint16_t VPriReference
User primary-voltage port reference setting used to control the power converter output voltage in boo...
uint16_t VSecReference
User secondary-voltage port reference setting used to control the power converter output voltage in b...
SWITCH_NODE_t Pwm
Switch node settings.
PWR_CTRL_PROPERTIES_t Properties
Power Control properties
PWR_CTRL_STATE_t State
Power Control SM State ID.
FEEDBACK_SETTINGS_t Data
Feedback channel settings.
PWR_CTRL_CHARGE_STATE_t PowerDirection
defines if the power converter is in charging or discharging mode
STATUS_FLAGS_t Status
Power Supply status flags, running or fault.