public static void ParseRailTargetPacket(Packet Packet) { if (CheckPacket(Packet, 5, "Rail Target")) { float TargetDist = UtilData.ToFloat(UtilMain.SubArray(Packet.Data.Payload, 1, 4)); switch (Packet.Data.Payload[0]) { case 0x00: RoverMain.IOHandler.RailController.GotoTop(); break; case 0x01: RoverMain.IOHandler.RailController.GotoDrillGround(); break; case 0x02: RoverMain.IOHandler.RailController.TargetLocation = TargetDist; RoverMain.IOHandler.RailController.TargetLocationRefIsTop = true; break; case 0x03: RoverMain.IOHandler.RailController.TargetLocation = TargetDist; RoverMain.IOHandler.RailController.TargetLocationRefIsTop = false; break; } } }
public void AddData(DateTime date, float setup, float busy, float idleRun, float idle, float pm, float down, bool isShift) { if (idleRun > 0) { Console.WriteLine(); } if (isShift) { setup /= ShopCalendar.ShiftCount; busy /= ShopCalendar.ShiftCount; idleRun /= ShopCalendar.ShiftCount; idle /= ShopCalendar.ShiftCount; } UtilData data; if (_info.TryGetValue(date, out data) == false) { _info[date] = data = new UtilData(setup, busy, idleRun, idle, pm, down); } else { data.Add(setup, busy, idleRun, idle, pm, down); } }
public static void PacketGroundSensor(Packet Packet) { if (Packet == null || Packet.Data == null || Packet.Data.Payload == null || Packet.Data.Payload.Length != 40) { Log.Output(Log.Severity.WARNING, Log.Source.NETWORK, "Ground sensor packet invalid. Discarding. Length: " + Packet?.Data?.Payload?.Length); return; } DateTime Timestamp = DateTime.Now; int UVLight = UtilData.ToInt(UtilMain.SubArray(Packet.Data.Payload, 0, 4)); float AirQuality = UtilData.ToFloat(UtilMain.SubArray(Packet.Data.Payload, 4, 4)); float SoilMoist = UtilData.ToFloat(UtilMain.SubArray(Packet.Data.Payload, 8, 4)); uint ThermocoupleData = UtilData.ToUInt(UtilMain.SubArray(Packet.Data.Payload, 12, 4)); double AtmoTemp = UtilData.ToDouble(UtilMain.SubArray(Packet.Data.Payload, 16, 8)); double AtmoPres = UtilData.ToDouble(UtilMain.SubArray(Packet.Data.Payload, 24, 8)); double AtmoHumid = UtilData.ToDouble(UtilMain.SubArray(Packet.Data.Payload, 32, 8)); UV.Data.Add(new Datum <int>(Timestamp, UVLight)); AirPollution.Data.Add(new Datum <float>(Timestamp, AirQuality)); SoilMoisture.Data.Add(new Datum <float>(Timestamp, SoilMoist)); ThermoExt.Data.Add(new Datum <float>(Timestamp, MAX31855.ConvertExternalFromRaw(ThermocoupleData))); ThermoInt.Data.Add(new Datum <float>(Timestamp, MAX31855.ConvertInternalFromRaw(ThermocoupleData))); AirTemp.Data.Add(new Datum <double>(Timestamp, AtmoTemp)); AirPressure.Data.Add(new Datum <double>(Timestamp, AtmoPres)); AirHumidity.Data.Add(new Datum <double>(Timestamp, AtmoHumid)); }
private void Init() { this._allData = new Dictionary <UtilDataType, UtilData>(); for (int i = 0; i < Enum.GetNames(typeof(UtilDataType)).Length; i++) { UtilData value = this.CreateData((UtilDataType)i, this._battleAttrIndex); this._allData.Add((UtilDataType)i, value); } }
public UtilData GetDataByType(UtilDataType type) { UtilData result = null; if (!this._allData.TryGetValue(type, out result)) { result = null; } return(result); }
public static void ParseServoPacket(Packet Packet) { if (CheckPacket(Packet, 5, "Servo Set")) { if (Packet.Data.Payload[0] == 0x00) // Sample Door { RoverMain.IOHandler.DrillController.DoorOpen = (UtilData.ToInt(UtilMain.SubArray(Packet.Data.Payload, 1, 4)) == 1); } } }
public static void PacketTesting(Packet Packet) { if (Packet == null || Packet.Data == null || Packet.Data.Payload == null || Packet.Data.Payload.Length != 12) { Log.Output(Log.Severity.WARNING, Log.Source.NETWORK, "System sensor packet invalid. Discarding. Length: " + Packet?.Data?.Payload?.Length); return; } int Enc = UtilData.ToInt(UtilMain.SubArray(Packet.Data.Payload, 0, 4)); DateTime Sample = new DateTime(UtilData.ToLong(UtilMain.SubArray(Packet.Data.Payload, 4, 8))); }
private void FormMain_Load(object sender, System.EventArgs e) { // set { the initial state of the controls. InitControlState(); // Load and display a project. YaoDurant.Data.UtilData utilData = new UtilData(); theProject = utilData.GetProject("17"); alTasks = utilData.GetTasks("17"); DisplayProject(); }
private T LastValue; // Last filter value (internal use) /// <summary> Constructs a low pass filter with time constant <c>LPFk</c>. </summary> /// <param name="LPFk"> Low Pass Filter Time Constant. </param> public LowPass(double LPFk = 0.25) { if (!UtilData.IsNumericType(typeof(T))) { Log.Output(Log.Severity.ERROR, Log.Source.OTHER, "Low-pass filter cannot be instantiated with non-numeric type."); throw new ArgumentException("Cannot create filter of non-numeric type: " + typeof(T).ToString()); } // We can now assert that T is a numeric this.Output = default(T); this.LPFk = LPFk; this.Reset(); }
public AddUtilControlViewModel(UtilType utilType) { _type = utilType; _container = ServiceLocator.Current.GetInstance <IContainerExtension>(); _utilData = _container.Resolve <AppData>().UtilsData; _eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); _addUtilEvent = _eventAggregator.GetEvent <AddUtilEvent>(); AddCommand = new DelegateCommand(Add, CanAdd); ScanCommand = new DelegateCommand(Scan); }
} // Time constant for the Low Pass Filter from 0 to 1 /// <summary> Constructs a low pass filter with time constant <see cref="LPFk"/>. </summary> /// <param name="LPFk"> Low Pass Filter Time Constant. </param> /// <param name="SteadyStateEpsilon"> Allowable difference in output to be considered a steady state system. </param> public LowPass(double LPFk = 0.25, double SteadyStateEpsilon = 0) { // Assert that T is numeric if (!UtilData.IsNumericType(typeof(T))) { throw new ArgumentException("Cannot create filter of non-numeric type: " + typeof(T).ToString()); } this.Output = default(T); this.LPFk = LPFk; this.SteadyStateEpsilon = SteadyStateEpsilon; this.Reset(); this.Feed(default(T)); }