public override ScalarValue Decode(Stream inStream) { long longValue = Uint.Decode(inStream).ToLong(); var year = (int)(longValue / 10000); var month = (int)((longValue - (year * 10000)) / 100); var day = (int)(longValue % 100); return(new DateValue(new DateTime(year, month, day))); }
public override byte[] EncodeValue(ScalarValue v) { if (v.IsNull) { return(NullValueEncoding); } return(Uint.EncodeValue(((NumericValue)v).Increment())); }
public override ScalarValue Decode(Stream inStream) { var value = (NumericValue)Uint.Decode(inStream); if (value.EqualsInt(0)) { return(null); } return(value.Decrement()); }
public static string LowerCaseChars(uint length) { string value = ((char)('a' + Uint.LessThan(26))).ToString(); if (length > 1) { value += LowerCaseChars(length - 1); } return(value); }
public override byte[] Encode(ScalarValue value) { byte[] bytes = value.Bytes; int lengthSize = IntegerCodec.GetUnsignedIntegerSize(bytes.Length); var encoding = new byte[bytes.Length + lengthSize]; byte[] length = Uint.Encode(new IntegerValue(bytes.Length)); Array.Copy(length, 0, encoding, 0, lengthSize); Array.Copy(bytes, 0, encoding, lengthSize, bytes.Length); return(encoding); }
public async Task <IHttpActionResult> GetUint(int id) { Uint @uint = await db.Uints.Where(x => x.UintId == id).FirstOrDefaultAsync(); if (@uint == null) { return(NotFound()); } return(Ok(@uint)); }
public void SetBetriebsartProjekt(Datenstruktur datenstruktur) { if (datenstruktur.BetriebsartProjekt == BetriebsartProjekt.AutomatischerSoftwareTest && GetPlcConfig != null) { PlcAusgaenge = GetPlcConfig.PlcBelegung.Ausgaenge; PlcEingaenge = GetPlcConfig.PlcBelegung.Eingaenge; return; } PlcAusgaenge = new Uint("16#FFFF"); PlcEingaenge = new Uint("16#FFFF"); }
public DigAusgaengeTesten(ulong bitMuster, ulong bitMaske, string dauer, double toleranz, string timeout, string kommentar) { _statusDigAusgaenge = StatusDigAusgaenge.Init; _bitMuster = new Uint(bitMuster); _bitMaske = new Uint(bitMaske); var dauer1 = new ZeitDauer(dauer); _dauerMin = (long)(dauer1.DauerMs * (1 - toleranz)); _dauerMax = (long)(dauer1.DauerMs * (1 + toleranz)); _timeout = new ZeitDauer(timeout); _kommentar = kommentar; }
public async Task <IHttpActionResult> DeleteUint(int id) { Uint @uint = await db.Uints.Where(x => x.UintId == id).FirstOrDefaultAsync(); if (@uint == null) { return(NotFound()); } db.Uints.Remove(@uint); await db.SaveChangesAsync(); return(Ok(@uint)); }
public override ScalarValue Decode(Stream inStream) { int intValue = ((IntegerValue)Uint.Decode(inStream)).Value; int hour = intValue / 10000000; intValue -= hour * 10000000; int minute = intValue / 100000; intValue -= minute * 100000; int second = intValue / 1000; intValue -= second * 1000; int millisecond = intValue % 1000; var tempAux = new DateTime(hour * 3600000 + minute * 60000 + second * 1000 + millisecond); return(new DateValue(tempAux)); }
public override ScalarValue Decode(Stream inStream) { try { int length = ((IntegerValue)Uint.Decode(inStream)).Value; var encoding = new byte[length]; for (int i = 0; i < length; i++) { encoding[i] = (byte)inStream.ReadByte(); } return(new ByteVectorValue(encoding)); } catch (IOException e) { throw new RuntimeException(e); } }
public override int GetHashCode() { unchecked { int result = _int1; result = (result * 397) ^ Bool.GetHashCode(); result = (result * 397) ^ (NullableBool.HasValue ? NullableBool.Value.GetHashCode() : 0); result = (result * 397) ^ Int; result = (result * 397) ^ Uint.GetHashCode(); result = (result * 397) ^ (NullableInt.HasValue ? NullableInt.Value : 0); result = (result * 397) ^ (NullableUint.HasValue ? NullableUint.Value.GetHashCode() : 0); result = (result * 397) ^ Byte.GetHashCode(); result = (result * 397) ^ Sbyte.GetHashCode(); result = (result * 397) ^ (NullableByte.HasValue ? NullableByte.Value.GetHashCode() : 0); result = (result * 397) ^ (NullableSbyte.HasValue ? NullableSbyte.Value.GetHashCode() : 0); result = (result * 397) ^ Short.GetHashCode(); result = (result * 397) ^ Ushort.GetHashCode(); result = (result * 397) ^ (NullableShort.HasValue ? NullableShort.Value.GetHashCode() : 0); result = (result * 397) ^ (NullableUshort.HasValue ? NullableUshort.Value.GetHashCode() : 0); result = (result * 397) ^ Long.GetHashCode(); result = (result * 397) ^ Ulong.GetHashCode(); result = (result * 397) ^ (NullableLong.HasValue ? NullableLong.Value.GetHashCode() : 0); result = (result * 397) ^ (NullableUlong.HasValue ? NullableUlong.Value.GetHashCode() : 0); result = (result * 397) ^ Char.GetHashCode(); result = (result * 397) ^ (NullableChar.HasValue ? NullableChar.Value.GetHashCode() : 0); result = (result * 397) ^ Float.GetHashCode(); result = (result * 397) ^ (NullableFloat.HasValue ? NullableFloat.Value.GetHashCode() : 0); result = (result * 397) ^ Double.GetHashCode(); result = (result * 397) ^ (NullableDouble.HasValue ? NullableDouble.Value.GetHashCode() : 0); result = (result * 397) ^ Decimal.GetHashCode(); result = (result * 397) ^ (NullableDecimal.HasValue ? NullableDecimal.Value.GetHashCode() : 0); result = (result * 397) ^ (String != null ? String.GetHashCode() : 0); result = (result * 397) ^ (Object != null ? Object.GetHashCode() : 0); result = (result * 397) ^ TimeSpan.GetHashCode(); result = (result * 397) ^ (NullableTimeSpan.HasValue ? NullableTimeSpan.Value.GetHashCode() : 0); result = (result * 397) ^ DateTime.GetHashCode(); result = (result * 397) ^ (NullableDateTime.HasValue ? NullableDateTime.Value.GetHashCode() : 0); return(result); } }
public DisplayPlc(Datenstruktur datenstruktur, ConfigPlc.Plc configPlc, BeschriftungPlc.BeschriftungenPlc beschriftungenPlc) { PlcAusgaenge = new Uint("16#FFFF"); PlcEingaenge = new Uint("16#FFFF"); ViewModel = new ViewModel.ViewModel(datenstruktur, configPlc, beschriftungenPlc, this); var plcGrid = new Grid { Name = "PlcGrid", MaxWidth = 700, MaxHeight = 1200, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Content = plcGrid; PlcZeichnen(plcGrid, configPlc, BackgroundProperty); DataContext = ViewModel; Closing += (_, e) => { e.Cancel = true; Schliessen(); }; }
private static void DataGridAnzeigeUpdaten(AutoTester.TestErgebnis testErgebnis, uint digOutSoll, string silkKommentar) { var digitalInput = GetDigtalInputWord(); var digitalOutput = GetDigitalOutputWord(); var dInput = new Uint(digitalInput.ToString()); var dOutputIst = new Uint(digitalOutput.ToString()); var dOutputSoll = new Uint(digOutSoll.ToString()); // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault switch (testErgebnis) { case AutoTester.TestErgebnis.Kommentar: case AutoTester.TestErgebnis.Version: AutoTesterWindow.UpdateDataGrid(new TestAusgabe( AutoTesterWindow.DataGridId, " ", testErgebnis, silkKommentar, // DigInput " ", // DigOutput Soll " ", // DigOutput Ist " ")); break; default: AutoTesterWindow.UpdateDataGrid(new TestAusgabe( AutoTesterWindow.DataGridId, $"{SilkStopwatch.ElapsedMilliseconds}ms", testErgebnis, dInput.GetHexBit(_anzahlBitEingaenge) + " " + dInput.GetBinBit(_anzahlBitEingaenge), // DigInput dOutputSoll.GetHexBit(_anzahlBitAusgaenge) + " " + dOutputSoll.GetBinBit(_anzahlBitAusgaenge), // DigOutput Soll // DigOutput Soll dOutputIst.GetHexBit(_anzahlBitAusgaenge) + " " + dOutputIst.GetBinBit(_anzahlBitAusgaenge), // DigOutput Ist silkKommentar)); break; } }
internal static void SetDigitaleEingaengeWord(Uint eingaenge) { Datenstruktur.DigInput[0] = Simatic.Digital_GetLowByte((uint)eingaenge.GetDec()); Datenstruktur.DigInput[1] = Simatic.Digital_GetHighByte((uint)eingaenge.GetDec()); }