Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
pwrctrl_typedef.h
1
7#ifndef DEV_PWRCTRL_TYPEDEF_H
8#define DEV_PWRCTRL_TYPEDEF_H
9
10#include "fault/fault_typedef.h"
11
12
27typedef enum PWR_CTRL_STATES_e PWR_CTRL_STATE_t;
28
29
49typedef struct SWITCH_NODE_s SWITCH_NODE_t;
50
51
59{
60 uint16_t VInVoltage;
61 uint16_t VOutVoltage;
62 uint16_t VCapVoltage;
63
64 uint16_t ISensePrimary;
66
67 uint16_t ISenseSecondary;
68 uint16_t ISecAverage;
71
72 int16_t SecPower;
73
74 uint16_t Temperature;
75 uint16_t VRail_5V;
76
77 uint16_t Channel_AN15;
78};
80
81
89 union {
90 struct {
91 unsigned Running : 1;
92 unsigned FaultActive : 1;
93 unsigned notUsed : 13;
94 } __attribute__((packed)) bits;
95 uint16_t value;
96 };
97};
98typedef struct STATUS_FLAGS_s STATUS_FLAGS_t;
99
100
108{
109 uint16_t Counter;
110 uint16_t Delay;
111 uint16_t StepSize;
112 uint16_t* ptrReference;
115};
116typedef struct START_UP_RAMP_s START_UP_RAMP_t;
117
118
119
128{
129 int16_t Reference;
130 uint16_t Feedback;
131 uint16_t Output;
132 int16_t AgcFactor;
133 bool Enable;
134};
135typedef struct CONTROLLER_s CONTROLLER_t;
136
137
138
146{
147 uint16_t VSecReference;
148 uint16_t VPriReference;
149 int16_t IReference;
150 uint16_t PwrReference;
151
152 //bool ChargingState; ///< Control Flag: When set, enables PWM output while keeping control loop disabled; Skips closed loop ramp up states and directly jumps to state Online
154 bool Enable;
155
156};
158
159
160
167 uint8_t PrechargeEnabled; // if precharge is enabled.
168 uint16_t DutyCycle; // current open loop dutycycle in percentage
169 uint8_t precharged; // is the system precharged
170 uint16_t maxDutyCycle; // max dutycycle in percentage
171 uint16_t delayCounter; // to further slow down the rate of change of Duty Cycle
172 uint16_t scaler; // temp scaler
173 uint16_t primaryVoltage; // denominator
174};
175typedef struct PRECHARGE_s PRECHARGE_t;
176
177
178
184struct SEC_REC_s {
185 uint8_t SR_Enabled; // if SR is enabled or not. enabled after start power transfer
186 uint8_t SR_Flag; // SR flag o
187 uint16_t Threshold_high; // Threhshold high
188 uint16_t Threshold_low; // Threshold Low
189
190};
191typedef struct SEC_REC_s SEC_REC_t;
192
193
200{
201 uint32_t Accumulator;
202 uint16_t Counter;
204 uint16_t AverageValue;
205};
206typedef struct AVERAGING_s AVERAGING_t;
207
208#define ROLLING_AVG_SAMPLE_POINTS 3
209
211{
212 uint16_t samples[ROLLING_AVG_SAMPLE_POINTS];
213 uint32_t Accumulator;
214 uint16_t Index;
215 uint16_t AverageValue;
216};
218
219
233typedef struct DROOP_s DROOP_t;
234
235
242 uint16_t real_value;
245};
246typedef struct CALIBRATE_S CALIBRATE_t;
247
248
279typedef struct POWER_CONTROL_s POWER_CONTROL_t;
280
281#endif /* DEV_PWRCTRL_TYPEDEF_H */
282
Contains fault data types.
void __attribute__((__interrupt__, auto_psv))
Executes the power converter control loop.
Definition main.c:101
PWR_CTRL_STATES_e
Enumeration of power controller state machine states.
@ PWRCTRL_STATE_STANDBY
power converter control state #2: waiting for status bits allowing power supply to run
@ PWRCTRL_STATE_PRECHARGE
power converter control state #1: charging output caps
@ PWRCTRL_STATE_INITIALIZE
power converter control state #0: initializes object properties and clears status bits
@ PWRCTRL_STATE_SOFT_START
power converter control state #4: performs soft-start sequence
@ PWRCTRL_STATE_UP_AND_RUNNING
power converter control state #5: output is in regulation and power is OK (normal continuous operatio...
@ PWRCTRL_STATE_FAULT_DETECTION
power converter control state #6: checks if a fault occurs
Contains Fault settings.
Power converter switch-node specifications.
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 DeadTimeHigh
Deadtime High settings for PWM.
uint16_t ControlDutyCycle
Control Duty Cycle calculation based on Control Period.
uint16_t DeadTimeLow
Deadtime High settings for PWM.
uint16_t LowPowerSlowMode
future development
uint16_t PBVPeriodTarget
Power Board Visualizer Set Control target.
uint16_t ControlPhase
Control phase value from control loop.
uint16_t PBVControlPhaseTarget
Power Board Visualizer Set Control phase.
Publicly accessible data buffer of most recent runtime data values.
uint16_t Channel_AN15
Channel 15.
uint16_t VCapVoltage
Data value for capacitor.
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 ISecAverage
Data value for average secondary current.
uint16_t IPriSensorOffset
Offset of the primary current sensor.
uint16_t VInVoltage
Data value for input voltage.
uint16_t ISecSensorOffset
Offset of the secondary current sensor.
uint16_t ISenseSecondary
Data value for secondary current as measured with shunt.
uint16_t VRail_5V
Data value for 5V auxiliary rail.
uint16_t Temperature
Data value for temperature.
uint16_t VOutVoltage
Data value for output voltage.
Power converter status flags.
unsigned notUsed
Bit 2 - 15: Not used.
unsigned Running
Bit 0: Power converter is running.
unsigned FaultActive
Bit 1: Power converter fault is active.
Stores data related to the ramping up/down of the reference.
bool RampComplete
indicates when ramp-up is complete
uint16_t Delay
Soft-Start Period (POD, RAMP PERIOD, PGD, etc.)
uint16_t * ptrReferenceTarget
pointer to the ramp-up reference target
uint16_t * ptrReference
pointer the reference variable
uint16_t Counter
Soft-Start Execution Counter. This setting is set/cleared by the device driver and is 'read only'.
uint16_t StepSize
Size/value of one reference increment/decrement or this period.
Stores data related to the control loop properties.
uint16_t Output
controller output
bool Enable
Enable control loop.
int16_t Reference
actual reference
uint16_t Feedback
coming
int16_t AgcFactor
Adaptive gain control.
Collection of power control properties.
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...
bool Precharged
placeholder for precharge. false when not precharged. true when charged
Collection of Precharge Properties.
uint8_t PrechargeEnabled
uint16_t primaryVoltage
uint16_t maxDutyCycle
uint16_t delayCounter
uint16_t DutyCycle
Collection of Secondary Rectifier Properties.
uint16_t Threshold_high
uint8_t SR_Flag
uint16_t Threshold_low
uint8_t SR_Enabled
Averaging data type.
uint32_t Accumulator
uint16_t AveragingCount
uint16_t AverageValue
uint16_t samples[ROLLING_AVG_SAMPLE_POINTS]
Collection of Secondary Rectifier Properties.
uint16_t Droop_Voltage_Reference_from_PBV
uint8_t Droop_Enabled
uint16_t Droop_New_Voltage_Reference
uint8_t Droop_Flag
uint16_t Droop_Delay_Counter
uint16_t ref_diff
Collection of calibrate Properties.
uint16_t real_value
uint16_t calculated_value
Power control API structure.
CONTROLLER_t ILoop
structure for current controller data
SWITCH_NODE_t Pwm
Switch node settings.
CONTROLLER_t PLoop
structure for power controller data
PWR_CTRL_PROPERTIES_t Properties
Power Control properties
PRECHARGE_t Precharge
structure for precharge data
DROOP_t Droop
droop controller data
AVERAGING_t VoutCalibratingAveraging
structure for averaging Vout during Droop
SEC_REC_t SecRec
structure for secondary rectification data
CALIBRATE_t VoutCalibrate
structure for Calibrating Vout during Droop using Averaged value
CONTROLLER_t VLoop
structure for voltage controller data
START_UP_RAMP_t PRamp
Power ramp-up settings.
PWR_CTRL_STATE_t State
Power Control State ID.
AVERAGING_t SecondarySh_Offset
structure for averaging secondary sensor offset
FEEDBACK_SETTINGS_t Data
Feedback channel settings.
AVERAGING_t ISecAveraging
secondary current average
STATUS_FLAGS_t Status
Power Supply status flags.
START_UP_RAMP_t PhRamp
Phase ramp-up settings (for open loop)
FAULT_SETTINGS_t Fault
Fault flags and settings.
uint16_t Secondary_Rolling_val
Secondary Current Rolling Average Value.
AVERAGING_t PrimaryCT_Offset
structure for averaging primary CT offset
START_UP_RAMP_t VRamp
Voltage ramp-up settings.
START_UP_RAMP_t IRamp
Current ramp-up settings.
AVERAGING_ROLLING_t Secondary_Rolling
structure for Secondary current rolling average