diff options
Diffstat (limited to 'error_utils.c')
-rw-r--r-- | error_utils.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/error_utils.c b/error_utils.c index d339bdf..bd52ccc 100644 --- a/error_utils.c +++ b/error_utils.c @@ -1095,8 +1095,30 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } + /* --- check fixed amplitudes ---- */ + + float min_fixed_ampl, max_fixed_ampl; + min_fixed_ampl = max_fixed_ampl = 0.0; + + gboolean uses_fixed_ampl; + uses_fixed_ampl = (number_of_fixed_ampl_points(i)>0); + + if (uses_fixed_ampl) { + get_min_max_fixed_ampls (i, &min_fixed_ampl, &max_fixed_ampl); + + if (!fixed_ampl_ok (i, ChannelStateToTest[i].amplitude)) { + report_error=amplitude_confined_values; + } + } + /* ------------------------------- */ + /* --- check minimum amplitude --- */ - globals.Constraints.err_min_ampl[i]=globals.Flash.min_ampl[i]; + + if (uses_fixed_ampl && (min_fixed_ampl > globals.Flash.min_ampl[i])) { + globals.Constraints.err_min_ampl[i]=min_fixed_ampl; + } else { + globals.Constraints.err_min_ampl[i]=globals.Flash.min_ampl[i]; + } if ( (globals.Constraints.err_min_ampl[i]>=0.0 && ChannelStateToTest[i].amplitude<(0.999*globals.Constraints.err_min_ampl[i])) || (globals.Constraints.err_min_ampl[i]<0.0 && ChannelStateToTest[i].amplitude<(1.001*globals.Constraints.err_min_ampl[i])) ) { @@ -1115,18 +1137,14 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* ------------------------------- */ - /* --- check intermediate amplitude --- */ - if (number_of_fixed_ampl_points(i)>0) { - if (!fixed_ampl_ok (i, ChannelStateToTest[i].amplitude)) { - report_error=amplitude_confined_values; - } - } - /* ------------------------------- */ - - /* --- check maximum amplitude --- */ - globals.Constraints.err_max_ampl[i]=globals.Flash.max_ampl[i]; + if (uses_fixed_ampl && (max_fixed_ampl < globals.Flash.max_ampl[i])) { + globals.Constraints.err_max_ampl[i]=max_fixed_ampl; + } else { + globals.Constraints.err_max_ampl[i]=globals.Flash.max_ampl[i]; + } + if ( (globals.Constraints.err_max_ampl[i]>=0.0 && ChannelStateToTest[i].amplitude>(1.001*globals.Constraints.err_max_ampl[i])) || (globals.Constraints.err_max_ampl[i]<0.0 && ChannelStateToTest[i].amplitude>(0.999*globals.Constraints.err_max_ampl[i])) ) { report_error=amplitude_upper_limit; |