Beispiel #1
0
        private DeviceData ParseNuclideData(NuclideData nd, DateTime time)
        {
            object[] data = new object[] {
                time, nd.Name, nd.Activity, nd.Indication, nd.DoseRate, nd.Channel, nd.Energy
            };
            DeviceData dd = new DeviceData(this, data);

            dd.InsertIntoCommand = this.insertIntoCommand2;
            return(dd);
        }
Beispiel #2
0
        // TODO: CalibrationNuclideFound and ReferencePeakEnergyFromPosition
        private NuclideDataSet ParseData(XmlDocument doc, XmlNamespaceManager nsmgr)
        {
            //
            string st = doc.Value("//a:Spectrum/a:StartTime", nsmgr);
            // Basicly, we use the EndTime.
            string et = doc.Value("//s:EndTime", nsmgr);


            string co = doc.Value("//a:Calibration[@Type='Energy']//a:Coefficients", nsmgr);

            if (string.IsNullOrEmpty(co))
            {
                co = doc.Value("//a:Coefficients", nsmgr);
            }

            string cd = doc.Value("//a:ChannelData", nsmgr);

            string dr = doc.Value("//a:DoseRate", nsmgr);

            if (dr != null && dr.Length > 0)
            {
                double v;
                if (double.TryParse(dr, out v))
                {
                    dr = (v * 1000).ToString();
                }
                else
                {
                    dr = "0.0 (ERR)";
                }
            }
            string tp = doc.Value("//s:Temperature", nsmgr);
            string hv = doc.Value("//s:HighVoltage", nsmgr);

            // 参考核素状态
            string ns = doc.Value("//s:CalibrationNuclideFound", nsmgr);
            // 参考核素能量
            string ne = doc.Value("//s:ReferencePeakEnergyFromPosition", nsmgr);

            NuclideDataSet set = new NuclideDataSet();

            set.StartTime                       = st;
            set.EndTime                         = et;
            set.Coefficients                    = co;
            set.ChannelData                     = cd;
            set.DoseRate                        = dr;
            set.Temperature                     = tp;
            set.HighVoltage                     = hv;
            set.CalibrationNuclideFound         = (bool)(ns != "false");
            set.ReferencePeakEnergyFromPosition = ne;

            XmlNodeList list = doc.SelectNodes("//a:Nuclide", nsmgr);

            foreach (XmlNode n in list)
            {
                string nn = n.Value("a:NuclideName", nsmgr);

                string ni = n.Value("a:NuclideIDConfidenceIndication", nsmgr);

                string na = n.Value("a:NuclideActivity", nsmgr);

                string nd = n.Value("s:DoseRate", nsmgr);
                if (nd != null && nd.Length > 0)
                {
                    double v;
                    if (double.TryParse(nd, out v))
                    {
                        nd = (v * 1000).ToString();
                    }
                    else
                    {
                        nd = "0.0 (ERR)";
                    }
                }


                string ch = string.Empty;
                string en = string.Empty;

                var peak = n.SelectSingleNode("s:Peak", nsmgr);
                if (peak != null)
                {
                    foreach (XmlAttribute attr in peak.Attributes)
                    {
                        string attrName = attr.Name.ToLower();
                        if (attrName == "channel")
                        {
                            ch = attr.Value;
                        }
                        else if (attrName == "energy")
                        {
                            en = attr.Value;
                        }
                    }
                }

                NuclideData data = new NuclideData()
                {
                    Name    = nn, Activity = na, Indication = ni, DoseRate = nd,
                    Channel = ch, Energy = en
                };
                set.AddNuclideData(data);
            }

            return(set);
        }
Beispiel #3
0
 public void AddNuclideData(NuclideData nd)
 {
     sets.Add(nd);
 }
Beispiel #4
0
		// TODO: CalibrationNuclideFound and ReferencePeakEnergyFromPosition
        private NuclideDataSet ParseData(XmlDocument doc, XmlNamespaceManager nsmgr)
        {
            // 
            string st = doc.Value("//a:Spectrum/a:StartTime", nsmgr);
            // Basicly, we use the EndTime.
            string et = doc.Value("//s:EndTime", nsmgr);

            string co = doc.Value("//a:Coefficients", nsmgr);

            string cd = doc.Value("//a:ChannelData", nsmgr);

            string dr = doc.Value("//a:DoseRate", nsmgr);
            if (dr != null && dr.Length > 0)
            {
                double v;
                if (double.TryParse(dr, out v))
                {
                    dr = (v * 1000).ToString();
                }
                else
                {
                    dr = "0.0 (ERR)";
                }
            }
            string tp = doc.Value("//s:Temperature", nsmgr);
            string hv = doc.Value("//s:HighVoltage", nsmgr);

            // 参考核素状态
            string ns = doc.Value("//s:CalibrationNuclideFound", nsmgr);
            // 参考核素能量
            string ne = doc.Value("//s:ReferencePeakEnergyFromPosition", nsmgr);

            NuclideDataSet set = new NuclideDataSet();
            set.StartTime = st;
            set.EndTime = et;
            set.Coefficients = co;
            set.ChannelData = cd;
            set.DoseRate = dr;
            set.Temperature = tp;
            set.HighVoltage = hv;
            set.CalibrationNuclideFound = (bool)(ns != "false");
            set.ReferencePeakEnergyFromPosition = ne;

            XmlNodeList list = doc.SelectNodes("//a:Nuclide", nsmgr);

            foreach (XmlNode n in list)
            {
                string nn = n.Value("a:NuclideName", nsmgr);

                string ni = n.Value("a:NuclideIDConfidenceIndication", nsmgr);

                string na = n.Value("a:NuclideActivity", nsmgr);

                string nd = n.Value("s:DoseRate", nsmgr);
                if (nd != null && nd.Length > 0)
                {
                    double v;
                    if (double.TryParse(nd, out v))
                    {
                        nd = (v * 1000).ToString();
                    }
                    else
                    {
                        nd = "0.0 (ERR)";
                    }
                }


                string ch = string.Empty;
                string en = string.Empty;

                var peak = n.SelectSingleNode("s:Peak", nsmgr);
                if (peak != null)
                {
                    foreach (XmlAttribute attr in peak.Attributes)
                    {
                        string attrName = attr.Name.ToLower();
                        if (attrName == "channel")
                        {
                            ch = attr.Value;
                        }
                        else if (attrName == "energy")
                        {
                            en = attr.Value;
                        }
                    }
                }

                NuclideData data = new NuclideData() { 
                    Name = nn, Activity = na, Indication = ni, DoseRate = nd,
                    Channel = ch, Energy = en
                };
                set.AddNuclideData(data);
            }

            return set;
        }
Beispiel #5
0
 private DeviceData ParseNuclideData(NuclideData nd, DateTime time)
 {
     object[] data = new object[]{
         time, nd.Name, nd.Activity, nd.Indication, nd.DoseRate, nd.Channel, nd.Energy
     };
     DeviceData dd = new DeviceData(this, data);
     dd.InsertIntoCommand = this.insertIntoCommand2;
     return dd;
 }
Beispiel #6
0
 public void AddNuclideData(NuclideData nd)
 {
     sets.Add(nd);
 }