diff options
-rw-r--r-- | error_utils.c | 23 | ||||
-rw-r--r-- | flash.c | 2 | ||||
-rw-r--r-- | globals.h | 5 |
3 files changed, 29 insertions, 1 deletions
diff --git a/error_utils.c b/error_utils.c index 24bcd86..cc056c8 100644 --- a/error_utils.c +++ b/error_utils.c @@ -330,6 +330,10 @@ void get_error_text(gchar **response, int error_num) format_error_text(response,-222,"PW too high."); break; + case pw_rc_limit: + format_error_text(response,-222,"PW exceeds RC limit."); + break; + case max_rise_time_error: format_error_text(response,-222,"Rise time too high."); break; @@ -960,6 +964,15 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) report_error=pw_upper_limit; } + // RC limit, as per AVR-8F-B + temp = globals.Flash.cap_for_pw_rc_limit[i] * ChannelStateToTest[i].load_type; + if ((temp > 0.0) && (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=pw_rc_limit; + } + } + if (ChannelStateToTest[i].double_pulse==double_on) { temp = (ChannelStateToTest[i].delay - globals.Flash.double_pulse_extra_deadtime[i]) / (1.0 + globals.Flash.double_pulse_extra_pw_margin[i]); if (temp<globals.Constraints.err_max_pw[i]) { @@ -1507,6 +1520,16 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } } + if (globals.Flash.cap_for_pw_rc_limit[i] > 0.0) { + temp = ChannelStateToTest[i].pw / globals.Flash.cap_for_pw_rc_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=pw_rc_limit; + } + } + } + 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]) { @@ -884,6 +884,8 @@ static void initFlashValues(FlashStruct *mem) 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->cap_for_pw_rc_limit[i] = 0.0; } mem->relay_delay_in_sec=0.5; @@ -108,6 +108,7 @@ #define Dead_Time_Error 94 #define Cant_Do_Burst_and_Double 95 #define Between_0_and_10_Volts 96 +#define pw_rc_limit 97 #define YES 1 #define NO 0 @@ -811,7 +812,9 @@ 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 - char flash_end; // addr 37396 + float cap_for_pw_rc_limit[max_channels]; // size 8, addr 37396 + + char flash_end; // addr 37404 } FlashStruct; #pragma pack(pop) |