summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormjc <mjc@avtechpulse.com>1970-01-01 10:36:31 +0900
committermjc <mjc@avtechpulse.com>1970-01-01 10:36:31 +0900
commit3a7e097b05c1283e2a1dc344799cd3bf9bd96969 (patch)
tree1a88fb90ec3f18fe200b1fbc04551c3e902dfa69
parent2b750070dc78edaed92b8900c152ac899c385c47 (diff)
Enforce minimum ampl magnitude (based on zero_equiv_ampl) in AVRQ -AHV, -XHV options
-rw-r--r--device-functions.c19
-rw-r--r--device-functions.h1
-rw-r--r--error_utils.c27
-rw-r--r--globals.h4
4 files changed, 48 insertions, 3 deletions
diff --git a/device-functions.c b/device-functions.c
index 83a384f..51134ff 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4707,6 +4707,12 @@ int number_of_fixed_ampl_points(int channel)
}
+gboolean non_zero_first_ampl_point (int channel)
+{
+ return (globals.Flash.ampl_pwl_amp[channel][0][0][0] != 0.0);
+}
+
+
float rst_ampl_value (int channel)
{
// smallest positive value, or zero
@@ -4714,8 +4720,16 @@ float rst_ampl_value (int channel)
int max;
max = number_of_fixed_ampl_points(channel);
- if (max == 0) {
+ if (non_zero_first_ampl_point(channel)) {
+
+ // For AVRQ -AHV, -XHV options, where valids ampls may be
+ // 1.0 to 1.5 kV, positive or negative
+ return globals.Flash.ampl_zero_equiv[channel];
+
+ } else if (max == 0) {
+
// not a unit that uses a list of fixed amplitudes
+ // normal scenario
if ((globals.Flash.min_ampl[channel] > 0.0) && (globals.Flash.max_ampl[channel] > 0.0)) {
// both min and max ampls are positive, range does not include zero. AVR-D4-B.
@@ -4727,7 +4741,10 @@ float rst_ampl_value (int channel)
// normal unit
return 0.0;
}
+
} else {
+ // a list of fixed amplitudes is used
+
int i, pos_count, neg_count;
pos_count = 0;
neg_count = 0;
diff --git a/device-functions.h b/device-functions.h
index 6e05da6..4597b40 100644
--- a/device-functions.h
+++ b/device-functions.h
@@ -77,5 +77,6 @@ int number_of_fixed_ampl_points(int channel);
float rst_ampl_value (int channel);
gboolean fixed_ampl_ok (int channel, float use_ampl);
void get_min_max_fixed_ampls (int channel, float *min_ampl, float *max_ampl);
+gboolean non_zero_first_ampl_point (int channel);
#endif
diff --git a/error_utils.c b/error_utils.c
index 6361065..9965b23 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -43,6 +43,7 @@ void set_gpib_error_flags (int error_num)
case ThisShouldntHappen:
case obsolete_feature:
case zero_equiv_ampl_too_large:
+ case zero_equiv_ampl_negative:
GPIB_Set_Command_Error();
break;
case query_error_interrupted:
@@ -377,6 +378,10 @@ void get_error_text(gchar **response, int error_num)
format_error_text(response,-222,"Amplitude too high.");
break;
+ case amplitude_gap:
+ format_error_text(response,-222,"Amplitude magnitude too low.");
+ break;
+
case peak_power_limit:
format_error_text(response,-222,"Peak power too high.");
break;
@@ -553,6 +558,10 @@ void get_error_text(gchar **response, int error_num)
format_error_text(response,-200,"Ampl zero equivalent is too high. Reprogram it.");
break;
+ case zero_equiv_ampl_negative:
+ format_error_text(response,-200,"Ampl zero equivalent can't be negative.");
+ break;
+
default:
format_error_text(response,-200,"Specific problem unknown.");
}
@@ -708,10 +717,14 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
break;
}
- if (fabs(globals.Flash.ampl_zero_equiv[i] > 200.0)) {
+ if (fabs(globals.Flash.ampl_zero_equiv[i] > 2000.0)) {
report_error = zero_equiv_ampl_too_large;
}
+ if (globals.Flash.ampl_zero_equiv[i] < 0.0) {
+ report_error = zero_equiv_ampl_negative;
+ }
+
/* calculate maximum duty cycle based on amplitude and load, for later use */
max_duty_high_ampl=globals.Flash.max_duty_high[i];
@@ -1088,6 +1101,18 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
/* ------------------------------- */
+
+ /* --- check gaps in ampl range, AVRQ -AHV/-XHV ---- */
+ if (non_zero_first_ampl_point(i)) {
+ if (fabs(ChannelStateToTest[i].amplitude) < globals.Flash.ampl_zero_equiv[i]) {
+ report_error=amplitude_gap;
+ }
+ }
+
+ /* ------------------------------------------------- */
+
+
+
/* --- check minimum amplitude --- */
if (uses_fixed_ampl && (min_fixed_ampl > globals.Flash.min_ampl[i])) {
diff --git a/globals.h b/globals.h
index a55c4ca..dd198a6 100644
--- a/globals.h
+++ b/globals.h
@@ -96,6 +96,8 @@
#define zero_equiv_ampl_too_large 81
#define GPIB_missing 82
#define rise_time_confined_values 83
+#define zero_equiv_ampl_negative 84
+#define amplitude_gap 85
#define YES 1
@@ -499,7 +501,7 @@ typedef struct {
float max_delay[max_channels]; /* addr 1800 - see also min_delay (new) */
float propagation_delay[max_channels]; /* addr 1808 */
float delay_shrink[max_channels]; /* addr 1816 */
- float ampl_zero_equiv[max_channels]; /* addr 1824 */
+ float ampl_zero_equiv[max_channels]; /* addr 1824 - also sets min ampl magnitude in AVRQ -AHV, -XHV */
float max_duty_low[max_channels]; /* addr 1832 */
float max_duty_high[max_channels]; /* addr 1840 */
float duty_ampl[max_channels]; /* addr 1848 */