bool Measure1(MeasureVoltage dmm) { double reading; int i; dcVoltage1 = 0.0; for (i = 1; i <= 5; i++) { reading = Math.Abs(dmm.Measure()); dcVoltage1 = (dcVoltage1 + reading); Application.Current.Dispatcher.Invoke(() => Voltages.Add(Convert.ToString(reading + " Volts"))); if (reading == 0.00) { Application.Current.Dispatcher.Invoke(() => MessageBox.Show("Connect Meter USB")); TurnOffPower(power); meterConnected = false; return(false); } if (reading < 300 || reading > 340) { dcVoltage1 = reading; return(false); } } dcVoltage1 = dcVoltage1 / (i - 1); return(true); }
public VoltagesEnumerator(Voltages collection) { collectionRef = collection; currentIndex = -1; currentObject = null; currentSize = collectionRef.Count; }
public Voltages(Voltages other) : this(msclPINVOKE.new_Voltages__SWIG_1(Voltages.getCPtr(other)), true) { if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetRange(int index, Voltages values) { msclPINVOKE.Voltages_SetRange(swigCPtr, index, Voltages.getCPtr(values)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public void AddRange(Voltages values) { msclPINVOKE.Voltages_AddRange(swigCPtr, Voltages.getCPtr(values)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
/// <summary> /// 监控仪表电压和电流 /// </summary> /// <param name="timeout">查询时间间隔,单位ms</param> public void MonitorInstrument(int timeout, DateTime time) { Voltages.Clear(); Currents.Clear(); if (!t6332A.Open()) { return; } //if (!t6942A.Open()) // return; CsvHelper csvHelper = new CsvHelper($@"D:\HTOL\{time:yyyyMMddHHmmss}\InstrumentData.csv"); csvHelper.WirteLine(new string[] { "Time(MMdd:HH:mm:ss)", "CH1_Voltage(V)", "CH2_Voltage(V)", "CH3_Voltage(V)", "CH1_Current(A)", "CH2_Current(A)", "CH3_Current(A)" }); isMonitorInstrument = true; while (isMonitorInstrument) { var now = DateTime.Now; double[] voltages = t6332A.QueryVoltage(); Voltages.Add(new GraphModel { DateTime = now, Value = voltages[0] }); double[] currents = t6332A.QueryCurrent(); Currents.Add(new GraphModel { DateTime = now, Value = currents[0] }); csvHelper.WirteLine(new string[] { now.ToString("MMdd:HH:mm:ss"), voltages[0].ToString("0.000"), voltages[1].ToString("0.000"), voltages[2].ToString("0.000"), currents[0].ToString("0.000"), currents[1].ToString("0.000"), currents[2].ToString("0.000"), }); SetAxisLimits(now); //lets only use the last 15 values if (Voltages.Count > 120) { Voltages.RemoveAt(0); } if (Currents.Count > 120) { Currents.RemoveAt(0); } Thread.Sleep(timeout); } }
public virtual Voltages excitationVoltages() { Voltages ret = new Voltages(msclPINVOKE.NodeFeatures_excitationVoltages(swigCPtr), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public Voltages GetRange(int index, int count) { global::System.IntPtr cPtr = msclPINVOKE.Voltages_GetRange(swigCPtr, index, count); Voltages ret = (cPtr == global::System.IntPtr.Zero) ? null : new Voltages(cPtr, true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static Voltages Repeat(WirelessTypes.Voltage value, int count) { global::System.IntPtr cPtr = msclPINVOKE.Voltages_Repeat((int)value, count); Voltages ret = (cPtr == global::System.IntPtr.Zero) ? null : new Voltages(cPtr, true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void LinkNetworkComponents(int numberOfPhasors, int numberofShuntBreakers) { for (int i = 0; i < numberOfPhasors; i++) { Phasor voltage = new Phasor(); Voltages.Add(voltage); } for (int i = 0; i < numberofShuntBreakers; i++) { CapBank shuntBreaker = new CapBank(); ShuntBreakers.Add(shuntBreaker); } }
public void LinkNetworkComponents(int numberOfPhasors, int numberofShuntBreakers) { for (int i = 0; i < numberOfPhasors; i++) { VoltagePhasorGroup voltagePhasorGroup = new VoltagePhasorGroup(); Voltages.Add(voltagePhasorGroup); } for (int i = 0; i < numberofShuntBreakers; i++) { Switch shuntBreaker = new Switch(); ShuntBreakers.Add(shuntBreaker); } }
private void Timer_Elapsed(object sender, ElapsedEventArgs e) { var voltage = VoltageService.Get(); var current = CurrentService.Get(); var power = 0; this.Measure = new Measure(DateTime.Now, voltage, current, power); this.ThreePhaseMeasure = ThreePhaseInputService.Get(); IsPowerOn = OutputService.IsOn(); SupplierVoltage = SupplierVoltageInputService.Get(); SupplierCurrent = SupplierCurrentInputService.Get(); Voltages.Add(this.Measure.Voltage); }
public void LinkNetworkComponents(int numberOfPhasors) { for (int i = 0; i < numberOfPhasors; i++) { Phasor voltage = new Phasor(); Voltages.Add(voltage); } //for(int i = 0; i < numberofShuntBreakers; i++ ) //{ // Switch shuntBreaker = new Switch(); // ShuntBreakers.Add(shuntBreaker); //} }
//voltage public List <Voltages> ListVoltages() { var list = new List <Voltages>(); Voltages obj; for (int i = 0; i <= 3; i++) { obj = new Voltages(); obj._VoltageID = i.ToString(); obj._SubstationID = "0"; obj._ConnectivityNodes = ListConnectivityNodes(); obj._Bays = ListBays(); obj._Busbars = ListBusbars(); list.Add(obj); } return(list); }
private void Initialize(ISensor sensor) { switch (sensor.SensorType) { case SensorType.Temperature: Temperatures.Add(sensor); break; case SensorType.Voltage: if (sensor.Name.Contains("+3.3V")) { Voltage3p3 = sensor; } else if (sensor.Name.Contains("VBat")) { VBat = sensor; } else { Voltages.Add(sensor); } break; case SensorType.Fan: if (sensor.Name.EndsWith("#1")) { CpuFanSpeed = sensor; } else { FanSpeeds.Add(sensor); } break; case SensorType.Control: FanControls.Add(sensor); break; default: Jsoner.ObjectSaver.AddObject(sensor); break; } }
private void Update(OpenGLControl control) { if (!Host.CurrentApplicationIsActive) { return; } if (control.ClientRectangle.Contains(control.PointToClient(Cursor.Position))) { var delta = new vec2(Cursor.Position.X, Cursor.Position.Y) - LastMousePosition; // Rotate camera if (Control.MouseButtons.HasFlag(MouseButtons.Middle)) { MainCamera.Rotate(delta); } // Rotate shape if (Control.MouseButtons.HasFlag(MouseButtons.Left)) { ShapeRotationAngle += new vec2(delta.y, delta.x); } } // Move camera var moveDelta = new vec3(0.0f, 0.0f, 0.0f); if (Keyboard.IsKeyDown(Key.W)) { moveDelta.z -= 1.0f; } if (Keyboard.IsKeyDown(Key.S)) { moveDelta.z += 1.0f; } if (Keyboard.IsKeyDown(Key.A)) { moveDelta.x -= 1.0f; } if (Keyboard.IsKeyDown(Key.D)) { moveDelta.x += 1.0f; } if (Control.MouseButtons.HasFlag(MouseButtons.XButton1)) { moveDelta.y -= 1.0f; } if (Control.MouseButtons.HasFlag(MouseButtons.XButton2)) { moveDelta.y += 1.0f; } ShapeScale += Scroll / 10.0f; Scroll = 0.0f; MainCamera.Move(moveDelta); // Arrows var keyLeft = Keyboard.IsKeyDown(Key.Left); var keyRight = Keyboard.IsKeyDown(Key.Right); if (!LastKeyLeft && keyLeft) { Voltages.Back(); } if (!LastKeyRight && keyRight) { Voltages.Forward(); } if (Keyboard.IsKeyDown(Key.Up)) { ElectrodeMaxDistance += 0.25f; } if (Keyboard.IsKeyDown(Key.Down)) { ElectrodeMaxDistance -= 0.25f; } LastKeyLeft = keyLeft; LastKeyRight = keyRight; }
private void LoadEEGData(OpenGL gl) { Electrodes.Load().Wait(); Voltages.Init().Wait(); }
private void Bg2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (powerOn == false && meterConnected == true) { if (pass == true) { ID.Text = SerialNumber.Text; Test480.Text = "480V Test Passed"; DateTime aDate = DateTime.Now; //string time = aDate.ToString("dddd, dd MMMM yyyy HH:mm:ss"); string result = "Pass"; string result240 = "Pass"; string result480 = "Pass"; string barCode = SerialNumber.Text; string supplierCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 1); string dateCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 2); string serialNumber = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 3); string partNumber = _stringHelper.RemoveLaggingChars(SerialNumber.Text); string leadsCover = "Yes"; DatabaseHelper.AddData(barCode, partNumber, supplierCode, dateCode, serialNumber, leadsCover, result240, dcVoltage1.ToString(), result480, dcVoltage2.ToString(), result, aDate); Fail.Text = ""; Pass.Text = "PASS"; Pass.Foreground = Brushes.Green; } if (fail == true) { ID.Text = SerialNumber.Text; Test480.Text = "480V Test Failed"; DateTime aDate = DateTime.Now; //string time = aDate.ToString("dddd, dd MMMM yyyy HH:mm:ss"); string result = "Fail"; string result240 = "Pass"; string result480 = "Fail"; string barCode = SerialNumber.Text; string supplierCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 1); string dateCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 2); string serialNumber = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 3); string partNumber = _stringHelper.RemoveLaggingChars(SerialNumber.Text); string leadsCover = "Yes"; DatabaseHelper.AddData(barCode, partNumber, supplierCode, dateCode, serialNumber, leadsCover, result240, dcVoltage1.ToString(), result480, dcVoltage2.ToString(), result, aDate); Pass.Text = ""; Fail.Text = "FAIL"; Fail.Foreground = Brushes.Red; } if (fail240 == true) { ID.Text = SerialNumber.Text; Test240.Text = "240V Test Failed"; DateTime aDate = DateTime.Now; //string time = aDate.ToString("dddd, dd MMMM yyyy HH:mm:ss"); string result = "Fail"; string result240 = "Fail"; string result480 = ""; string barCode = SerialNumber.Text; string supplierCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 1); string dateCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 2); string serialNumber = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 3); string partNumber = _stringHelper.RemoveLaggingChars(SerialNumber.Text); string leadsCover = "Yes"; DatabaseHelper.AddData(barCode, partNumber, supplierCode, dateCode, serialNumber, leadsCover, result240, dcVoltage1.ToString(), result480, dcVoltage2.ToString(), result, aDate); Pass.Text = ""; Fail.Text = "FAIL"; Fail.Foreground = Brushes.Red; } if (coverOpen == true) { MessageBox.Show("Check if Cover is closed. Check if leads are connected. Check if Base is assembled properly."); DateTime aDate = DateTime.Now; //string time = aDate.ToString("dddd, dd MMMM yyyy HH:mm:ss"); string result = ""; string result240 = ""; string result480 = ""; string barCode = SerialNumber.Text; string supplierCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 1); string dateCode = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 2); string serialNumber = _stringHelper.RemoveLeadingChars(SerialNumber.Text, 3); string partNumber = _stringHelper.RemoveLaggingChars(SerialNumber.Text); string leadsCover = "No"; dcVoltage1 = double.NaN; DatabaseHelper.AddData(barCode, partNumber, supplierCode, dateCode, serialNumber, leadsCover, result240, dcVoltage1.ToString(), result480, dcVoltage2.ToString(), result, aDate); } SerialNumber.Text = ""; IsOn.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); IsOn.Text = "Power ON"; form = null; base_ = null; while (Math.Abs(myDmm.Measure()) > 5.0) { } Measage1.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); Measage2.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); } else if (powerOn == true) { Test240.Text = ""; Test480.Text = ""; Voltages.Clear(); Voltages2.Clear(); SerialNumber.Text = ""; form = null; base_ = null; while (Math.Abs(myDmm.Measure()) > 5.0) { } Measage1.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); Measage2.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); } else if (meterConnected == false) { IsOn.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); IsOn.Text = "Power ON"; SerialNumber.Text = ""; Test240.Text = ""; Test480.Text = ""; Voltages.Clear(); Voltages2.Clear(); form = null; base_ = null; } else if (power480 == false) { SerialNumber.Text = ""; Voltages.Clear(); Voltages2.Clear(); IsOn.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); IsOn.Text = "Power ON"; MessageBox.Show("480V POWER UP FAIL: " + power.fail); form = null; base_ = null; while (Math.Abs(myDmm.Measure()) > 5.0) { } Measage1.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); Measage2.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#C0C0C0")); } }
private void SerialNumber_TextChanged(object sender, TextChangedEventArgs e) { if (SerialNumber.Text.Length >= 26) { ID.Text = ""; Fail.Text = ""; Pass.Text = ""; Test240.Text = ""; Test480.Text = ""; fail = false; pass = false; fail240 = false; coverOpen = false; dcVoltage1 = double.NaN; dcVoltage2 = double.NaN; Application.Current.Dispatcher.Invoke(() => Voltages.Clear()); Application.Current.Dispatcher.Invoke(() => Voltages2.Clear()); string trim = SerialNumber.Text.Trim(); if (_stringHelper.NumberComplete(trim) == true) { string baseNumber = _stringHelper.RemoveLaggingChars(SerialNumber.Text); result1 = DatabaseHelper.SetForm_Base(baseNumber); foreach (var x in result1) { form = x.form_no; base_ = x.base_; } if (form != null && base_ != null) { Launch(); } else { MessageBox.Show("INVAILD BASE NUMBER"); SerialNumber.Text = ""; form = null; base_ = null; } } else if (trim.Length >= 28) { MessageBox.Show("INVAILD BASE NUMBER"); SerialNumber.Text = ""; } } }
/// <summary> /// Sets the sample rate of the voltage and current data sets. /// </summary> /// <param name="sampleRate"></param> public void SetSampleRates(int sampleRate) { Voltages.SetSampleRate(sampleRate); Currents.SetSampleRate(sampleRate); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Voltages obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
/// <summary> /// Uses system frequency to calculate the sample rate for each set of /// <see cref="MeasurementData"/> in the voltage and current data sets. /// </summary> public void CalculateSampleRates() { Voltages.CalculateSampleRates(m_frequency); Currents.CalculateSampleRates(m_frequency); }