示例#1
0
		/// <summary>
		/// Check if gas port solenoids work properly.
		/// </summary>
		/// <param name="details">The string to hold details.</param>
		private void TestSolenoids( DetailsBuilder details )
		{
			// close all valves and stop pump
			Pump.CloseAllValves( true );

			for ( int portNum = 1; portNum <= Configuration.DockingStation.NumGasPorts; portNum++ )
			{
				/* DIAGNOSTIC_SOLENOID_CURRENT */

				// give the valves a chance to finish closing
				Thread.Sleep( 500 );

				// get the closed current counts (c1)
				int countsClosed = Controller.Get12VCurrent();

				// open valve
				Pump.OpenValve( portNum, false );

				// wait at least 500 ms
				Thread.Sleep( 500 );

				// get the open current counts (c2)
				int countsOpen = Controller.Get12VCurrent();

				// close the valve that was opened
				Pump.CloseValve( portNum );

				// convert current counts to milliamps (mA)
				int currentClosed = CountToCurrent( countsClosed );
				int currentOpen = CountToCurrent( countsOpen );

				// DSX solenoids are designed to use 180 mA to remain open 
				int currentSolenoid = currentOpen - currentClosed;
				
				// counts for min limit provided by Engineering (Bryan Pavlisko); 
				// 20 counts is 160 mA which is approximately 10% below 180 mA
				int COUNTS_MIN_LIMIT = 20;
				bool solenoidCheckFailed = false;

				// fail if c2 - c1 < 20
				solenoidCheckFailed = ( countsOpen - countsClosed ) < COUNTS_MIN_LIMIT;

				// report the results
				_gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_SOLENOID_" + portNum + "_CURRENT_CLOSED", countsClosed.ToString() ) );
				_gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_SOLENOID_" + portNum + "_CURRENT_OPEN", countsOpen.ToString() ) );
				_gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_SOLENOID_" + portNum + "_CURRENT_MILLIAMPS", currentSolenoid.ToString() ) );
				_gdpList.Add( new GeneralDiagnosticProperty( "DIAGNOSTIC_SOLENOID_" + portNum + "_CURRENT_PASSED", ( !solenoidCheckFailed ).ToString() ) );

				// log the results
				ReportDiagnostic( details, details.GetText( "SOLENOID_CURRENT_" + portNum ), countsClosed, countsOpen, solenoidCheckFailed );
			}
		}
示例#2
0
		/// <summary>
		/// Gets the current language's message for the id and formats it.
		/// </summary>
		/// <param name="msgID">The id to retrieve.</param>
		/// <returns>The current language's message.</returns>
		private string GetMessage( string msgID )
		{
			string returnMsg;

            string msg = _details.GetText( msgID ); // Get the basic message.

			// If its small, return it.
			if ( msg.IndexOf( ' ' ) < 0 )
			{
				returnMsg = "<a>" + msg + "</a>";
			}
			else
			{
				// Put all of the parts together.
				returnMsg = string.Empty;
                string tmpMsg = string.Empty;

				// Get all of the parts.
				string[] msgParts = msg.Split( " ".ToCharArray() );

				foreach ( string part in msgParts )
				{
					if ( ( part != null ) && ( part != string.Empty ) )
					{
						if ( ( tmpMsg.Length + part.Length + 1 ) > 16 ) // fixed == NUM_COLS
						{
							returnMsg += "<a>" + tmpMsg + "</a>";
							tmpMsg = part;
						}
						else
						{
							if ( tmpMsg != "" )
								tmpMsg += " ";
							tmpMsg += part;
						}
					}
				}
				if ( tmpMsg != "" )
					returnMsg += "<a>" + tmpMsg + "</a>";
			}
			return returnMsg;
		}
示例#3
0
		/// <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;
        }