/// <summary> /// Read the flow sensor /// </summary> /// <remarks> /// Engineering Notes: This step is to check if the reading of flow sensor is reasonable. /// With the pump closed and all valves closed, the flow should be lower than a certain level. /// Failure on this indicates the reading of flow rate is not correct. /// </remarks> /// <param name="details">The string to hold details.</param> private void TestFlowSensor( DetailsBuilder details ) { Pump.CloseAllValves( true ); Pump.Stop(); Thread.Sleep( 500 ); // Give the valves a chance to finish closing // Read the flow rate. ushort rawFlowCount = Pump.GetRawFlow(); ushort flowVolts = Pump.ConvertRawFlowToVolts( rawFlowCount ); ushort vacuumCounts = Pump.GetRawVacuum(); double vacuumInches = Pump.ConvertRawVacuumToInches( vacuumCounts ); int flowRate = Pump.CalculateFlowRate( flowVolts, vacuumCounts ); // Test flow reading string flowString = BuildFlowString( rawFlowCount, flowRate, flowVolts ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_FLOW", rawFlowCount.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_FLOW_VOLTS", flowVolts.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_FLOW_RATE", flowRate.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_FLOW_VACUUM", vacuumCounts.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_FLOW_VACUUM_INCHES", vacuumInches.ToString() ) ); // Flow value should be in the range of 0 (0mV) to 186 (600 mV), inclusive. // INS-3067, 6/26/2013, JMP - changer criteria from 43/128 to 0/186. ReportDiagnostic( details, DiagnosticResources.FLOW, flowString, ( ( rawFlowCount < 0 ) || ( rawFlowCount > 186 ) ) ); }
/// <summary> /// Test the specified solenoid /// </summary> /// <param name="details">The string to hold details.</param> private void TestFlow( DetailsBuilder details, int solenoid ) { // Validate the solenoid number if ( solenoid < 1 || solenoid > Configuration.DockingStation.NumGasPorts ) { Log.Debug( "TestFlow: Invalid solenoid value = " + solenoid.ToString() ); return; } Log.Debug( "TestFlow: port=" + solenoid.ToString() ); // Determine whether a cylinder is attached to this port. // If there is one attached, skip this test. DockingStation ds = Controller.GetDockingStation(); GasEndPoint gasEndPoint = ds.GasEndPoints.Find(m => m.Position == solenoid); if (gasEndPoint != null && gasEndPoint.Cylinder.IsFreshAir == false) { Log.Debug( "TestFlow: Cylinder attached to port " + solenoid.ToString() + "; SKIPPING THIS TEST." ); return; } Pump.DoCheckFlow = true; // Ensure that only the specified solenoid is open. Pump.CloseAllValves( true ); Thread.Sleep(500); // Give the valves a chance to finish closing Pump.OpenValve(solenoid, false); // Open the specified solenoid Thread.Sleep(500); // Pause at least 500ms. Pump.SetDesiredFlow( Pump.StandardFlowRate); Pump.Start( Pump.StandardStartVoltage ); // Turn on the pump. Thread.Sleep( 3000 ); // Wait for it to stabilize the flow before letting CheckFlow take its first reading. // CheckFlow could enter an infinite loop if it's unable to // establish the desired flow rate and we don't tell it to time out. // We therefore give it a time out of a minute which should be more than sufficient. ushort rawFlowCounts; ushort rawVacuumCounts; Pump.FlowStatus flowStatus = Pump.CheckFlow( new TimeSpan( 0, 1, 0 ), out rawFlowCounts, out rawVacuumCounts ); byte pumpVoltage = Pump.GetPumpVoltage(); // obtain and hold onto final voltage of the pump, to report it to inet. // Get the flow rate. ushort flowVolts = Pump.ConvertRawFlowToVolts( rawFlowCounts ); int flowRate = Pump.CalculateFlowRate( flowVolts, rawVacuumCounts ); // Convert that value to mL/min // Report the results. string flowString = BuildFlowString(flowRate, flowVolts); // We create a property for every value used to compute the flow rate, and also the flow rate itself. _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid + "_VACUUM", rawVacuumCounts.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid + "_VACUUM_INCHES", Pump.ConvertRawVacuumToInches( rawVacuumCounts ).ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid, rawFlowCounts.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid + "_VOLTS", flowVolts.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid + "_RATE", flowRate.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid + "_PUMP_VOLTS", pumpVoltage.ToString() ) ); // The flow is considered a failure if it's not equal to the StandardFlowRate plus/minus the standardtolerance bool flowFailed = flowRate < ( Pump.StandardFlowRate - Pump.FLOWRATE_TOLERANCE ) || flowRate > ( Pump.StandardFlowRate + Pump.FLOWRATE_TOLERANCE ); // TODO - we should rename the translation string so that it's prefixed with "CHECK_FLOW" instead of "SOLENOID_FLOW" ReportDiagnostic( details, details.GetText( "SOLENOID_FLOW_" + solenoid ), flowString, flowFailed ); // Check Pump Error Status -- FAIL IF STATE IS 1 int pumpErrorState = Pump.GetPumpErrorState(); // Report the results. _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_CHECK_FLOW_" + solenoid + "_PUMP_ERROR", pumpErrorState.ToString() ) ); // TODO - we should rename the translation string so that it's prefixed with "CHECK_FLOW" instead of "SOLENOID_FLOW" ReportDiagnostic(details, details.GetText("SOLENOID_PUMP_ERROR_" + solenoid), pumpErrorState.ToString(), (pumpErrorState == 1)); // Stop the pump and close the solenoid Pump.CloseValve(solenoid); Pump.DoCheckFlow = false; }
/// <summary> /// Check for leaks. /// </summary> /// <remarks> /// This is to check if the components in the closed gas delivery system work properly including /// tubing, 3 solenoid valves, manifolds, check valves, vacuum sensor, flow sensor and pump. /// The pump failure to operate could also cause this test to fail. /// If a leakage is found, flow check will be meaningless. /// </remarks> /// <param name="details">The details to fill in.</param> private void TestForLeak(DetailsBuilder details) { Pump.CloseAllValves( true ); Thread.Sleep( 500 ); // Give the valves a chance to finish closing int pumpVoltage = 80; // initial voltage for leak test bool leakCheck1Failed = true; ushort vac1Raw; double vac1Inches; string vac1String; const int maxPumpVoltage = 120; const ushort rawInches40 = 360; const int inches40 = 40; const int pumpVoltageIncrement = 10; //const ushort rawInches55 = 466; //const int inches55 = 55; Pump.Start( pumpVoltage ); // start pump with initial voltage //Suresh 19-JUNE-2012 INS-3067 do { // After changing pump voltage, always wait 1 second before reading // vacuum sensor to give the sensor time to adjust to the change. Thread.Sleep( 1000 ); // Take vacuum reading (vac1) vac1Raw = Pump.GetRawVacuum(); vac1Inches = Pump.ConvertRawVacuumToInches( vac1Raw ); vac1String = BuildCountAndUnitString( vac1Raw, vac1Inches, 1, "\"" ); Log.Debug( string.Format( "Vacuum: {0}, Pump voltage: {1}", vac1String, pumpVoltage ) ); // Check vacuum reading against target pressure. Pass after we reach or exceed target. if ( vac1Raw >= rawInches40 ) { // Pass if vac1 >= 40 inches of water leakCheck1Failed = false; Log.Debug( string.Format( "Leak Check 1 PASSED. (vacuum exeeds {0}\")", inches40 ) ); break; } if ( pumpVoltage + pumpVoltageIncrement >= maxPumpVoltage )// if the pump voltage crests above 120 { Log.Debug( string.Format( "Leak Check 1 FAILED (pump voltage exeeds {0} but vacuum under {1}\")", maxPumpVoltage, inches40 ) ); break; } pumpVoltage += pumpVoltageIncrement; Pump.SetNewPumpVoltage( (byte)pumpVoltage ); // set the new voltage to pump } while ( true ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_LEAK_CHECK_VAC1", vac1Raw.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_LEAK_CHECK_VAC1_INCHES", vac1Inches.ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_LEAK_CHECK_VAC1_PASSED", (!leakCheck1Failed).ToString() ) ); _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_LEAK_CHECK_VAC1_PUMP_VOLTAGE", pumpVoltage.ToString() ) ); ReportDiagnostic( details, DiagnosticResources.LEAK_CHECK_1, vac1String, leakCheck1Failed ); int vacuumError = Pump.GetVacuumErrorState(); // Check status of Vacuum Error by calling GetVacuumErrState() _gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_LEAK_CHECK_VAC_ERROR", vacuumError.ToString() ) ); //Pass no matter what the state is [Vacuum Error Status]. The purpose is to keep the data structure of the report same as previous version. ReportDiagnostic( details, DiagnosticResources.VACUUM_ERROR_STATUS, vacuumError.ToString(), false ); // Stop pump Pump.Stop(); //Open Solenoid #1 for 1 second to relieve the pressure Pump.OpenValve( 1, false ); Thread.Sleep( 1000 ); // 1 sec Pump.CloseValve( 1 ); }