From 28ff5a039ffe7adbcb4e9c1dd166d0273ea18f8e Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 03:07:30 +0900 Subject: first attempt at adding lower duty limit when ZOUT=MAX, for -LV option --- error_utils.c | 27 +++++++++++++++++++++++++++ flash.c | 2 ++ globals.h | 5 +++++ parser.c | 4 ++-- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/error_utils.c b/error_utils.c index 31676d0..22f469e 100644 --- a/error_utils.c +++ b/error_utils.c @@ -363,6 +363,14 @@ void get_error_text(gchar **response, int error_num) format_error_text(response,-222,"Duty cycle too high or load resistance too low."); break; + case max_zout_error: + format_error_text(response,-222,"Output impedance too high."); + break; + + case max_zout_duty_error: + format_error_text(response,-222,"Duty cycle too high for the internal attenuators."); + break; + case max_soft_current_limit_error: format_error_text(response,-222,"Current limit too high."); break; @@ -860,6 +868,14 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) max_duty_this_ampl = globals.Flash.max_duty_mid2[i]; } + // for -LV option, restrict power dissipated in internal attenuators + if (globals.Flash.switchable_zout[i] && + (globals.ChannelState[i].zout==globals.Flash.zout_max[i]) && + (globals.Flash.switchable_zout_max_duty[i] > 0.0) && + (max_duty_this_ampl > globals.Flash.switchable_zout_max_duty[i])) { + max_duty_this_ampl = globals.Flash.switchable_zout_max_duty[i]; + } + ampl_fixed_max_duty = max_duty_this_ampl; if (globals.Flash.switchable_load[i]) { ampl_fixed_max_duty = max_duty_this_ampl * (ChannelStateToTest[i].load_type / globals.Flash.low_load_type[i]); @@ -1373,6 +1389,17 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) check_initial_max_value (globals.Flash.max_slew[i], &globals.Constraints.err_max_slew[i], ChannelStateToTest[i].slew, max_slew_error, &report_error); } + /* --- check zout / duty settings --- */ + + check_initial_max_value (globals.Flash.zout_max[i], &globals.Constraints.err_max_zout[i], ChannelStateToTest[i].zout, max_zout_error, &report_error); + if (globals.Flash.switchable_zout[i] && + (globals.ChannelState[i].zout==globals.Flash.zout_max[i]) && + (globals.Flash.switchable_zout_max_duty[i] > 0.0) && + (duty_cycle > (globals.Flash.switchable_zout_max_duty[i] / duty_scale))) { + // can only operate at min Zout at high duty cycles, due to attenuator limits + check_another_max_value (globals.Flash.zout_min[i], &globals.Constraints.err_max_zout[i], ChannelStateToTest[i].zout, max_zout_duty_error, &report_error); + } + /* --- check resistance settings --- */ if (globals.Flash.switchable_load[i]) { diff --git a/flash.c b/flash.c index a384c90..bbe2707 100644 --- a/flash.c +++ b/flash.c @@ -747,6 +747,8 @@ static void initFlashValues(FlashStruct *mem) mem->duty_highRL_above_v[i]=110.0; mem->duty_highRL_below_v[i]=110.0; + mem->switchable_zout_max_duty[i]=0.0; + mem->mon_pw_threshold[i]=-1.0; mem->monitor_step[i]=1.0; diff --git a/globals.h b/globals.h index d78584a..6b2e272 100644 --- a/globals.h +++ b/globals.h @@ -117,6 +117,8 @@ #define Jig_Open_Detected 99 #define NoHardwareRangeFoundError 100 #define HardwareWordError 101 +#define max_zout_error 102 +#define max_zout_duty_error 103 #define YES 1 #define NO 0 @@ -852,6 +854,8 @@ typedef struct { char jig_error_message[40]; // addr 37420 + float switchable_zout_max_duty[max_channels]; // addr 37460 + char flash_end; // addr 37460 } FlashStruct; @@ -880,6 +884,7 @@ typedef struct { float err_max_slew[max_channels]; float err_min_load_type[max_channels]; float err_max_load_type[max_channels]; + float err_max_zout[max_channels]; float composite_min_burst_time[max_channels]; /* minimum ever possible gap, taking into account all constraints */ } ConstraintsStruct; diff --git a/parser.c b/parser.c index 55eb2b7..e128aa9 100644 --- a/parser.c +++ b/parser.c @@ -2741,7 +2741,7 @@ static int Go_zout_20(gchar** response, int channel, char *parameter,char *units /* no break */ case command_withparam: - if (status=process_two_ints (parameter, &value, globals.Flash.zout_min[channel], globals.Flash.zout_max[channel])) { + if (status=process_two_ints (parameter, &value, globals.Flash.zout_min[channel], globals.Constraints.err_max_zout[channel])) { return status; } return Set_zout(channel,value,1); @@ -2752,7 +2752,7 @@ static int Go_zout_20(gchar** response, int channel, char *parameter,char *units break; case query_param: - return query_min_max_int(response, parameter, globals.Flash.zout_min[channel], globals.Flash.zout_max[channel]); + return query_min_max_int(response, parameter, globals.Flash.zout_min[channel], globals.Constraints.err_max_zout[channel]); break; default: -- cgit