Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches

Driver for Isolated AC Voltage Acquistion Board. More...

+ Collaboration diagram for VAC Monitor:

Files

file  vac_monitor.c
 This is the driver source file for vac driver.
 
file  vac_monitor.h
 header of the VAC
 
file  vac_monitor_typedef.h
 VAC Types define.
 

Data Structures

struct  VACM_STATUS_s
 ADD_SHORT_DESCRIPTION. More...
 
struct  VACM_FAULT_s
 ADD_SHORT_DESCRIPTION. More...
 
struct  VACM_VIN_s
 ADD_SHORT_DESCRIPTION. More...
 
struct  VACM_RUNTIME_BUFFER_s
 ADD_SHORT_DESCRIPTION. More...
 
struct  VACM_TIMEBASE_s
 ADD_SHORT_DESCRIPTION. More...
 
struct  VACM_s
 Main AC Monitor data object data type declaration. More...
 

Macros

#define FCALL_AC_MONITOR   (1.0/10.0e-6)
 frequency at which AC monitor code is executed (in Hertz)
 
#define AC_SENSE_GAIN   (37.585e-3)
 gain between AC input and ADC pin at which it is sensed (Volts/Volts)
 
#define FIN_MIN   (40.0)
 min AC line frequency (Hertz)
 
#define FIN_MAX   (65.0)
 max AC line frequency (Hertz)
 
#define UV_TRIG   (8.0)
 Input under voltage trigger threshold (Volts)
 
#define UV_HYS   (2.0)
 Input under voltage hysteresis (Volts)
 
#define OV_TRIG   (80.0)
 Input over voltage trigger threshold (Volts)
 
#define OV_HYS   (2.0)
 Input over voltage hysteresis (Volts)
 
#define ZC_TIMEOUT   (2.0e-3)
 zero cross timeout (seconds)
 
#define ZC_TMIN   (100.0e-6)
 min zero cross time (seconds)
 
#define AC_DROP_TIMEOUT   (25.0e-3)
 AC drop timeout (seconds)
 
#define DC_ACCEPTANCE_PERIOD_TICKS   (rnd(FCALL_AC_MONITOR * 40.0e-3))
 DC acceptance period in ticks.
 
#define FIN_MIN_TICKS   (rnd(FCALL_AC_MONITOR / FIN_MIN))
 FIN_MIN (Hertz) converted to ticks for software timer.
 
#define FIN_MAX_TICKS   (rnd(FCALL_AC_MONITOR / FIN_MAX))
 FIN_MAX (Hertz) converted to ticks for software timer.
 
#define ZC_TIMEOUT_TICKS   (rnd(FCALL_AC_MONITOR * ZC_TIMEOUT))
 ZC_TIMEOUT (seconds) converted to ticks for software timer.
 
#define ZC_TMIN_TICKS   (rnd(FCALL_AC_MONITOR * ZC_TMIN))
 ZC_TMIN (seconds) converted to ticks for software timer.
 
#define AC_DROP_TIMEOUT_TICKS   (rnd(FCALL_AC_MONITOR * AC_DROP_TIMEOUT))
 AC_DROP_TIMEOUT (seconds) converted to ticks for software timer.
 
#define UV_TRIG_ADC   (rnd((UV_TRIG*AC_SENSE_GAIN)/3.3*4096))
 UV_TRIG (UV trigger threshold) converted from Volts to ADC codes.
 
#define UV_CLR_ADC   (rnd(((UV_TRIG + UV_HYS)*AC_SENSE_GAIN)/3.3*4096))
 UV clear threshold converted from Volts to ADC codes.
 
#define OV_TRIG_ADC   (rnd((OV_TRIG*AC_SENSE_GAIN)/3.3*4096))
 OV_TRIG_ADC (OV trigger threshold) converted from Volts to ADC codes.
 
#define OV_CLR_ADC   (rnd(((OV_TRIG - OV_HYS)*AC_SENSE_GAIN)/3.3*4096))
 OV clear threshold converted from Volts to ADC codes.
 
#define HV_FLAG   (0<<15)
 Used when sending status word from primary to secondary core.
 

Enumerations

enum  VACM_STATES_e { VACM_STATE_STANDBY = 0x00 , VACM_STATE_DCDETECT = 0x01 , VACM_STATE_DCMODE = 0x02 , VACM_STATE_WAIT_ZC = 0x03 , VACM_STATE_ACSYNC = 0x04 , VACM_STATE_ONLINE = 0x05 , VACM_STATE_ACDROP = 0x06 }
 Enumeration of state machine operating states. More...
 

Detailed Description

Note
The Driver to parse the frame from AC Acquistion board.

Macro Definition Documentation

◆ AC_DROP_TIMEOUT

#define AC_DROP_TIMEOUT   (25.0e-3)

max amount of time that AC drop can be present before resetting the AC OK flag note that for an AC drop to be detected

  1. the AC input voltage must drop below the zero cross threshold
  2. the state machine for the phase must be in the ONLINE state

Definition at line 199 of file vac_monitor.h.

◆ AC_DROP_TIMEOUT_TICKS

#define AC_DROP_TIMEOUT_TICKS   (rnd(FCALL_AC_MONITOR * AC_DROP_TIMEOUT))

Definition at line 255 of file vac_monitor.h.

◆ AC_SENSE_GAIN

#define AC_SENSE_GAIN   (37.585e-3)

Each AC line voltage (works for DC also) is sensed at a ADC input pin. This parameter defines the gain between the AC line and the ADC pin. It is different for high and low voltage hardware configurations.

Definition at line 98 of file vac_monitor.h.

◆ DC_ACCEPTANCE_PERIOD_TICKS

#define DC_ACCEPTANCE_PERIOD_TICKS   (rnd(FCALL_AC_MONITOR * 40.0e-3))

if Vin > UV trigger threshold and it doesn't change value over 2 full line cycles, then consider that the signal might be DC. this is measured with a software timer that is incremented every time the state machine is called.

Definition at line 216 of file vac_monitor.h.

◆ FCALL_AC_MONITOR

#define FCALL_AC_MONITOR   (1.0/10.0e-6)

To measure time (for example zero cross timeout), the firmware needs to know the frequency at which the AC monitor state machine(s) is called. This frequency (in Hz) is set via this macro.

Warning
Usually the AC monitor state machines are called from a periodic interrupt. This will be set by the calling firmware, which is outside the scope of this project. If the call frequency is changed in the calling firmware, it needs to be changed here also.

Definition at line 84 of file vac_monitor.h.

◆ FIN_MAX

#define FIN_MAX   (65.0)

AC okay flag is cleared if the AC line frequency is above this value.

Definition at line 117 of file vac_monitor.h.

◆ FIN_MAX_TICKS

#define FIN_MAX_TICKS   (rnd(FCALL_AC_MONITOR / FIN_MAX))

number of ticks in corresponding to period of 1 / FIN_MAX.

Definition at line 234 of file vac_monitor.h.

◆ FIN_MIN

#define FIN_MIN   (40.0)

AC okay flag is cleared if the AC line frequency is below this value.

Definition at line 108 of file vac_monitor.h.

◆ FIN_MIN_TICKS

#define FIN_MIN_TICKS   (rnd(FCALL_AC_MONITOR / FIN_MIN))

number of ticks in corresponding to period of 1 / FIN_MIN.

Definition at line 225 of file vac_monitor.h.

◆ HV_FLAG

#define HV_FLAG   (0<<15)

Definition at line 309 of file vac_monitor.h.

◆ OV_CLR_ADC

#define OV_CLR_ADC   (rnd(((OV_TRIG - OV_HYS)*AC_SENSE_GAIN)/3.3*4096))

(OV_TRIG - OV_HYS) Volts converted to ADC code for firmware. Note that the ADC reference voltage is 3.3V and the scaling is 4096 (2^12).

Definition at line 297 of file vac_monitor.h.

◆ OV_HYS

#define OV_HYS   (2.0)

Vin OV fault is cleared if Vin goes back below (OV_TRIG - UV_HYS) Volts. Value is based on the average of the rectified AC input voltage (not RMS).

Definition at line 167 of file vac_monitor.h.

◆ OV_TRIG

#define OV_TRIG   (80.0)

Based on the average of the rectified AC input voltage (not RMS). This average is computed once per half line cycle. AC okay flag cleared if Vin goes above this threshold

Definition at line 156 of file vac_monitor.h.

◆ OV_TRIG_ADC

#define OV_TRIG_ADC   (rnd((OV_TRIG*AC_SENSE_GAIN)/3.3*4096))

Note that the ADC reference voltage is 3.3V and the scaling is 4096 (2^12).

Definition at line 287 of file vac_monitor.h.

◆ UV_CLR_ADC

#define UV_CLR_ADC   (rnd(((UV_TRIG + UV_HYS)*AC_SENSE_GAIN)/3.3*4096))

(UV_TRIG + UV_HYS) Volts converted to ADC code for firmware. Note that the ADC reference voltage is 3.3V and the scaling is 4096 (2^12).

Definition at line 278 of file vac_monitor.h.

◆ UV_HYS

#define UV_HYS   (2.0)

Vin UV fault is cleared if Vin goes back above (UV_TRIG + UV_HYS) Volts. Value is based on the average of the rectified AC input voltage (not RMS).

Definition at line 142 of file vac_monitor.h.

◆ UV_TRIG

#define UV_TRIG   (8.0)

Based on the average of the rectified AC input voltage (not RMS). This average is computed once per half line cycle. AC okay flag cleared if Vin drops below this threshold

Definition at line 131 of file vac_monitor.h.

◆ UV_TRIG_ADC

#define UV_TRIG_ADC   (rnd((UV_TRIG*AC_SENSE_GAIN)/3.3*4096))

Note that the ADC reference voltage is 3.3V and the scaling is 4096 (2^12).

Definition at line 268 of file vac_monitor.h.

◆ ZC_TIMEOUT

#define ZC_TIMEOUT   (2.0e-3)

If in zero cross region for longer than this time, AC ok flag is cleared

Definition at line 177 of file vac_monitor.h.

◆ ZC_TIMEOUT_TICKS

#define ZC_TIMEOUT_TICKS   (rnd(FCALL_AC_MONITOR * ZC_TIMEOUT))

Definition at line 241 of file vac_monitor.h.

◆ ZC_TMIN

#define ZC_TMIN   (100.0e-6)

when zero cross region is entered (zero cross flag set), will spend at least this amount if time in zero cross region, even if exit conditions are satisfied

Definition at line 187 of file vac_monitor.h.

◆ ZC_TMIN_TICKS

#define ZC_TMIN_TICKS   (rnd(FCALL_AC_MONITOR * ZC_TMIN))

Definition at line 248 of file vac_monitor.h.

Enumeration Type Documentation

◆ VACM_STATES_e

Enumerator
VACM_STATE_STANDBY 

state #0: wait for launch trigger

VACM_STATE_DCDETECT 

state #1: check if input votlage is DC or AC

VACM_STATE_DCMODE 

state #2: catch-up state in DC mode, bypassing any further AC analysis of the input voltage

VACM_STATE_WAIT_ZC 

state #3: wait for first zero crossing

VACM_STATE_ACSYNC 

state #4: startup-step synchronization on first few zero crossings after AC detected

VACM_STATE_ONLINE 

state #5: normal AC input operation

VACM_STATE_ACDROP 

state #6: AC drop detected

Definition at line 181 of file vac_monitor_typedef.h.