Ejemplo n.º 1
0
 public NetworkValue(BaseUDPInterface sourceInterface, string id, string device, string name, string description, string valueDescription, BindingValueUnit unit, string exportFormat)
     : base(sourceInterface)
 {
     _id = id;
     _format = exportFormat;
     _value = new HeliosValue(sourceInterface, BindingValue.Empty, device, name, description, valueDescription, unit);
     Values.Add(_value);
     Triggers.Add(_value);
 }
Ejemplo n.º 2
0
        private void CreateSignal(string name, BindingValueUnit unit)
        {
            HeliosValue numericSignal = new HeliosValue(this, BindingValue.Empty, "", name, "Current signal on this wire.",
                                                        "Value copied from input to output.", unit);

            numericSignal.Execute += (action, args) => numericSignal.SetValue(args.Value, false);
            Actions.Add(numericSignal);
            Triggers.Add(numericSignal);
            Values.Add(numericSignal);
        }
Ejemplo n.º 3
0
 public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
 {
     if (from is DegreesUnit)
     {
         return new BindingValue(value.DoubleValue / 57.3d);
     }
     else
     {
         return new BindingValue(value.DoubleValue * 57.3d);
     }
 }
Ejemplo n.º 4
0
 public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
 {
     if (from is DegreesUnit)
     {
         return(new BindingValue(value.DoubleValue / 57.3d));
     }
     else
     {
         return(new BindingValue(value.DoubleValue * 57.3d));
     }
 }
Ejemplo n.º 5
0
        public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
        {
            SpeedUnit fromUnit = from as SpeedUnit;
            SpeedUnit toUnit   = to as SpeedUnit;

            if (fromUnit != null && toUnit != null)
            {
                double newValue = ((value.DoubleValue * fromUnit.DistanceUnit.ConversionFactor) / toUnit.DistanceUnit.ConversionFactor) / (fromUnit.TimeUnit.ConversionFactor / toUnit.TimeUnit.ConversionFactor);
                return(new BindingValue(newValue));
            }
            else
            {
                return(BindingValue.Empty);
            }
        }
Ejemplo n.º 6
0
        public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
        {
            PressureUnit fromUnit = from as PressureUnit;
            PressureUnit toUnit   = to as PressureUnit;

            if (fromUnit != null && toUnit != null)
            {
                double newValue = ((value.DoubleValue * fromUnit.MassConversionFactor) / toUnit.MassConversionFactor) / (fromUnit.AreaConversionFactor / toUnit.AreaConversionFactor);
                return(new BindingValue(newValue));
            }
            else
            {
                return(BindingValue.Empty);
            }
        }
Ejemplo n.º 7
0
        public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
        {
            PressureUnit fromUnit = from as PressureUnit;
            PressureUnit toUnit = to as PressureUnit;

            if (fromUnit != null && toUnit != null)
            {
                double newValue = ((value.DoubleValue * fromUnit.MassConversionFactor) / toUnit.MassConversionFactor) / (fromUnit.AreaConversionFactor / toUnit.AreaConversionFactor);
                return new BindingValue(newValue);
            }
            else
            {
                return BindingValue.Empty;
            }
        }
Ejemplo n.º 8
0
        public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
        {
            AreaUnit fromUnit = from as AreaUnit;
            AreaUnit toUnit   = to as AreaUnit;

            if (fromUnit != null && toUnit != null)
            {
                double newValue = (value.DoubleValue * fromUnit.ConversionFactor) / toUnit.ConversionFactor;
                return(new BindingValue(newValue));
            }
            else
            {
                return(BindingValue.Empty);
            }
        }
Ejemplo n.º 9
0
        public override BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to)
        {
            TimeUnit fromUnit = from as TimeUnit;
            TimeUnit toUnit = to as TimeUnit;

            if (fromUnit != null && toUnit != null)
            {
                double newValue = (value.DoubleValue * fromUnit.ConversionFactor) / toUnit.ConversionFactor;
                return new BindingValue(newValue);
            }
            else
            {
                return BindingValue.Empty;
            }
        }
Ejemplo n.º 10
0
 private void AddNeedle(string name, string needleImage, string actionIdentifier, string valueDescription,
                        Point posn, Size size, Point centerPoint, BindingValueUnit typeValue, double[] initialCalibration, double[,] calibrationPoints = null)
 {
     AddNeedle(name: name,
               needleImage: needleImage,
               posn: posn,
               size: size,
               centerPoint: centerPoint,
               interfaceDeviceName: _interfaceDeviceName,
               interfaceElementName: name,
               actionIdentifier: actionIdentifier,
               valueDescription: valueDescription,
               typeValue: typeValue,
               initialCalibration: initialCalibration,
               calibrationPoints: calibrationPoints,
               fromCenter: false);
 }
Ejemplo n.º 11
0
        public Mk2CNeedle(string name, string needleWay, string actionIdentifier, string valueDescription,
                          Point posn, Size size, Point centerPoint, BindingValueUnit typeValue, double[] initialCalibration, double[,] calibrationPoints)
            : base(name, size)
        {
            _needleCalibration = new CalibrationPointCollectionDouble(initialCalibration[0], initialCalibration[1], initialCalibration[2], initialCalibration[3]);
            if (calibrationPoints != null)
            {
                for (int c = 0; c < calibrationPoints.Length / 2; c++)
                {
                    _needleCalibration.Add(new CalibrationPointDouble(calibrationPoints[c, 0], calibrationPoints[c, 1]));
                }
            }
            _needle = new GaugeNeedle(needleWay, posn, size, centerPoint);
            Components.Add(_needle);

            _value          = new HeliosValue(this, new BindingValue(0d), "", actionIdentifier, name + " - " + actionIdentifier, valueDescription, typeValue);
            _value.Execute += new HeliosActionHandler(NeedleValue_Execute);
            Actions.Add(_value);
        }
 /// <summary>
 /// Converts value from one unit to another.
 /// </summary>
 /// <param name="value">Value which will be converted.</param>
 /// <param name="from">Unit which this value is currently in.</param>
 /// <param name="to">Unit to use for the return value.</param>
 /// <returns></returns>
 public abstract BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to);
 /// <summary>
 /// Returns a list of units which this converter can convert between.  Converter must be able to convert betwen any of the
 /// given return units.
 /// </summary>
 public abstract bool CanConvert(BindingValueUnit from, BindingValueUnit to);
Ejemplo n.º 14
0
        protected Mk2CNeedle AddNeedle(string name, string needleImage, Point posn, Size size, Point centerPoint,
                                       string interfaceDeviceName, string interfaceElementName, string actionIdentifier, string valueDescription, BindingValueUnit typeValue,
                                       double[] initialCalibration, double[,] calibrationPoints, bool fromCenter)
        {
            if (fromCenter)
            {
                posn = FromCenter(posn, size);
            }
            string componentName = GetComponentName(name);

            Mk2CNeedle newNeedle = new Mk2CNeedle(componentName, needleImage, actionIdentifier, valueDescription, posn, size, centerPoint, typeValue, initialCalibration, calibrationPoints);

            Children.Add(newNeedle);
            foreach (IBindingTrigger trigger in newNeedle.Triggers)
            {
                AddTrigger(trigger, componentName);
            }
            foreach (IBindingAction action in newNeedle.Actions)
            {
                AddAction(action, componentName);
            }

            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed",
                deviceActionName: "set." + actionIdentifier);

            return(newNeedle);
        }
Ejemplo n.º 15
0
 public override bool CanConvert(BindingValueUnit from, BindingValueUnit to)
 {
     return(from is MassFlowUnit && to is MassFlowUnit);
 }
Ejemplo n.º 16
0
 public override bool CanConvert(BindingValueUnit from, BindingValueUnit to)
 {
     return((from is RadiansUnit && to is DegreesUnit) || (from is DegreesUnit && to is RadiansUnit));
 }
 public HeliosValueWithCorrectedDeviceName(FalconInterface falconInterface, BindingValue empty, string device, string name, string description, string valueDescription, BindingValueUnit unit, string correctedDeviceName) : base(falconInterface, empty, device, name, description, valueDescription, unit)
 {
     DeviceInUserInterface = correctedDeviceName;
 }
Ejemplo n.º 18
0
 public override bool CanConvert(BindingValueUnit from, BindingValueUnit to)
 {
     return (from is TimeUnit && to is TimeUnit);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Converts value from one unit to another.
 /// </summary>
 /// <param name="value">Value which will be converted.</param>
 /// <param name="from">Unit which this value is currently in.</param>
 /// <param name="to">Unit to use for the return value.</param>
 /// <returns></returns>
 public abstract BindingValue Convert(BindingValue value, BindingValueUnit from, BindingValueUnit to);
Ejemplo n.º 20
0
 private DualNetworkValue(BaseUDPInterface sourceInterface, string id, string device, string name, string description, string valueDescription, BindingValueUnit unit, double baseValue, string exportFormat)
     : base(sourceInterface)
 {
     _pure_name  = "Pure " + name;
     _id         = id;
     _format     = exportFormat;
     _baseValue  = baseValue;
     _value      = new HeliosValue(sourceInterface, BindingValue.Empty, device, name, description, valueDescription, unit);
     _pure_value = new HeliosValue(sourceInterface, BindingValue.Empty, device, _pure_name, "Pure value in DCS", "pure value", unit);
     Values.Add(_value);
     Triggers.Add(_value);
     Values.Add(_pure_value);
     Triggers.Add(_pure_value);
 }
Ejemplo n.º 21
0
 public DualNetworkValue(BaseUDPInterface sourceInterface, string id, double scale, string device, string name, string description, string valueDescription, BindingValueUnit unit)
     : this(sourceInterface, id, scale, device, name, description, valueDescription, unit, 0d, "%.4f")
 {
 }
Ejemplo n.º 22
0
        protected HeliosValue AddValue(string device, string name, string description, string valueDescription, BindingValueUnit unit, string correctedDeviceName = null)
        {
            HeliosValue value;

            if (correctedDeviceName == null)
            {
                value = new HeliosValue(FalconInterface, BindingValue.Empty, device, name, description, valueDescription, unit);
            }
            else
            {
                value = new HeliosValueWithCorrectedDeviceName(FalconInterface, BindingValue.Empty, device, name, description, valueDescription, unit, correctedDeviceName);
            }
            FalconInterface.Triggers.Add(value);
            FalconInterface.Values.Add(value);
            _values.Add(device + "." + name, value);
            return(value);
        }
Ejemplo n.º 23
0
        protected HeliosValue AddValue(string device, string name, string description, string valueDescription, BindingValueUnit unit)
        {
            HeliosValue value = new HeliosValue(FalconInterface, BindingValue.Empty, device, name, description, valueDescription, unit);

            FalconInterface.Triggers.Add(value);
            FalconInterface.Values.Add(value);
            _values.Add(device + "." + name, value);
            return(value);
        }
Ejemplo n.º 24
0
 public override bool CanConvert(BindingValueUnit from, BindingValueUnit to)
 {
     return (from is RadiansUnit && to is DegreesUnit) || (from is DegreesUnit && to is RadiansUnit);
 }
Ejemplo n.º 25
0
 protected HeliosValue AddValue(string device, string name, string description, string valueDescription, BindingValueUnit unit)
 {
     HeliosValue value = new HeliosValue(FalconInterface, BindingValue.Empty, device, name, description, valueDescription, unit);
     FalconInterface.Triggers.Add(value);
     FalconInterface.Values.Add(value);
     _values.Add(device + "." + name, value);
     return value;
 }
Ejemplo n.º 26
0
 public override bool CanConvert(BindingValueUnit from, BindingValueUnit to)
 {
     return(from is PressureUnit && to is PressureUnit);
 }
Ejemplo n.º 27
0
 public NetworkValue(BaseUDPInterface sourceInterface, string id, string device, string name, string description, string valueDescription, BindingValueUnit unit, string exportFormat)
     : base(sourceInterface)
 {
     _id     = id;
     _format = exportFormat;
     _value  = new HeliosValue(sourceInterface, BindingValue.Empty, device, name, description, valueDescription, unit);
     Values.Add(_value);
     Triggers.Add(_value);
 }
Ejemplo n.º 28
0
 public ScaledNetworkValue(BaseUDPInterface sourceInterface, string id, CalibrationPointCollectionDouble scale, string device, string name, string description, string valueDescription, BindingValueUnit unit)
     : this(sourceInterface, id, scale, device, name, description, valueDescription, unit, "%.4f")
 {
 }
Ejemplo n.º 29
0
        private HeliosValue AddValue(string device, string name, string description, string valueDescription, BindingValueUnit unit)
        {
            HeliosValue value = new HeliosValue(this, BindingValue.Empty, device, name, description, valueDescription, unit);

            Triggers.Add(value);
            Values.Add(value);
            _values.Add(device + "." + name, value);
            return(value);
        }
Ejemplo n.º 30
0
 private HeliosValue AddValue(string device, string name, string description, string valueDescription, BindingValueUnit unit)
 {
     HeliosValue value = new HeliosValue(this, BindingValue.Empty, device, name, description, valueDescription, unit);
     Triggers.Add(value);
     Values.Add(value);
     _values.Add(device + "." + name, value);
     return value;
 }
Ejemplo n.º 31
0
 public DualNetworkValue(BaseUDPInterface sourceInterface, string id, CalibrationPointCollectionDouble scale, string device, string name, string description, string valueDescription, BindingValueUnit unit, string exportFormat)
     : this(sourceInterface, id, device, name, description, valueDescription, unit, 0d, exportFormat)
 {
     _calibratedScale = scale;
     _scale           = 0d;
 }
Ejemplo n.º 32
0
 public ScaledNetworkValue(BaseUDPInterface sourceInterface, string id, CalibrationPointCollectionDouble scale, string device, string name, string description, string valueDescription, BindingValueUnit unit, string exportFormat)
     : this(sourceInterface, id, device, name, description, valueDescription, unit, 0d, exportFormat)
 {
     _calibratedScale = scale;
     _scale = 0d;
 }
Ejemplo n.º 33
0
 public DualNetworkValue(BaseUDPInterface sourceInterface, string id, double scale, string device, string name, string description, string valueDescription, BindingValueUnit unit, double baseValue, string exportFormat)
     : this(sourceInterface, id, device, name, description, valueDescription, unit, baseValue, exportFormat)
 {
     _calibratedScale = null;
     _scale           = scale;
 }
Ejemplo n.º 34
0
 public ScaledNetworkValue(BaseUDPInterface sourceInterface, string id, double scale, string device, string name, string description, string valueDescription, BindingValueUnit unit)
     : this(sourceInterface, id, scale, device, name, description, valueDescription, unit, 0d, "%.4f")
 {
 }
Ejemplo n.º 35
0
 public ScaledNetworkValue(BaseUDPInterface sourceInterface, string id, double scale, string device, string name, string description, string valueDescription, BindingValueUnit unit, double baseValue, string exportFormat)
     : this(sourceInterface, id, device, name, description, valueDescription, unit, baseValue, exportFormat)
 {
     _calibratedScale = null;
     _scale = scale;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Returns a list of units which this converter can convert between.  Converter must be able to convert betwen any of the
 /// given return units.
 /// </summary>
 public abstract bool CanConvert(BindingValueUnit from, BindingValueUnit to);