public static double getDoubleVal(PISDK.PIValue value) { if (value.Value.GetType().IsCOMObject) { PISDK.DigitalState myDigState; myDigState = value.Value as PISDK.DigitalState; return myDigState.Code; } else { double v = Convert.ToDouble(value.Value); return v; }; }
public static String getStringValue(PISDK.PIValue value, String numberFormat = "{0}") { if (value.Value.GetType().IsCOMObject) { PISDK.DigitalState myDigState; myDigState = value.Value as PISDK.DigitalState; if (value != null) return myDigState.Name; else return "&&&"; } else { return String.Format(numberFormat, value.Value); }; }
// Modified From WHITEPAPER ConvertAFValues private static double[] PIValuesToArray(PISDK.PIValues piValues) { double[] dblArray = new double[piValues.Count]; for (Int32 i = 0; i < piValues.Count; i++) { try { dblArray[i] = double.Parse(piValues[i + 1].Value.ToString()); } catch { } } return dblArray; }
private PIPoint readPIPoint(PISDK.Server piServer, string tagName) { return piSDK.GetPoint("\\\\" + piServer.Path.ToString() + "\\" + tagName); }