コード例 #1
0
        //-------------------------------------------------------------------------------------------------//
        public ExperimentResult(int experimentId, string sbName, DateTime dateTime, int unitId, Configuration configuration,
            Specification specification, ResultInfo resultInfo)
            : base(experimentId, sbName, dateTime, specification.SetupId, unitId, configuration)
        {
            const string STRLOG_MethodName = "ExperimentResult";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Add the specification information
                //
                //
                // YOUR CODE HERE
                //

                //
                // Add the result information
                //
                if (resultInfo.statusCode == StatusCodes.Completed)
                {
                    //
                    // YOUR CODE HERE
                    //
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
コード例 #2
0
        //-------------------------------------------------------------------------------------------------//
        public ExperimentResult(int experimentId, string sbName, DateTime dateTime, int unitId, Configuration configuration,
            Specification specification, ResultInfo resultInfo)
            : base(experimentId, sbName, dateTime, specification.SetupId, unitId, configuration)
        {
            const string STRLOG_MethodName = "ExperimentResult";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Add the specification information
                //
                XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_formatName, specification.FormatName, false);
                if (specification.SetupId.Equals(Consts.STRXML_SetupId_NTPServer))
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_serverUrl, specification.ServerUrl, false);
                }

                //
                // Add the result information
                //
                if (resultInfo.statusCode == StatusCodes.Completed)
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_timeofday, resultInfo.timeofday, false);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_dayofweek, resultInfo.dateTime.DayOfWeek.ToString(), false);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_day, resultInfo.dateTime.Day);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_month, resultInfo.dateTime.Month);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_year, resultInfo.dateTime.Year);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_hours, resultInfo.dateTime.Hour);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_minutes, resultInfo.dateTime.Minute);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_seconds, resultInfo.dateTime.Second);
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
コード例 #3
0
        //-------------------------------------------------------------------------------------------------//
        public ExperimentResult(int experimentId, string sbName, DateTime dateTime, int unitId, Configuration configuration,
            Specification specification, ResultInfo resultInfo)
            : base(experimentId, sbName, dateTime, specification.SetupId, unitId, configuration)
        {
            const string STRLOG_MethodName = "ExperimentResult";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Add the specification information
                //
                //
                // Nothing to do here
                //

                //
                // Add the result information
                //
                if (resultInfo.statusCode == StatusCodes.Completed)
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_voltage, resultInfo.voltage.ToString("F02"), false);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_current, resultInfo.current.ToString("F03"), false);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_powerFactor, resultInfo.powerFactor.ToString("F04"), false);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speed, resultInfo.speed.ToString(), false);
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
コード例 #4
0
        //-------------------------------------------------------------------------------------------------//
        public ExperimentResult(int experimentId, string sbName, DateTime dateTime, int unitId, Configuration configuration,
            Specification specification, ResultInfo resultInfo)
            : base(experimentId, sbName, dateTime, specification.SetupId, unitId, configuration)
        {
            const string STRLOG_MethodName = "ExperimentResult";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Add the specification information
                //
                //
                // Nothing to do here
                //

                //
                // Add the result information
                //
                if (resultInfo.statusCode == StatusCodes.Completed)
                {
                    string[] measurements = null;

                    //
                    // Load XML measurements string
                    //
                    XmlDocument xmlDocument = XmlUtilities.GetXmlDocument(resultInfo.xmlMeasurements);
                    XmlNode xmlNodeRoot = XmlUtilities.GetXmlRootNode(xmlDocument, Consts.STRXML_measurements);

                    if (specification.SetupId.Equals(Consts.STRXML_SetupId_OpenCircuitVaryField) == true)
                    {
                        measurements = new string[] {
                            Consts.STRXML_fieldCurrent,
                            Consts.STRXML_speed,
                            Consts.STRXML_voltage,
                        };
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_OpenCircuitVarySpeed) == true)
                    {
                        measurements = new string[] {
                            Consts.STRXML_speed,
                            Consts.STRXML_fieldCurrent,
                            Consts.STRXML_voltage,
                        };
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_ShortCircuitVaryField) == true)
                    {
                        measurements = new string[] {
                            Consts.STRXML_fieldCurrent,
                            Consts.STRXML_speed,
                            Consts.STRXML_statorCurrent,
                        };
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_PreSynchronisation) == true)
                    {
                        measurements = new string[] {
                            Consts.STRXML_fieldCurrent,
                            Consts.STRXML_speedSetpoint,
                            Consts.STRXML_mainsVoltage,
                            Consts.STRXML_mainsFrequency,
                            Consts.STRXML_syncVoltage,
                            Consts.STRXML_syncFrequency,
                            Consts.STRXML_syncMainsPhase,
                            Consts.STRXML_synchronism,
                        };
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_Synchronisation) == true)
                    {
                        measurements = new string[] {
                            Consts.STRXML_torqueSetpoint,
                            Consts.STRXML_fieldCurrent,
                            Consts.STRXML_syncVoltage,
                            Consts.STRXML_syncFrequency,
                            Consts.STRXML_powerFactor,
                            Consts.STRXML_realPower,
                            Consts.STRXML_reactivePower,
                            Consts.STRXML_phaseCurrent,
                        };
                    }

                    if (measurements != null)
                    {
                        for (int i = 0; i < measurements.Length; i++)
                        {
                            XmlNode xmlNode = XmlUtilities.GetXmlNode(xmlNodeRoot, measurements[i]);
                            XmlDocumentFragment xmlFragment = this.xmlNodeExperimentResult.OwnerDocument.CreateDocumentFragment();
                            xmlFragment.InnerXml = xmlNode.OuterXml;
                            this.xmlNodeExperimentResult.AppendChild(xmlFragment);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
コード例 #5
0
        //-------------------------------------------------------------------------------------------------//
        public ExperimentResult(int experimentId, string sbName, DateTime dateTime, int unitId, Configuration configuration,
            Specification specification, ResultInfo resultInfo)
            : base(experimentId, sbName, dateTime, specification.SetupId, unitId, configuration)
        {
            const string STRLOG_MethodName = "ExperimentResult";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Add the specification information
                //
                if (specification.SetupId.Equals(Consts.STRXML_SetupId_VoltageVsSpeed))
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speedMin, specification.Speed.min);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speedMax, specification.Speed.max);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speedStep, specification.Speed.step);
                }
                else if (specification.SetupId.Equals(Consts.STRXML_SetupId_VoltageVsField))
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_fieldMin, specification.Field.min);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_fieldMax, specification.Field.max);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_fieldStep, specification.Field.step);
                }
                else if (specification.SetupId.Equals(Consts.STRXML_SetupId_VoltageVsLoad))
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_loadMin, specification.Load.min);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_loadMax, specification.Load.max);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_loadStep, specification.Load.step);
                }
                else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SpeedVsVoltage))
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speedMin, specification.Speed.min);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speedMax, specification.Speed.max);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_speedStep, specification.Speed.step);
                }
                else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SpeedVsField))
                {
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_fieldMin, specification.Field.min);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_fieldMax, specification.Field.max);
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_fieldStep, specification.Field.step);
                }

                //
                // Add the result information
                //
                if (resultInfo.statusCode == StatusCodes.Completed)
                {
                    if (specification.SetupId.Equals(Consts.STRXML_SetupId_VoltageVsSpeed))
                    {
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_speedVector, resultInfo.speedVector, Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_voltageVector, resultInfo.voltageVector, Consts.CHR_Splitter, false);
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_VoltageVsField))
                    {
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_fieldVector, resultInfo.fieldVector, "F02", Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_voltageVector, resultInfo.voltageVector, Consts.CHR_Splitter, false);
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_VoltageVsLoad))
                    {
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_loadVector, resultInfo.loadVector, Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_voltageVector, resultInfo.voltageVector, Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_speedVector, resultInfo.speedVector, Consts.CHR_Splitter, false);
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SpeedVsVoltage))
                    {
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_speedVector, resultInfo.speedVector, Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_voltageVector, resultInfo.voltageVector, Consts.CHR_Splitter, false);
                    }
                    else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SpeedVsField))
                    {
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_fieldVector, resultInfo.fieldVector, "F02", Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_speedVector, resultInfo.speedVector, Consts.CHR_Splitter, false);
                        XmlUtilities.SetXmlValues(this.xmlNodeExperimentResult, Consts.STRXML_voltageVector, resultInfo.voltageVector, Consts.CHR_Splitter, false);
                    }
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
コード例 #6
0
        //-------------------------------------------------------------------------------------------------//
        public ExperimentResult(int experimentId, string sbName, DateTime dateTime, int unitId, Configuration configuration,
            Specification specification, ResultInfo resultInfo)
            : base(experimentId, sbName, dateTime, specification.SetupId, unitId, configuration)
        {
            const string STRLOG_MethodName = "ExperimentResult";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Add the specification information
                //
                XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_sourceName, specification.SourceName, false);
                XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_duration, specification.Duration);
                XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_repeat, specification.Repeat);
                if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsTime) ||
                    specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTime) ||
                    specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTimeNoDelay))
                {
                    Specification.Absorber absorber = specification.AbsorberList[0];
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_absorberName, absorber.name, false);

                    int distance = specification.DistanceList[0];
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_distance, distance.ToString(), false);
                }
                else if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsDistance) ||
                    specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistance) ||
                    specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistanceNoDelay))
                {
                    Specification.Absorber absorber = specification.AbsorberList[0];
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_absorberName, absorber.name, false);

                    //
                    // Create a CSV string of distances
                    //
                    string csvDistances = string.Empty;
                    for (int i = 0; i < specification.DistanceList.Length; i++)
                    {
                        if (i > 0)
                        {
                            csvDistances += Consts.CHR_CsvSplitter;
                        }
                        csvDistances += specification.DistanceList[i].ToString();
                    }
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_distance, csvDistances, false);
                }
                else if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsAbsorber))
                {
                    //
                    // Create a CSV string of absorbers
                    //
                    string csvAbsorbers = string.Empty;
                    for (int i = 0; i < specification.AbsorberList.Length; i++)
                    {
                        if (i > 0)
                        {
                            csvAbsorbers += Consts.CHR_CsvSplitter;
                        }
                        csvAbsorbers += specification.AbsorberList[i].name;
                    }
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_absorberName, csvAbsorbers, false);

                    int distance = specification.DistanceList[0];
                    XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_distance, distance.ToString(), false);
                }

                //
                // Add the result information
                //
                if (resultInfo.statusCode == StatusCodes.Completed)
                {
                    if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsTime) ||
                        specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsDistance) ||
                        specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsAbsorber) ||
                        specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTime) ||
                        specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistance) ||
                        specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTimeNoDelay) ||
                        specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistanceNoDelay))
                    {
                        XmlUtilities.SetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_dataType, resultInfo.dataType.ToString(), false);
                        XmlNode xmlNode = XmlUtilities.GetXmlNode(this.xmlNodeExperimentResult, Consts.STRXML_dataVector);
                        XmlNode xmlNodeCopy = null;
                        XmlNode xmlNodeTemp = null;
                        for (int i = 0; i < resultInfo.dataVectors.GetLength(0); i++)
                        {
                            if (i == 0)
                            {
                                // Keep a copy of the node for more dataVectors
                                xmlNodeCopy = xmlNode.Clone();
                                xmlNodeTemp = xmlNode;
                            }
                            else
                            {
                                // Get a copy of the nodeCopy to add another dataVector
                                xmlNodeTemp = xmlNodeCopy.Clone();
                            }

                            //
                            // Create CSV string from data vector
                            //
                            string csvString = string.Empty;
                            for (int j = 0; j < resultInfo.dataVectors.GetLength(1); j++)
                            {
                                if (j > 0)
                                {
                                    csvString += Consts.CHR_CsvSplitter;
                                }
                                csvString += resultInfo.dataVectors[i, j].ToString();
                            }
                            xmlNodeTemp.InnerXml = csvString;

                            if (i > 0)
                            {
                                // Append xml fragment to experiment result node
                                this.xmlNodeExperimentResult.AppendChild(xmlNodeTemp);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }