summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1970-01-01 10:08:59 +0900
committerroot <root@avtech.domain.avtechpulse.com>1970-01-01 10:08:59 +0900
commit0776239b5a5dca3382fa0dd3e4b9b8f4a7400d18 (patch)
treebef521e01b3684365b2b1c4ed1ded8a5900129a1
parent52ab11e9bdac98d7c8ea0111d92118325da7f4b3 (diff)
add PW distortion for AVR-E, AVIR, AVL. 0% at max amplitude, 100% below set valueINSTRUMENT_6_2_11b
-rw-r--r--device-functions.c31
-rw-r--r--flash.c2
-rw-r--r--globals.h3
3 files changed, 29 insertions, 7 deletions
diff --git a/device-functions.c b/device-functions.c
index d27cf76..e5fbeea 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -2721,6 +2721,12 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
(*atten_range)--;
+ float max1 = fabs(globals.Flash.min_ampl[channel]);
+ float max2 = fabs(globals.Flash.max_ampl[channel]);
+ if (max2 > max1) {
+ max1 = max2;
+ }
+
if (*atten_range == -1) {
// no valid attenuators
use_atten = 1.0;
@@ -2738,11 +2744,6 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
// Limit max voltage in attenuator mode to 93% of full maximum,
// to avoid the region in AVPs where PW shifts at high amplitudes
- float max1 = fabs(globals.Flash.min_ampl[channel]);
- float max2 = fabs(globals.Flash.max_ampl[channel]);
- if (max2 > max1) {
- max1 = max2;
- }
if ((use_ampl * use_atten) >
(globals.Flash.atten_percent_max_ampl[channel] * max1)) {
continue;
@@ -2753,7 +2754,25 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
/* apply pw ampl/pol tweaks */
if (parameter == pwl_pw_values) {
// tweak pw shifts
- tweaked_use_ampl = use_ampl + globals.Flash.pw_range_pol_tweaks[channel][range_i][pw_polarity];
+ float dist_frac = 1.0; // use same tweaking for all amplitudes by default
+
+ if (fabs(globals.Flash.distort_fully_below_ampl[channel]) > 0.0) {
+ // if distort_fully_below_ampl is specified (typically for AVR-E, AVIR, etc),
+ // distort zero at max ampl, and fully below specified ampl
+ dist_frac = (max1 - fabs(globals.ChannelState[channel].amplitude)) /
+ (max1 - fabs(globals.Flash.distort_fully_below_ampl[channel]));
+ if (dist_frac > 1.0) {
+ dist_frac = 1.0;
+ }
+
+ if (dist_frac < 0.0) {
+ dist_frac = 0.0;
+ }
+ }
+
+ float correction = dist_frac * globals.Flash.pw_range_pol_tweaks[channel][range_i][pw_polarity];
+ tweaked_use_ampl = use_ampl + correction;
+
} else if (parameter == pwl_ampl_values) {
// compensate for attenuators
tweaked_use_ampl = use_ampl * use_atten;
diff --git a/flash.c b/flash.c
index 431a7db..8a0926e 100644
--- a/flash.c
+++ b/flash.c
@@ -723,6 +723,8 @@ static void initFlashValues(FlashStruct *mem)
mem->max_duty_mid2[i]=0.0;
mem->duty_ampl_mid2[i]=0.0;
+ mem->distort_fully_below_ampl[i]=0.0;
+
mem->min_slew[i]=90e6;
mem->max_slew[i]=210e6;
mem->max_high_rl_duty[i]=80.0;
diff --git a/globals.h b/globals.h
index 58b6fb7..234b505 100644
--- a/globals.h
+++ b/globals.h
@@ -614,7 +614,8 @@ typedef struct {
float max_duty_mid2[max_channels]; /* addr 8094 */
float duty_ampl_mid2[max_channels]; /* addr 8102 */
- char spare_char[288]; /* 8110 */
+ float distort_fully_below_ampl[max_channels]; /* addr 8110 - used with pulse_width_pol_tweak, see S/N 13453 */
+ char spare_char[280]; /* 8118 */
float current_limit_pulse_mode[max_channels]; /* 8398 */
float current_limit_dc_mode[max_channels]; /* 8406 */