From 22d14fa90698c21b05d3eda2f65d7db9498e9a57 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 00:06:10 +0900 Subject: enforce double pulse minimum spacing --- error_utils.c | 23 ++++++++++++++++------- flash.c | 4 ++++ globals.h | 6 +++++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/error_utils.c b/error_utils.c index e0f6446..24a9af5 100644 --- a/error_utils.c +++ b/error_utils.c @@ -417,12 +417,12 @@ void get_error_text(gchar **response, int error_num) format_error_text(response,-221,"Duty cycle can not be set. Set PW instead."); break; - case PW_Exceeds_Double_Separation: - format_error_text(response,-221,"PW can not exceed double pulse separation."); + case Double_Separation_Too_Small: + format_error_text(response,-221,"Double pulse separation too small."); break; case Double_Separation_Too_Large: - format_error_text(response,-221,"Double pulse separation is too high. It must be < 95% of the period."); + format_error_text(response,-221,"Double pulse separation too high."); break; case Cant_Do_Burst_and_Double: @@ -947,11 +947,11 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } if (ChannelStateToTest[i].double_pulse==double_on) { - temp=ChannelStateToTest[i].delay; + temp = (ChannelStateToTest[i].delay - globals.Flash.double_pulse_extra_deadtime[i]) / (1.0 + globals.Flash.double_pulse_extra_pw_margin[i]); if (temp(1.001*globals.Constraints.err_max_pw[i])) { - report_error=PW_Exceeds_Double_Separation; + report_error=Double_Separation_Too_Small; } } } @@ -1065,12 +1065,21 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } if (ChannelStateToTest[i].double_pulse==double_on) { - temp=ChannelStateToTest[i].pw; + temp=globals.Flash.double_pulse_min_sep[i]; if (temp>globals.Constraints.err_min_delay[i]) { globals.Constraints.err_min_delay[i]=temp; if ( (globals.Constraints.err_min_delay[i]>=0.0 && ChannelStateToTest[i].delay<(0.999*globals.Constraints.err_min_delay[i])) || (globals.Constraints.err_min_delay[i]<0.0 && ChannelStateToTest[i].delay<(1.001*globals.Constraints.err_min_delay[i])) ) { - report_error=PW_Exceeds_Double_Separation; + report_error=Double_Separation_Too_Small; + } + } + + temp=ChannelStateToTest[i].pw * (1.0 + globals.Flash.double_pulse_extra_pw_margin[i]) + globals.Flash.double_pulse_extra_deadtime[i]; + if (temp>globals.Constraints.err_min_delay[i]) { + globals.Constraints.err_min_delay[i]=temp; + if ( (globals.Constraints.err_min_delay[i]>=0.0 && ChannelStateToTest[i].delay<(0.999*globals.Constraints.err_min_delay[i])) + || (globals.Constraints.err_min_delay[i]<0.0 && ChannelStateToTest[i].delay<(1.001*globals.Constraints.err_min_delay[i])) ) { + report_error=Double_Separation_Too_Small; } } } diff --git a/flash.c b/flash.c index a350125..4f76d61 100644 --- a/flash.c +++ b/flash.c @@ -881,6 +881,10 @@ static void initFlashValues(FlashStruct *mem) mem->distort_dac[i] = 6; mem->distort_enabled[i] = 0; + + mem->double_pulse_extra_pw_margin[i] = 1.0; + mem->double_pulse_extra_deadtime[i] = 100.0e-9; + mem->double_pulse_min_sep[i] = 1.0e-6; } mem->relay_delay_in_sec=0.5; diff --git a/globals.h b/globals.h index 432b283..fce5b72 100644 --- a/globals.h +++ b/globals.h @@ -42,7 +42,7 @@ #define ampl_plus_os_lower_limit 22 #define ampl_plus_os_upper_limit 23 #define DutyTriggerError 24 -#define PW_Exceeds_Double_Separation 25 +#define Double_Separation_Too_Small 25 #define queue_overflow 26 #define query_error_interrupted 27 #define IllegalParameter 28 @@ -766,6 +766,10 @@ typedef struct { char distort_dac[max_channels]; /* addr 10656 */ char distort_enabled[max_channels]; /* addr 10658 */ + float double_pulse_extra_pw_margin[max_channels]; // addr 10660 - double pulse sep must be > (1.0 + this) * PW + float double_pulse_extra_deadtime[max_channels]; // addr 10668 + this + float double_pulse_min_sep[max_channels]; // addr 10676 + char flash_end; } FlashStruct; -- cgit