private int addWDepthMFromNetDepthM() { float offset = log_file.getOffset(0); value_header log_netdepthM = log_file.getHeaderByIdUnits(ge_log_constants.NETDEPTH, "m"); if (log_netdepthM == null) { return(-1); } value_header log_wdepthM = log_file.getHeaderById(ge_log_constants.WDEPTH); if (log_wdepthM == null) { log_wdepthM = new value_header { id = ge_log_constants.WDEPTH, units = "m", comments = $"Water depth below datum ({log_netdepthM.db_name}-{offset})", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_wdepthM); } log_file.addConstant(log_netdepthM.db_name, -offset, log_wdepthM.db_name); log_wdepthM.comments = $"Water depth below datum ({log_netdepthM.db_name}-{offset})"; return(0); }
private int AddDepthNetM_AddDifferential() { int whead_success = NOT_OK; value_header log_wdepth1M = log_file.getHeaderByIdUnits("WDEPTH1", "m"); value_header log_baroM = log_file.getHeaderByIdUnits("BAROHEAD", "m"); if (log_wdepth1M == null || log_baroM == null) { return(0); } value_header log_netdepthM = log_file.getHeaderByIdUnits(ge_log_constants.NETDEPTH, "m"); if (log_netdepthM == null) { log_netdepthM = new value_header { id = ge_log_constants.NETDEPTH, units = "m", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_netdepthM); } // Order list so that differential will work List <ge_log_reading> ordered = log_file.readings.OrderBy(e => e.ReadingDateTime).ToList(); log_file.readings = ordered; log_file.addDifferential(log_wdepth1M.db_name, log_baroM.db_name, log_netdepthM.db_name); log_netdepthM.comments = $"Water depth with barometric differential removed {log_wdepth1M.db_name}+({log_baroM.db_name}j-{log_baroM.db_name}i)"; return(whead_success); }
public value_header getFoundHeader(string db_name, int table = 0) { search_table st = search_tables[table]; value_header db_col = st.headers.Find(c => c.found != NOT_FOUND && c.db_name == db_name); return(db_col); }
private int addHeadTfromTemperature() { value_header channel_temp = log_file.getHeaderById(ge_log_constants.TEMP); if (channel_temp == null) { return(-1); } // Calculate head due to thermal variations (m)' value_header temp_m = log_file.getHeaderById(ge_log_constants.THEAD); if (temp_m == null) { temp_m = new value_header { id = ge_log_constants.THEAD, units = "m", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(temp_m); } log_file.addAddMultiply(channel_temp.db_name, -ZeroTemperature, Math.Abs(ConstT), temp_m.db_name); temp_m.comments = $"({channel_temp.db_name} - ZeroT={ZeroTemperature}) * Math.Abs(ConstT {ConstT})"; temp_m.units = "m"; return(0); }
private int addWHeadMfromVWRAWChannel() { value_header channel_raw = log_file.getHeaderById(ge_log_constants.VWTRAWREADING); value_header temp = log_file.getHeaderById(ge_log_constants.TEMP); string method = log_file.getConversionMethod(LINEAR_CONVERSION); if (channel_raw == null) { return(-1); } // Convert VWT readings to water head (m)' value_header head_m = log_file.getHeaderById(ge_log_constants.WHEAD); if (head_m == null) { head_m = new value_header { id = ge_log_constants.WHEAD, units = "m", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(head_m); } if (method == LINEAR_CONVERSION) { log_file.addAddMultiply(channel_raw.db_name, -ZeroReading, LinearFactor, head_m.db_name); head_m.comments = $"(ZeroReading={ZeroReading}) - (Raw Channel Reading={channel_raw.db_name}) * (LinearFactor={LinearFactor}"; head_m.units = "m"; return(0); } if (method == POLY_CONVERSION) { float polyFactor = log_file.getPolyFactor(1); ConstA = ConstA * polyFactor; ConstB = ConstB * polyFactor; float ZeroReading2 = Convert.ToSingle(Math.Pow(Convert.ToDouble(ZeroReading), 2.00)); ConstC = -ConstA * ZeroReading2 - ConstB * ZeroReading; log_file.addPoly(channel_raw.db_name, ConstA, ConstB, ConstC, head_m.db_name); head_m.comments = $"(ConstA={ConstA}) * {channel_raw.db_name} ^ 2 + (ConstB={ConstB}) * {channel_raw.db_name} + (ConstC={ConstC}) (polyFactor={polyFactor})"; return(0); } return(-1); }
private int AddDuration() { value_header log_Duration = log_file.getDuration(); if (log_Duration == null) { log_Duration = new value_header { id = ge_log_constants.DURATION, units = "s", comments = $"Calculated test durations (s) from ordered ReadingDateTime)", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addDuration(); } return(0); }
private int AddWaterDepthM() { int wdepth_success = NOT_OK; value_header log_WDepthM = log_file.getHeaderByIdUnits(ge_log_constants.WDEPTH, "m"); if (log_WDepthM != null) { log_file.removeHeader(log_WDepthM); log_WDepthM = null; } value_header log_WDepth = log_file.getHeaderById("WDEPTH1"); if (log_WDepth != null) { switch (log_WDepth.units) { case "cm": { log_WDepthM = new value_header { id = ge_log_constants.WHEAD, units = "m", comments = $"Calculated conversion of {log_WDepth.db_name} from cm to m ({ge_log_constants.FACTOR_cmH20_to_mH20})", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_WDepthM); log_file.addValues(log_WDepth.db_name, ge_log_constants.FACTOR_cmH20_to_mH20, log_WDepthM.db_name); wdepth_success = 0; break; } default: { wdepth_success = NOT_OK; break; } } } else { wdepth_success = NOT_OK; } return(wdepth_success); }
private int AddWHeadM() { int whead_success = NOT_OK; value_header log_headM = log_file.getHeaderByIdUnits(ge_log_constants.WHEAD, "m"); if (log_headM != null) { log_file.removeHeader(log_headM); log_headM = null; } value_header log_press = log_file.getSourceWaterPressureHeader(); if (log_press != null) { switch (log_press.units) { case "kPa": { log_headM = new value_header { id = ge_log_constants.WHEAD, units = "m", comments = $"Calculated conversion of {log_press.db_name} from kPa to m ({ge_log_constants.FACTOR_kPa_to_mH20})", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_headM); log_file.addValues(log_press.db_name, ge_log_constants.FACTOR_kPa_to_mH20, log_headM.db_name); whead_success = 0; break; } case "PSI": { log_headM = new value_header { id = ge_log_constants.WHEAD, units = "m", comments = $"Calculated conversion of {log_press.db_name} from PSI to m ({ge_log_constants.FACTOR_PSI_to_mH20})", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_headM); log_file.addValues(log_press.db_name, ge_log_constants.FACTOR_PSI_to_mH20, log_headM.db_name); whead_success = 0; break; } case "cm": { log_headM = new value_header { id = ge_log_constants.WHEAD, units = "m", comments = $"Calculated conversion of {log_press.db_name} from cm to m ({ge_log_constants.FACTOR_cmH20_to_mH20})", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_headM); log_file.addValues(log_press.db_name, ge_log_constants.FACTOR_cmH20_to_mH20, log_headM.db_name); whead_success = 0; break; } case "mbar": { log_headM = new value_header { id = ge_log_constants.WHEAD, units = "m", comments = $"Calculated conversion of {log_press.db_name} from mbar to m ({ge_log_constants.FACTOR_mbar_to_mH20})", source = ge_log_constants.SOURCE_CALCULATED }; log_file.addHeader(log_headM); log_file.addValues(log_press.db_name, ge_log_constants.FACTOR_mbar_to_mH20, log_headM.db_name); whead_success = 0; break; } default: { whead_success = NOT_OK; break; } } } else { whead_success = NOT_OK; } return(whead_success); }