Go to the documentation of this file.
54 #define SNEG_VOLTAGE 2
55 #define SPOS_VOLTAGE 3
56 #define SZRO_VOLTAGE 4
59 #define SNEG_CURRENT 7
60 #define SPOS_CURRENT 8
61 #define SZRO_CURRENT 9
62 #define NOMINAL_VOLTAGE 10
63 #define VOLTAGE_SCALE 11
64 #define CURRENT_SCALE 12
65 #define I_CONSEL_ENABLE 13
66 #define DIP_THRESHOLD 14
67 #define DIP_HYSTERESIS 15
68 #define SWELL_THRESHOLD 16
69 #define SWELL_HYSTERESIS 17
70 #define INTERP_THRESHOLD 18
71 #define INTERP_HYSTERESIS 19
72 #define RVC_THRESHOLD 20
73 #define RVC_HYSTERESIS 21
74 #define MSV_CARRIER_FREQUENCY 22
75 #define MSV_RECORDING_LENGTH 23
76 #define MSV_THRESHOLD 24
77 #define SAMPLING_FREQUENCY 25
79 #define V_CONSEL_AVAILABLE 27
80 #define FLICKER_MODEL 28
81 #define FLICKER_MODEL_AVAILABLE 29
82 #define NOMINAL_FREQUENCY 30
83 #define NOMINAL_FREQUENCY_AVAILABLE 31
84 #define PROCESS_DATA 32
85 #define FW_VERSION_NR 33
90 #define CHAN_HARMONICS 2
91 #define CHAN_INTER_HARMONICS 3
96 #define CHAN_VOLTAGE_UNDER_DEV 8
97 #define CHAN_VOLTAGE_OVER_DEV 9
98 #define CHAN_VOLTAGE_PINST 10
99 #define CHAN_VOLTAGE_PST 11
100 #define CHAN_VOLTAGE_PLT 12
101 #define CHAN_EVENT_COUNT 13
102 #define CHAN_EVENT_START_TIME 14
103 #define CHAN_EVENT_END_TIME 15
104 #define CHAN_EVENT_DURATION_IN_CYCL 16
105 #define CHAN_EVENT_MIN_MAG 17
106 #define CHAN_EVENT_MAX_MAG 18
107 #define CHAN_EVENT_DELTA_U_MAX 19
108 #define CHAN_EVENT_DELTA_U_SS 20
109 #define CHAN_VOLTAGE_MAGNITUDE1012 21
110 #define CHAN_VOLTAGE_MAX_MAGNITUDE 22
112 #define RESAMPLED_WAVEFORM_FULL_SCALE 18196
float msvCarrierFrequency
Definition: pqlib_example.h:114
float msvThreshold
Definition: pqlib_example.h:113
float dipThreshold
Definition: pqlib_example.h:105
int write_pqm_attr(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t attr_id)
Write a pqm device attribute.
Definition: iio_pqm.c:242
#define ATTR_U2
Definition: iio_pqm.h:52
#define NOMINAL_FREQUENCY
Definition: iio_pqm.h:82
#define NOMINAL_FREQUENCY_AVAILABLE
Definition: iio_pqm.h:83
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
@ IIO_COUNT
Definition: iio_types.h:78
#define CHAN_EVENT_COUNT
Definition: iio_pqm.h:101
#define MSV_THRESHOLD
Definition: iio_pqm.h:76
#define SZRO_VOLTAGE
Definition: iio_pqm.h:56
#define PQM_DEVICE_ATTR_NUMBER
Definition: common_data.h:75
Struct describing the scan type.
Definition: iio_types.h:168
#define PQM_VOLTAGE_CHANNEL(_idx, _scan_idx, _name)
Definition: iio_pqm.c:44
char sign
Definition: iio_types.h:153
struct iio_attribute current_pqm_attributes[]
Definition: iio_pqm.c:759
volatile bool configChanged
Definition: iio_pqm.c:92
int read_pqm_attr(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t attr_id)
Read a pqm device attribute.
Definition: iio_pqm.c:135
int prepara_string(EVENT_TYPE event_type, int event_value, char *buf)
Prepare string output for specific event attribute types.
Definition: pqlib_convert.c:104
void * dev
Definition: iio_types.h:227
float pqm_global_attr[PQM_DEVICE_ATTR_NUMBER]
Definition: common_data.h:132
struct iio_device pqm_iio_descriptor
Definition: iio_pqm.c:1061
#define CHAN_EVENT_DELTA_U_SS
Definition: iio_pqm.h:108
struct iio_attribute event_pqm_intrpr_attribute[]
Definition: iio_pqm.c:1034
#define CHAN_VOLTAGE_UNDER_DEV
Definition: iio_pqm.h:96
Structure holding channel attributess.
Definition: iio_types.h:103
#define CHAN_EVENT_DURATION_IN_CYCL
Definition: iio_pqm.h:104
#define CHAN_VOLTAGE_PINST
Definition: iio_pqm.h:98
#define RESAMPLED_WAVEFORM_FULL_SCALE
Definition: iio_pqm.h:112
float rvcHysteresis
Definition: pqlib_example.h:112
uint32_t bytes_per_scan
Definition: iio_types.h:215
#define PQM_CURRENT_CHANNEL(_idx, _scan_idx, _name)
Definition: iio_pqm.c:51
Definition: common_data.h:130
#define TOTAL_PQM_CHANNELS
Definition: common_data.h:72
int32_t read_samples(struct iio_device_data *dev_data)
function for reading samples from the device.
Definition: iio_pqm.c:629
Definition: ad9361_util.h:69
float intrpHysteresis
Definition: pqlib_example.h:110
#define EVENT_COMMON_ATTR
Definition: iio_pqm.c:66
#define CHAN_EVENT_MIN_MAG
Definition: iio_pqm.h:105
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
struct no_os_circular_buffer * no_os_cb_desc
Definition: pqlib_example.h:154
#define CHAN_OFFSET
Definition: iio_pqm.h:93
int32_t pqm_trigger_handler(struct iio_device_data *dev_data)
Handles trigger: reads one data-set and writes it to the buffer.
Definition: iio_pqm.c:648
struct iio_attribute global_pqm_attributes[]
Definition: iio_pqm.c:805
#define FLICKER_MODEL
Definition: iio_pqm.h:80
#define CURRENT_SCALE
Definition: iio_pqm.h:64
ADI_PQLIB_FLICKER_MODEL flickerModel
Definition: pqlib_example.h:126
#define VOLTAGE_CH_NUMBER
Definition: common_data.h:73
#define PQLIB_MAX_INTER_HARMONICS
Definition: pqlib_example.h:57
@ EVENT_RVC
Definition: pqlib_convert.h:87
float swellThreshold
Definition: pqlib_example.h:107
uint32_t active_ch
Definition: common_data.h:134
float intrpThreshold
Definition: pqlib_example.h:109
uint32_t pqm_ch_attr[TOTAL_PQM_CHANNELS][MAX_CH_ATTRS]
Definition: common_data.h:133
#define SAMPLING_FREQUENCY
Definition: iio_pqm.h:77
float rvcThreshold
Definition: pqlib_example.h:111
int read_ch_attr(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t attr_id)
Read a channel attribute.
Definition: iio_pqm.c:359
float currentScale
Definition: pqlib_example.h:117
uint32_t ext_buff_len
Definition: common_data.h:135
#define V_CONSEL_AVAILABLE
Definition: iio_pqm.h:79
@ EVENT_DIPS
Definition: pqlib_convert.h:85
const char * name
Definition: iio_types.h:131
struct scan_type pqm_scan_type
Definition: iio_pqm.c:1039
uint32_t size
Definition: iio_types.h:213
#define CHAN_VOLTAGE_OVER_DEV
Definition: iio_pqm.h:97
#define MSV_CARRIER_FREQUENCY
Definition: iio_pqm.h:74
#define RVC_HYSTERESIS
Definition: iio_pqm.h:73
volatile bool configChanged
Definition: iio_pqm.c:92
#define CHAN_VOLTAGE_PST
Definition: iio_pqm.h:99
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
float convert_rms_type(ADI_AFE_RMS_TYPE mag, float scale)
Converts ADI_AFE_RMS_TYPE to voltage/current magnitude.
Definition: pqlib_convert.c:54
int16_t * ext_buff
Definition: common_data.h:136
struct iio_attribute event_pqm_swell_attribute[]
Definition: iio_pqm.c:1009
#define FLICKER_MODEL_AVAILABLE
Definition: iio_pqm.h:81
VCONSEL_CONFIG vconsel
Definition: pqlib_example.h:128
#define ATTR_I0
Definition: iio_pqm.h:58
#define SZRO_CURRENT
Definition: iio_pqm.h:61
#define CHAN_VOLTAGE_MAX_MAGNITUDE
Definition: iio_pqm.h:110
@ EVENT_SWELL
Definition: pqlib_convert.h:86
volatile bool processData
Definition: iio_pqm.c:93
struct no_os_circular_buffer * buf
Definition: iio_types.h:221
@ IIO_CURRENT
Definition: iio_types.h:66
float swellHysteresis
Definition: pqlib_example.h:108
@ IIO_VOLTAGE
Definition: iio_types.h:65
#define SWELL_THRESHOLD
Definition: iio_pqm.h:68
#define CHAN_EVENT_END_TIME
Definition: iio_pqm.h:103
ADI_AFE_ANGLE_TYPE convert_angle_type(ADI_AFE_ANGLE_TYPE angleRaw)
Definition: pqlib_convert.c:46
#define SWELL_HYSTERESIS
Definition: iio_pqm.h:69
#define CHAN_EVENT_DELTA_U_MAX
Definition: iio_pqm.h:107
#define CHAN_SCALE
Definition: iio_pqm.h:92
#define FW_VERSION
Definition: common_data.h:64
struct iio_buffer * buffer
Definition: iio_types.h:228
#define I_CONSEL_ENABLE
Definition: iio_pqm.h:65
#define FW_VERSION_NR
Definition: iio_pqm.h:85
struct iio_attribute voltage_pqm_attributes[]
Definition: iio_pqm.c:678
#define CHAN_EVENT_MAX_MAG
Definition: iio_pqm.h:106
PQLIB_EXAMPLE pqlibExample
Definition: pqlib_example.c:45
float convert_pct_type(ADI_PQLIB_PCT_TYPE val)
Converts ADI_PQLIB_PCT_TYPE to percentage.
Definition: pqlib_convert.c:64
struct iio_attribute * attributes
Definition: iio_types.h:186
float msvRecordingLength
Definition: pqlib_example.h:115
uint16_t num_ch
Definition: iio_types.h:252
#define RVC_THRESHOLD
Definition: iio_pqm.h:72
#define CHAN_THD
Definition: iio_pqm.h:94
int32_t update_pqm_channels(void *dev, uint32_t mask)
active pqm channels
Definition: basic_example.c:78
struct iio_device pqm_iio_descriptor
Definition: iio_pqm.c:1061
enum iio_chan_type type
Definition: iio_types.h:109
#define SNEG_CURRENT
Definition: iio_pqm.h:59
uint32_t nominalFrequency
Definition: pqlib_example.h:101
#define NOMINAL_VOLTAGE
Definition: iio_pqm.h:62
#define NULL
Definition: wrapper.h:64
@ EVENT_INTRPS
Definition: pqlib_convert.h:88
#define MSV_RECORDING_LENGTH
Definition: iio_pqm.h:75
#define SNEG_VOLTAGE
Definition: iio_pqm.h:54
float voltageScale
Definition: pqlib_example.h:116
struct iio_attribute event_pqm_rvc_attribute[]
Definition: iio_pqm.c:1019
int16_t ch_num
Definition: iio_types.h:105
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
int32_t close_pqm_channels(void *dev)
close all channels
Definition: basic_example.c:91
#define INTERP_THRESHOLD
Definition: iio_pqm.h:70
struct iio_attribute event_pqm_dips_attribute[]
Definition: iio_pqm.c:999
#define PQLIB_MAX_HARMONICS
Definition: pqlib_example.h:56
#define ATTR_I2
Definition: iio_pqm.h:57
#define CHAN_EVENT_START_TIME
Definition: iio_pqm.h:102
#define V_CONSEL
Definition: iio_pqm.h:78
#define CHAN_ANGLE
Definition: iio_pqm.h:89
#define CHAN_HARMONICS
Definition: iio_pqm.h:90
#define CHAN_VOLTAGE_PLT
Definition: iio_pqm.h:100
Definition: iio_types.h:151
EXAMPLE_CONFIG exampleConfig
Definition: pqlib_example.h:150
#define CHAN_RAW
Definition: iio_pqm.h:95
#define DIP_HYSTERESIS
Definition: iio_pqm.h:67
#define PQM_EVENT_CHANNEL(_idx, _scan_idx, _name, _attrb_def)
Definition: iio_pqm.c:58
float nominalVoltage
Definition: pqlib_example.h:118
#define CHAN_RMS
Definition: iio_pqm.h:88
Definition: iio_types.h:226
ADI_PQLIB_CYCLE_INPUT inputCycle
Definition: pqlib_example.h:147
ADI_PQLIB_OUTPUT * output
Definition: pqlib_example.h:151
#define MAX_CH_ATTRS
Definition: common_data.h:74
#define VOLTAGE_SCALE
Definition: iio_pqm.h:63
#define ATTR_U0
Definition: iio_pqm.h:53
#define CHAN_VOLTAGE_MAGNITUDE1012
Definition: iio_pqm.h:109
#define INTERP_HYSTERESIS
Definition: iio_pqm.h:71
#define DIP_THRESHOLD
Definition: iio_pqm.h:66
#define SPOS_CURRENT
Definition: iio_pqm.h:60
#define PROCESS_DATA
Definition: iio_pqm.h:84
int iio_buffer_push_scan(struct iio_buffer *buffer, void *data)
Definition: iio.c:1434
volatile bool processData
Definition: iio_pqm.c:93
float dipHysteresis
Definition: pqlib_example.h:106
#define SPOS_VOLTAGE
Definition: iio_pqm.h:55
int32_t no_os_cb_read(struct no_os_circular_buffer *desc, void *data, uint32_t nb_elements)
#define CHAN_INTER_HARMONICS
Definition: iio_pqm.h:91