示例#1
0
 public void AddValue(string code, DateTime?time, double?value, int?status)
 {
     if (ucGraphic.DictionaryOfGraphics.ContainsKey(code))
     {
         var dot = new MomentReal(time ?? DateTime.Now, value ?? 0, 0, status ?? 1, 0);
         ucGraphic.DictionaryOfGraphics[code].Add(dot);
     }
 }
示例#2
0
        private void UpdateGraphic(DateTime upgTime)
        {
            foreach (NewModuleAdamAbstract module in Program.Net.Modules)
            {
                foreach (NewChannelAbstract channel in module.Channels)
                {
                    if (ucGraphic.DictionaryOfGraphics.ContainsKey(channel.Code))
                    {
                        DateTime time   = channel.Time ?? DateTime.Now;
                        double   value  = channel.Value ?? 0;
                        int      status = channel.Status != null ? (int)channel.Status : 1;

                        var dot = new MomentReal(time, value, 0, status, 0);
                        ucGraphic.DictionaryOfGraphics[channel.Code].Add(dot);
                    }
                }
            }
        }
示例#3
0
        public void AddGraphic(string code, string name, string comment, string units, DataType dataType, double?min, double?max)
        {
            var graphicSeries = new Graphic(code, name, "", units, DataType.Real, min, max);

            if (_fg)
            {
                _time0 = DateTime.Now;
            }

            var dot = new MomentReal(_time0, 0.6 * (max ?? 0 + min ?? 0), 0, 1, 0);

            graphicSeries.IsUpdated = true;
            graphicSeries.Add(dot);
            graphicSeries.IsUpdated = false;

            ucGraphic.DictionaryOfGraphics.Add(code, graphicSeries);

            graphicSeries.Series.Color = Colors.GetColor();

            int i;

            for (i = 0; i < Numbers.Count; i++)
            {
                if (Numbers[i] == false)
                {
                    Numbers[i] = true;
                }
            }
            if (i == Numbers.Count)
            {
                Numbers.Add(true);
            }
            graphicSeries.Number = ++i;

            if (_fg)
            {
                ucGraphic.Draw();
                _fg = false;
            }
        }
示例#4
0
        //public void AddGraphic(string moduleAddress, string channel)
        //{
        //    var addr = Convert.ToString(int.Parse(moduleAddress), 16).ToUpper();
        //    if (addr.Length == 1) addr = "0" + addr;

        //    //-int ch = int.Parse(channel);
        //    byte ch = byte.Parse(channel);

        //    var code = Program.Net.Modules[addr].Channels[ch].Code ?? addr + "." + channel;
        //    //var code = addr + "." + channel;

        //    //-var chn = channel != "CJC" ? Program.Net.Modules[addr].Channels[ch] : Program.Net.Modules[addr]).Cjc;
        //    var chn = (channel != "CJC") ? Program.Net.Modules[addr].Channels[ch] : ((NewModuleAdam4019Plus)Program.Net.Modules[addr]).Cjc;

        //    //-EChannelStatus status;
        //    NewEnumSignalStatus status;

        //    /*
        //    double? min = (chn.Min == null) || (chn.Conversion == null)
        //                ? chn.Min : ClassAbstractAdamChannel.SignalConversion((double) chn.Min, chn.Conversion, out err);

        //    double? max = (chn.Max == null) || (chn.Conversion == null)
        //                ? chn.Max : ClassAbstractAdamChannel.SignalConversion((double) chn.Max, chn.Conversion, out err);
        //    */

        //    double? min = (chn.Min == null) || (chn.Conversion == null)
        //                ? chn.Min : chn.SignalConversion((double)chn.Min, out status);

        //    double? max = (chn.Max == null) || (chn.Conversion == null)
        //                ? chn.Max : chn.SignalConversion((double)chn.Max, out status);

        //    //-var graphicSeries = new Graphic(code, chn.Name, "", chn.DataFormat, DataType.Real, min, max);

        //    string dataFormat = null;

        //    switch(chn.Module.ModuleType)
        //    {
        //        case "Adam4019+":
        //            dataFormat = ((NewModuleAdam4019Plus) chn.Module).DataFormat;
        //            break;
        //    }

        //    //-var graphicSeries = new Graphic(code, chn.Name, "", ((NewModuleAdam4019Plus)chn.Module).DataFormat, DataType.Real, min, max);
        //    var graphicSeries = new Graphic(code, chn.Name, "", dataFormat, DataType.Real, min, max);

        //    //if ((chn.Time != null) && (chn.Status != null))
        //    //{
        //    //    double value = chn.Value ?? 0;

        //    //    var dot = new MomentReal((DateTime) chn.Time, value, 0, (int) chn.Status, 0);
        //    //    graphicSeries.IsUpdated = true;
        //    //    graphicSeries.Add(dot);
        //    //    graphicSeries.IsUpdated = false;
        //    //}

        //    DateTime time = chn.Time ?? DateTime.Now;
        //    double value = chn.Value ?? 0;
        //    int stat = chn.Status != null ? (int) chn.Status : 1;

        //    var dot = new MomentReal(time, value, 0, stat, 0);
        //    graphicSeries.IsUpdated = true;
        //    graphicSeries.Add(dot);
        //    graphicSeries.IsUpdated = false;

        //    ucGraphic.DictionaryOfGraphics.Add(code, graphicSeries);

        //    graphicSeries.Series.Color = Colors.GetColor();
        //    graphicSeries.Number = 1;

        //    ucGraphic.Draw();
        //}

        public void AddGraphic(string code)
        {
            var chn = Program.Net.Modules.Channel(code);

            NewEnumSignalStatus status;
            double?min = (chn.Min == null) || (chn.Conversion == null) ? chn.Min : chn.SignalConversion((double)chn.Min, out status);
            double?max = (chn.Max == null) || (chn.Conversion == null) ? chn.Max : chn.SignalConversion((double)chn.Max, out status);

            string dataFormat = null;

            switch (chn.Module.ModuleType)
            {
            case "Adam4019+":
                dataFormat = ((NewModuleAdam4019Plus)chn.Module).DataFormat;
                break;
            }

            var graphicSeries = new Graphic(code, chn.Name, "", dataFormat, DataType.Real, min, max);

            DateTime time  = chn.Time ?? DateTime.Now;
            double   value = chn.Value ?? 0;
            int      stat  = chn.Status != null ? (int)chn.Status : 1;

            var dot = new MomentReal(time, value, 0, stat, 0);

            graphicSeries.IsUpdated = true;
            graphicSeries.Add(dot);
            graphicSeries.IsUpdated = false;

            ucGraphic.DictionaryOfGraphics.Add(code, graphicSeries);

            graphicSeries.Series.Color = Colors.GetColor();
            graphicSeries.Number       = 1;

            ucGraphic.Draw();
        }