public void StatusWord_InternalID_AccessorTest() { StatusWord statusWord = new StatusWord(); statusWord.InternalID = 5; Assert.AreEqual(statusWord.InternalID, 5); }
public StatusWordDetailViewModel(object statusWord) { if (statusWord != null && statusWord is StatusWord) { m_statusWord = statusWord as StatusWord; } }
public static string GetStatusWordsStatisticsMessage(Input inputData, _InputMeta inputMeta) { int nonEmptyStatusWordCount = 0; int statusWordsWithoutErrorsCount = 0; int validStatusWordsForLSECount = 0; for (int i = 0; i < inputMeta.StatusWords.Values.Length; i++) { if (inputMeta.StatusWords.Values[i].ID != Guid.Empty) { nonEmptyStatusWordCount++; if (inputData.StatusWords.Values[i] == 0.0) { statusWordsWithoutErrorsCount++; } StatusWord statusWord = new StatusWord(); statusWord.BinaryValue = inputData.StatusWords.Values[i]; if (!(statusWord.DataIsValid || statusWord.SynchronizationIsValid)) { validStatusWordsForLSECount++; } } } return($"R{nonEmptyStatusWordCount}-G{statusWordsWithoutErrorsCount}-V{validStatusWordsForLSECount}/{inputMeta.StatusWords.Values.Length} "); }
private void PrintStatusWord(Socket s) { StatusWord sw = new StatusWord(); sw.Read(s); var bitArray19 = new BitArray(new bool[8] { sw.Bit00, sw.Bit01, sw.Bit02, sw.Bit03, sw.Bit04, sw.Bit05, sw.Bit06, sw.Bit07 }); var bitArray20 = new BitArray(new bool[8] { sw.Bit08, sw.Bit09, sw.Bit10, sw.Bit11, sw.Bit12, sw.Bit13, sw.Bit14, sw.Bit15 }); byte[] byte19 = new byte[1]; bitArray19.CopyTo(byte19, 0); byte[] byte20 = new byte[1]; bitArray20.CopyTo(byte20, 0); Debug.WriteLine(""); Debug.WriteLine("StatusWord"); Debug.WriteLine($"Byte 19: {byte19[0]}"); Debug.WriteLine($"0: {sw.Bit00}, 1: {sw.Bit01}, 2: {sw.Bit02}, 3: {sw.Bit03}, 4: {sw.Bit04}, 5: {sw.Bit05}, 6: {sw.Bit06}, 7: {sw.Bit07}"); Debug.WriteLine($"Byte 20: {byte20[0]}"); Debug.WriteLine($"8: {sw.Bit08}, 9: {sw.Bit09}, 10: {sw.Bit10}, 11: {sw.Bit11}, 12: {sw.Bit12}, 13: {sw.Bit13}, 14: {sw.Bit14}, 15: {sw.Bit15}"); Debug.WriteLine(""); }
public bool Homing(string hostIp, int port) { Socket s = ModbusSocket.GetConnection(hostIp, port); ModesOfOperation modesOfOperation = new ModesOfOperation(); modesOfOperation.Write(s, ModesOfOperation.ModesEnum.Homing); while (modesOfOperation.ReadDisplay(s) != ModesOfOperation.ModesEnum.Homing) { Thread.Sleep(100); } ControlWord controlWord = new ControlWord(); // Byte 19: 31 controlWord.Bit00 = true; // 1 controlWord.Bit01 = true; // 2 controlWord.Bit02 = true; // 4 controlWord.Bit03 = true; // 8 controlWord.Bit04 = true; // 16 controlWord.Write(s); StatusWord statusWord = new StatusWord(); while (!(statusWord.Bit00 && statusWord.Bit01 && statusWord.Bit02 && statusWord.Bit05 && // 39 statusWord.Bit09 && statusWord.Bit10 && statusWord.Bit12)) // 22 { statusWord.Read(s); Thread.Sleep(100); } return(true); }
public void InitializeStatusWordTest() { m_internalID = DEFAULT_INTERNAL_ID; m_number = DEFAULT_NUMBER; m_description = DEFAULT_DESCRIPTION; m_inputMeasurementKey = DEFAULT_MEASUREMENT_KEY; m_statusWord = new StatusWord(); }
public static bool IsReferenced(StatusWord statusWord) { if (statusWord.Bit10 && statusWord.Bit12) { return(true); } return(false); }
public static bool TargetReached(StatusWord statusWord) { if (statusWord.Bit10) { return(true); } return(false); }
public static bool NewTargetSet(StatusWord statusWord) { if (statusWord.Bit12) { return(true); } return(false); }
public StatusWord GetStatusWord(string hostIp, int port) { Socket s = ModbusSocket.GetConnection(hostIp, port); StatusWord statusWord = new StatusWord(); statusWord.Read(s); return(statusWord); }
private void ShutDown(Socket s) { ControlWord controlWord = new ControlWord(); // Byte 19: 6 controlWord.Bit01 = true; // 2 controlWord.Bit02 = true; // 4 controlWord.Write(s); StatusWord statusWord = new StatusWord(); while (!(statusWord.Bit00 && statusWord.Bit05 && // 33 statusWord.Bit09)) // 2 { statusWord.Read(s); Thread.Sleep(100); } }
private void EnableOperation(Socket s) { ControlWord controlWord = new ControlWord(); // Byte 19: 15 controlWord.Bit00 = true; // 1 controlWord.Bit01 = true; // 2 controlWord.Bit02 = true; // 4 controlWord.Bit03 = true; // 8 controlWord.Write(s); StatusWord statusWord = new StatusWord(); while (!(statusWord.Bit00 && statusWord.Bit01 && statusWord.Bit02 && statusWord.Bit05 && // 39 statusWord.Bit09)) // 2 { statusWord.Read(s); Thread.Sleep(100); } }
public void StatusWord_ConstructorTest() { StatusWord statusWord = new StatusWord(); }
private static void DeleteStatusWord(StatusWord statusWord, List <StatusWord> parent) { parent.Remove(statusWord); }