public static void Main1()
            {
                var easyDAClient = new EasyDAClient();

                DAVtq vtq = easyDAClient.ReadItem("", "AutoJet.ACPFileServerDA.1", "Simulation.Random");

                Console.WriteLine("Vtq: {0}", vtq);
            }
예제 #2
0
        public override string FormatOpcTimestamp(DAVtq opcValue)
        {
            if (opcValue != null)
            {
                return(this.FormatTimestamp(opcValue.Timestamp));
            }

            return(InvalidValue);
        }
예제 #3
0
        public override string FormatOpcQuality(DAVtq opcValue)
        {
            if (opcValue != null)
            {
                return(opcValue.Quality.ToString());
            }

            return(InvalidValue);
        }
예제 #4
0
            static void ReadAndDisplay([NotNull] string itemId)
            {
                Console.WriteLine();
                Console.WriteLine("Reading \"{0}\"...", itemId);

                DAVtq vtq = Client.ReadItem("AutoJet.ACPFileServerDA.1", itemId);

                Console.WriteLine("Vtq: {0}", vtq);
            }
        /// <summary>
        /// Formats the opc value for the display. SupplyCare enterprise and FIS can deal only with English numbers, that's why
        /// the English culture is hardcoded here.
        /// </summary>
        /// <param name="opcValue">The opc value.</param>
        /// <returns>The formatted value.</returns>
        protected string DisplayValue(DAVtq opcValue)
        {
            if (opcValue != null && opcValue.Value != null)
            {
                return(string.Format(this.CultureInfo, "{0}", opcValue.Value));
            }

            return(InvalidValue);
        }
예제 #6
0
            public static void BrowsePath()
            {
                var easyDAClient = new EasyDAClient();

                DAVtq vtq = easyDAClient.ReadItem(
                    new ServerDescriptor("", "AutoJet.ACPFileServerDA.1"),
                    new DAItemDescriptor(null, "/Simulation/Random"));

                Console.WriteLine("Vtq: {0}", vtq);
            }
            public static void GetTypeCode()
            {
                var easyDAClient = new EasyDAClient();

                DAVtq vtq = easyDAClient.ReadItem("", "AutoJet.ACPFileServerDA.1", "Simulation.Random");

                if (vtq.Value != null)
                {
                    TypeCode typeCode = Type.GetTypeCode(vtq.Value.GetType());

                    Console.WriteLine("TypeCode: {0}", typeCode);
                }
            }
        /// <summary>
        /// Sets the opc value.
        /// </summary>
        /// <param name="reference">The monitored item reference.</param>
        /// <param name="opcValue">The OPC value structure.</param>
        private void SetOpcValue(MonitoredItemReference reference, DAVtq opcValue)
        {
            switch (reference.FieldType)
            {
            case FieldTypes.Quality:
                this.RuntimeMeasurements[reference.Index].Quality = this.FormatOpcVtq(reference.MappingType, opcValue);
                break;

            case FieldTypes.Timestamp:
                this.RuntimeMeasurements[reference.Index].Timestamp = this.FormatOpcVtq(reference.MappingType, opcValue);
                break;

            case FieldTypes.Unit:
                this.RuntimeMeasurements[reference.Index].Unit = this.FormatOpcVtq(reference.MappingType, opcValue);
                break;

            case FieldTypes.Value:
                this.RuntimeMeasurements[reference.Index].Value = this.FormatOpcVtq(reference.MappingType, opcValue);
                break;
            }
        }
        /// <summary>
        /// Formats the complete value structure from OPC.
        /// </summary>
        /// <param name="mappingType">The mapping type.</param>
        /// <param name="opcValue">The opc value.</param>
        /// <returns>The formatted value</returns>
        private string FormatOpcVtq(MappingTypes mappingType, DAVtq opcValue)
        {
            // This should never happen at this point.
            var formattedValue = DisplayInvalidValue;

            // The mapping type at this point is an OPC mapping type.
            switch (mappingType)
            {
            case MappingTypes.OpcValueType:
                formattedValue = this.FormatOpcValue(opcValue);
                break;

            case MappingTypes.OpcTimestampType:
                formattedValue = this.FormatOpcTimestamp(opcValue);
                break;

            case MappingTypes.OpcQualityType:
                formattedValue = this.FormatOpcQuality(opcValue);
                break;
            }

            return(formattedValue);
        }
예제 #10
0
 public override string FormatOpcValue(DAVtq opcValue)
 {
     return(this.DisplayValue(opcValue));
 }
예제 #11
0
 /// <summary>
 /// Formats the opc timestamp.
 /// </summary>
 /// <param name="opcValue">The opc value.</param>
 /// <returns>The formatted timestamp.</returns>
 public override string FormatOpcTimestamp(DAVtq opcValue)
 {
     return(this.FormatTimestamp(opcValue.Timestamp));
 }
예제 #12
0
 /// <summary>
 /// Formats the opc quality.
 /// </summary>
 /// <param name="opcValue">The opc value.</param>
 /// <returns>The formatted quality.</returns>
 public override string FormatOpcQuality(DAVtq opcValue)
 {
     return(opcValue.Quality.ToString());
 }
 /// <summary>
 /// Formats the opc timestamp.
 /// </summary>
 /// <param name="opcValue">The opc value.</param>
 /// <returns>The formatted timestamp.</returns>
 public virtual string FormatOpcTimestamp(DAVtq opcValue)
 {
     return(null);
 }
 /// <summary>
 /// Formats the opc quality.
 /// </summary>
 /// <param name="opcValue">The opc value.</param>
 /// <returns>The formatted quality.</returns>
 public virtual string FormatOpcQuality(DAVtq opcValue)
 {
     return(null);
 }