Exemplo n.º 1
0
        private void UpdateValues()
        {
            var changes = new ChangeSet();
            var now     = DateTime.Now;

            changes.Update(new Binary(closed, 1, now), 0);

            if (closed)
            {
                changes.Update(new Analog(currentA.Current, 1, now), 0);
                changes.Update(new Analog(currentB.Current, 1, now), 1);
                changes.Update(new Analog(currentC.Current, 1, now), 2);

                this.labelValueIA.Text = String.Format("IA: {0}", currentA.Current);
                this.labelValueIB.Text = String.Format("IB: {0}", currentB.Current);
                this.labelValueIC.Text = String.Format("IC: {0}", currentC.Current);

                currentA.MoveNext();
                currentB.MoveNext();
                currentC.MoveNext();
            }
            else
            {
                changes.Update(new Analog(0, 1, now), 0);
                changes.Update(new Analog(0, 1, now), 1);
                changes.Update(new Analog(0, 1, now), 2);

                this.labelValueIA.Text = String.Format("IA: {0}", 0);
                this.labelValueIB.Text = String.Format("IB: {0}", 0);
                this.labelValueIC.Text = String.Format("IC: {0}", 0);
            }

            changes.Update(new Analog(voltageA.Current, 1, now), 3);
            changes.Update(new Analog(voltageB.Current, 1, now), 4);
            changes.Update(new Analog(voltageC.Current, 1, now), 5);

            this.labelValueVA.Text = String.Format("VA: {0}", voltageA.Current);
            this.labelValueVB.Text = String.Format("VB: {0}", voltageB.Current);
            this.labelValueVC.Text = String.Format("VC: {0}", voltageC.Current);

            voltageA.MoveNext();
            voltageB.MoveNext();
            voltageC.MoveNext();

            outstation.Load(changes);
        }
Exemplo n.º 2
0
        private void ChangeSignal(int index, Func <IConvertible> getValue, Action <ChangeSet> Adder)
        {
            var changeset = new ChangeSet();
            var value     = getValue();

            var dvalue  = Convert.ToDouble(value);
            var longTag = typeof(Analog).Name + "_" + index;

            if (dvalue == values[index] || testConfig.eventRecorder.HasValue(longTag, dvalue))
            {
                return;
            }
            values[index] = dvalue;
            Adder(changeset);
            outstation.Load(changeset);
            Console.WriteLine("----------Changing value:" + longTag + " -> " + index + ";Value:" + dvalue);
            testConfig.eventRecorder.AddEvent(longTag, dvalue);
        }