using System; using Microsoft.SPOT; using Microsoft.VisualStudio.TestTools.UnitTesting; using CPF; using System.Text; using System.Threading; using HWModules; using SWModules; using CPF.Surface_States; using Microsoft.SPOT.Hardware; namespace CPFUnitTests { class ABDecreaseBuoyancyUT { [TestMethod] public void TestABDecreaseBuoyancy() { Init(); MessageQueue messageQ = MessageQueue.Instance; ABDecreaseBuoyancyFast stateABDecreaseBuoyancyFast = new ABDecreaseBuoyancyFast("AB Decrease Buoyancy Fast"); CTD1 ctd1 = CTD1.Instance; ctd1.init(); Double pressure = Double.NaN; BuoyancyEngine buoyancyEngine; buoyancyEngine = BuoyancyEngine.Instance; BTConsole btConsole = BTConsole.Instance; btConsole.init(); EngrLogger.SendConsoleLine += btConsole.SendLine; pressure = buoyancyEngine.getBellowsPositionStringPot(); //Debug.Print("Bellows Position = " + pressure.ToString()); stateABDecreaseBuoyancyFast.doStateEntryActions(); for (int i = 1; i < 10000; i++) { stateABDecreaseBuoyancyFast.doStateActions(); ctd1.sendCRLF(); Thread.Sleep(100); ctd1.sendFastPressure(); pressure = buoyancyEngine.getBellowsPositionStringPot(); //Debug.Print("Bellows Position = " + pressure.ToString()); for (int j = 0; j < 10; j++) { messageQ.processQ(); Thread.Sleep(100); } } } private MotherBoard motherboard; private EnergyMonitorPump emPump; private BuoyancyEngine buoyancyEngine; private void Init() { Thread.Sleep(1000); motherboard = HWModules.MotherBoard.Instance; Thread.Sleep(1000); emPump = EnergyMonitorPump.Instance; Thread.Sleep(1000); motherboard.EnableChannelPower((int)HWModules.MotherBoard.ChannelNames.CTDChannel); Thread.Sleep(1000); motherboard.EnableChannelPower((int)HWModules.MotherBoard.ChannelNames.PositionSensorChannel); Thread.Sleep(1000); motherboard.EnableChannelPower((int)HWModules.MotherBoard.ChannelNames.PumpMotorControllerElexChannel); Thread.Sleep(1000); motherboard.EnableChannelPower((int)HWModules.MotherBoard.ChannelNames.BluetoothChannel); Thread.Sleep(1000); motherboard.EnablePump(); Thread.Sleep(1000); buoyancyEngine = BuoyancyEngine.Instance; Thread.Sleep(1000); buoyancyEngine.init(); Thread.Sleep(1000); } } }