summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 01:39:54 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 01:39:54 +0900
commit908dbc71beebb1bb9ebcb3bb8945043b3ee5e800 (patch)
tree7907b7e2a2c5a00c4479d2fc117aa905dfef9b7f
parente61288ff7f0a705ce9c7f60b33429f92f3bfb573 (diff)
added hvps_avg_curr_limit for AVR-8F-B
-rw-r--r--error_utils.c93
-rw-r--r--flash.c1
-rw-r--r--globals.h6
3 files changed, 82 insertions, 18 deletions
diff --git a/error_utils.c b/error_utils.c
index cc056c8..54073d5 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -334,6 +334,10 @@ void get_error_text(gchar **response, int error_num)
format_error_text(response,-222,"PW exceeds RC limit.");
break;
+ case HVPS_Current_Too_High:
+ format_error_text(response,-222,"HVPS current too high.");
+ break;
+
case max_rise_time_error:
format_error_text(response,-222,"Rise time too high.");
break;
@@ -613,7 +617,7 @@ void get_error_text(gchar **response, int error_num)
break;
case zero_equiv_ampl_negative:
- format_error_text(response,-200,"Ampl zero equivalent can't be negative.");
+ format_error_text(response,-200,"This constant can't be negative.");
break;
default:
@@ -775,17 +779,16 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
report_error = zero_equiv_ampl_too_large;
}
- if (globals.Flash.ampl_zero_equiv[i] < 0.0) {
- report_error = zero_equiv_ampl_negative;
- }
-
if (fabs(globals.Flash.os_zero_equiv[i] > 2000.0)) {
report_error = zero_equiv_ampl_too_large;
}
- if (globals.Flash.os_zero_equiv[i] < 0.0) {
- report_error = zero_equiv_ampl_negative;
- }
+ if ( (globals.Flash.ampl_zero_equiv[i] < 0.0) ||
+ (globals.Flash.os_zero_equiv[i] < 0.0) ||
+ (globals.Flash.hvps_avg_curr_limit[i] < 0.0) ||
+ (globals.Flash.max_avg_power[i] < 0.0) ) {
+ report_error = zero_equiv_ampl_negative;
+ }
/* calculate maximum duty cycle based on amplitude and load, for later use */
@@ -925,6 +928,17 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
}
+ if ((globals.Flash.hvps_avg_curr_limit[i] > 0.0) && (fabs(ChannelStateToTest[i].amplitude) > 0.0) && (ChannelStateToTest[i].pw > 0.0)) {
+ temp=(100.0 / duty_scale) * globals.Flash.hvps_avg_curr_limit[i] * ChannelStateToTest[i].load_type /
+ (fabs(ChannelStateToTest[i].amplitude) * ChannelStateToTest[i].pw);
+ if (temp<globals.Constraints.err_max_freq[i]) {
+ globals.Constraints.err_max_freq[i]=temp;
+ if (ChannelStateToTest[i].frequency>(1.001*globals.Constraints.err_max_freq[i])) {
+ report_error=HVPS_Current_Too_High;
+ }
+ }
+ }
+
if (globals.Flash.max_avg_power[i] > 0.0) {
temp = (globals.Flash.max_avg_power[i] * ChannelStateToTest[i].load_type) / (ChannelStateToTest[i].amplitude * ChannelStateToTest[i].amplitude * ChannelStateToTest[i].pw);
if (temp < globals.Constraints.err_max_freq[i]) {
@@ -1036,6 +1050,18 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
}
+ if ((globals.Flash.hvps_avg_curr_limit[i] > 0.0) && (fabs(ChannelStateToTest[i].amplitude) > 0.0) && (ChannelStateToTest[i].frequency > 0.0)) {
+ temp=(100.0 / duty_scale) * globals.Flash.hvps_avg_curr_limit[i] * ChannelStateToTest[i].load_type /
+ (fabs(ChannelStateToTest[i].amplitude) * ChannelStateToTest[i].frequency);
+ if (temp<globals.Constraints.err_max_pw[i]) {
+ globals.Constraints.err_max_pw[i]=temp;
+ if (ChannelStateToTest[i].pw>(1.001*globals.Constraints.err_max_pw[i])) {
+ report_error=HVPS_Current_Too_High;
+ }
+ }
+ }
+
+
if (globals.Flash.max_avg_power[i] > 0.0) {
temp = globals.Flash.max_avg_power[i] * ChannelStateToTest[i].load_type / (ChannelStateToTest[i].amplitude * ChannelStateToTest[i].amplitude * ChannelStateToTest[i].frequency);
if (temp < globals.Constraints.err_max_pw[i]) {
@@ -1217,15 +1243,21 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
if (ChannelStateToTest[i].trigger_source==source_internal) {
- temp = sqrt(globals.Flash.max_avg_power[i] * ChannelStateToTest[i].load_type / (ChannelStateToTest[i].pw * ChannelStateToTest[i].frequency));
- if ((temp > 0.0) && (temp < globals.Constraints.err_max_ampl[i])) {
- globals.Constraints.err_max_ampl[i] = temp;
- if (-temp > globals.Constraints.err_min_ampl[i]) {
- globals.Constraints.err_min_ampl[i] = -temp;
+ if (globals.Flash.max_avg_power[i] > 0.0) {
+ temp = sqrt(globals.Flash.max_avg_power[i] * ChannelStateToTest[i].load_type / (ChannelStateToTest[i].pw * ChannelStateToTest[i].frequency));
+ // temp is positive at this point
+ if (temp < globals.Constraints.err_max_ampl[i]) {
+ globals.Constraints.err_max_ampl[i]=temp;
+ if (ChannelStateToTest[i].amplitude>(1.001*globals.Constraints.err_max_ampl[i])) {
+ report_error=average_power_limit;
+ }
}
-
- if ((1.001*globals.Constraints.err_max_ampl[i]) < fabs(ChannelStateToTest[i].amplitude)) {
- report_error=average_power_limit;
+ temp = temp * -1.0; // check negative possibility
+ if (temp > globals.Constraints.err_min_ampl[i]) {
+ globals.Constraints.err_min_ampl[i]=temp;
+ if (ChannelStateToTest[i].amplitude<(1.001*globals.Constraints.err_min_ampl[i])) {
+ report_error=average_power_limit;
+ }
}
}
}
@@ -1252,6 +1284,25 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
}
+ if ((globals.Flash.hvps_avg_curr_limit[i] > 0.0) && (fabs(ChannelStateToTest[i].frequency) > 0.0) && (ChannelStateToTest[i].pw > 0.0)) {
+ temp=(100.0 / duty_scale) * globals.Flash.hvps_avg_curr_limit[i] * ChannelStateToTest[i].load_type /
+ (ChannelStateToTest[i].frequency * ChannelStateToTest[i].pw);
+ // temp is positive at this point
+ if (temp < globals.Constraints.err_max_ampl[i]) {
+ globals.Constraints.err_max_ampl[i]=temp;
+ if (ChannelStateToTest[i].amplitude>(1.001*globals.Constraints.err_max_ampl[i])) {
+ report_error=HVPS_Current_Too_High;
+ }
+ }
+ temp = temp * -1.0; // check negative possibility
+ if (temp > globals.Constraints.err_min_ampl[i]) {
+ globals.Constraints.err_min_ampl[i]=temp;
+ if (ChannelStateToTest[i].amplitude<(1.001*globals.Constraints.err_min_ampl[i])) {
+ report_error=HVPS_Current_Too_High;
+ }
+ }
+ }
+
duty_cycle=ChannelStateToTest[i].pw*ChannelStateToTest[i].frequency*100; /* calculate duty cycle */
if (duty_cycle>(100.0*ampl_fixed_max_duty/duty_scale))
/* set at crossover voltage */
@@ -1530,6 +1581,16 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
}
+ if (globals.Flash.hvps_avg_curr_limit[i] > 0.0) {
+ temp= (duty_scale / 100.0) * fabs(ChannelStateToTest[i].amplitude) * ChannelStateToTest[i].pw * ChannelStateToTest[i].frequency / globals.Flash.hvps_avg_curr_limit[i];
+ if (temp > globals.Constraints.err_min_load_type[i]) {
+ globals.Constraints.err_min_load_type[i]=temp;
+ if (ChannelStateToTest[i].load_type<(0.999*globals.Constraints.err_min_load_type[i])) {
+ report_error=HVPS_Current_Too_High;
+ }
+ }
+ }
+
if (globals.Flash.max_peak_power[i] > 0.0) {
temp = ChannelStateToTest[i].amplitude * ChannelStateToTest[i].amplitude / globals.Flash.max_peak_power[i];
if (temp > globals.Constraints.err_min_load_type[i]) {
diff --git a/flash.c b/flash.c
index db04663..687169c 100644
--- a/flash.c
+++ b/flash.c
@@ -886,6 +886,7 @@ static void initFlashValues(FlashStruct *mem)
mem->double_pulse_min_sep[i] = 1.0e-6;
mem->cap_for_pw_rc_limit[i] = 0.0;
+ mem->hvps_avg_curr_limit[i] = 0.0;
}
mem->relay_delay_in_sec=0.5;
diff --git a/globals.h b/globals.h
index 689624f..a327107 100644
--- a/globals.h
+++ b/globals.h
@@ -109,6 +109,7 @@
#define Cant_Do_Burst_and_Double 95
#define Between_0_and_10_Volts 96
#define pw_rc_limit 97
+#define HVPS_Current_Too_High 98
#define YES 1
#define NO 0
@@ -812,9 +813,10 @@ typedef struct {
short slew_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 34324
float slew_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 35348
- float cap_for_pw_rc_limit[max_channels]; // size 8, addr 37396
+ float cap_for_pw_rc_limit[max_channels]; // size 8, addr 37396 - for AVR-8F-B
+ float hvps_avg_curr_limit[max_channels]; // size 8, addr 37404 - for AVR-8F-B
- char flash_end; // addr 37404
+ char flash_end; // addr 37412
} FlashStruct;
#pragma pack(pop)