Major upgrade
This commit is contained in:
130
Source/Program/Actions/UutPowerOnAction.cs
Normal file
130
Source/Program/Actions/UutPowerOnAction.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
|
||||
namespace ProgramLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Power on UUT
|
||||
/// </summary>
|
||||
internal class UutPowerOnAction : BasicAction
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private static NLog.ILogger _logger;
|
||||
|
||||
private static object _syncObj = new object();
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public UutPowerOnAction()
|
||||
{
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run the action
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
if (!Program.Instance().IsUutPwrOn)
|
||||
{
|
||||
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
|
||||
|
||||
Program.Instance().TestStation.VerifyCableSelfTestHasRun();
|
||||
|
||||
if (Program.Instance().PowerModulesToBePowered.Count == 0)
|
||||
{
|
||||
ParseProgramSpecificConfig();
|
||||
}
|
||||
|
||||
Program.Instance().PowerSupplySharedData.ResetAll();
|
||||
|
||||
foreach (var item in ProgramLib.Program.Instance().PowerModulesToBePowered)
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputEnable(item);
|
||||
|
||||
RecordPowerOnTimeToFile();
|
||||
|
||||
// disable front panel
|
||||
//Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.DisplayDisable("STE_POWER_SUPPLY_SYSTEM");
|
||||
|
||||
Program.Instance().EventManager[EventManager.Events.UUT_POWER_OFF].Reset();
|
||||
Program.Instance().EventManager[EventManager.Events.UUT_POWER_ON].Set();
|
||||
|
||||
Program.Instance().IsUutPwrOn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("UUT power is already on.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse ini file for modules to be powered on
|
||||
/// </summary>
|
||||
public void ParseProgramSpecificConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> keys = Program.Instance().ProgramSpecificConfig.ReadAllKeys(ProgramSpecificConfigIni.POWER_MODULES_TO_BE_POWERED.ToString());
|
||||
foreach (string key in keys)
|
||||
{
|
||||
string powerSupplyModule = Program.Instance().ProgramSpecificConfig.ReadValue(ProgramSpecificConfigIni.POWER_MODULES_TO_BE_POWERED.ToString(), key);
|
||||
|
||||
if (!Program.Instance().PowerModulesToBePowered.Contains(powerSupplyModule, StringComparer.OrdinalIgnoreCase))
|
||||
Program.Instance().PowerModulesToBePowered.Add(powerSupplyModule);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Record power on time
|
||||
/// </summary>
|
||||
private void RecordPowerOnTimeToFile()
|
||||
{
|
||||
XmlDocumentWrapper doc = new XmlDocumentWrapper(Program.Instance().FileAndFolderManager.GetFile(FileAndFolderManager.Files.TEST_RUN_LOG));
|
||||
|
||||
Dictionary<string, string> attributesDict = new Dictionary<string, string>();
|
||||
attributesDict[TestRunConfigXml.TestRunPowerOnDateAttributeName] = DateTime.Now.ToString("MM/dd/yyyy");
|
||||
attributesDict[TestRunConfigXml.TestRunPowerOnTimeAttributeName] = DateTime.Now.ToString("HH:mm:ss");
|
||||
doc.AddNode(TestRunConfigXml.TestRunPowerPath, attributesDict, null, XmlDocumentWrapper.AddNodePosition.First);
|
||||
|
||||
doc.SaveToFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user