public ExperimentStepSetBuilder()
 {
     this.experimentStepSet = new ExperimentStepSet();
 }
示例#2
0
 public ResultBuilder WithExperimentStepSet(ExperimentStepSet experimentStepSet)
 {
     this.result.ExperimentStepSet = experimentStepSet;
     return(this);
 }
示例#3
0
        private static void CreateExperimentSteps(ref AnimlDocument document)
        {
            //// Create an ExperimentStepSet that contains all the experiment data.
            ExperimentStepSet expStepSet = new ExperimentStepSet();

            //// Create a first ExperimentStep. This ExperimentStep will reference the Sample.
            ExperimentStep expStep1 = new ExperimentStep("FirstStep", "E-1");

            expStep1.Comment = "This is the 1st experiment step";

            //// Create the infrastructure that is needed to establish the reference between the ExperimentStep and the Sample.
            expStep1.Infrastructure                     = new Infrastructure();
            expStep1.Infrastructure.Timestamp           = DateTime.Now;
            expStep1.Infrastructure.SampleReferencetSet = new SampleReferenceSet();
            expStep1.Infrastructure.SampleReferencetSet.SampleReferences.Add(new SampleReference(document.SampleSet.Samples[0].SampleId, "Sample under test.", SamplePurpose.Consumed));

            //// Create the method information for the ExperimentStep
            expStep1.Method        = new Method();
            expStep1.Method.Author = new Author("John Doe", UserType.Human)
            {
                Affiliation = "Black Mesa Corp.",
                Email       = "*****@*****.**",
                Location    = "New Mexico",
                Phone       = "+1 505 1234567",
                Role        = "Lab Technician",
            };
            expStep1.Method.Device = new Device("pH Meter")
            {
                DeviceIdentifier = "PH-11-1",
                FirmwareVersion  = "1.21a",
                Manufacturer     = "pH Meter Manufacturing Corp.",
                SerialNumber     = "PHM0815",
            };
            expStep1.Method.Software = new Software("pH Meter PC Software")
            {
                Manufacturer    = "pH Meter Manufacturing Corp.",
                OperatingSystem = Environment.OSVersion.ToString(),
                Version         = "2.08",
            };

            List <double> values = GenerateValues(50, 6, 3);

            //// Create a Result for the 1st ExperimentStep
            Result pHResult = new Result("pH");

            pHResult.SeriesSet = new SeriesSet("pH Measurement", values.Count);
            Series phTimeSeries = new Series("Time", "SER-PH-TIME", Dependency.Independent, SeriesType.Int32);

            phTimeSeries.PlotScale = PlotScale.Linear;
            phTimeSeries.ValueSets.Add(new AutoIncrementedValueSet(0, 1));
            pHResult.SeriesSet.Series.Add(phTimeSeries);
            Series phValueSeries = new Series("pH", "SER-PH-VALS", Dependency.Dependent, SeriesType.Float64);

            phValueSeries.PlotScale = PlotScale.Linear;
            phValueSeries.ValueSets.Add(new EncodedValueSet(values));
            pHResult.SeriesSet.Series.Add(phValueSeries);
            expStep1.Results.Add(pHResult);

            //// Add the 1st ExperimentStep to the ExperimentStepSet.
            expStepSet.ExperimentSteps.Add(expStep1);

            //// Create a second ExperimentStep. This ExperimentStep will reference the first ExperimentStep.
            ExperimentStep expStep2 = new ExperimentStep("SecondStep", "E-2");

            expStep2.Comment = "This is the 2nd experiment step";

            //// Create the infrastructure that is needed to establish the reference between the 1st and the 2nd ExperimentStep.
            expStep2.Infrastructure           = new Infrastructure();
            expStep2.Infrastructure.Timestamp = DateTime.Now;
            expStep2.Infrastructure.ExperimentDataReferenceSet = new ExperimentDataReferenceSet();
            expStep2.Infrastructure.ExperimentDataReferenceSet.ExperimentDataReferences.Add(new ExperimentDataReference("E-1", "Data source", ExperimentDataPurpose.Consumed));

            //// Create a Result for the 2nd ExperimentStep
            Result calcResult = new Result("Calc");

            calcResult.SeriesSet = new SeriesSet("Calculated Results", 3);
            Series resultNamesSeries = new Series("ResultName", "SER-CALC-NAMES", Dependency.Independent, SeriesType.String);

            resultNamesSeries.PlotScale = PlotScale.None;
            resultNamesSeries.ValueSets.Add(new IndividualValueSet(new List <string>()
            {
                "Min", "Max", "Average"
            }));
            calcResult.SeriesSet.Series.Add(resultNamesSeries);
            Series resultValuesSeries = new Series("ResultValue", "SER-CALC-VALUES", Dependency.Dependent, SeriesType.Float64);

            resultValuesSeries.PlotScale = PlotScale.None;
            resultValuesSeries.ValueSets.Add(new IndividualValueSet(new List <double>()
            {
                values.Min(), values.Max(), values.Average()
            }));
            calcResult.SeriesSet.Series.Add(resultValuesSeries);
            expStep2.Results.Add(calcResult);

            //// Add the 2nd ExperimentStep to the ExperimentStepSet.
            expStepSet.ExperimentSteps.Add(expStep2);

            document.ExperimentStepSet = expStepSet;
        }
示例#4
0
 public AnimlDocumentBuilder WithExperimentStepSet(ExperimentStepSet experimentStepSet)
 {
     this.animlDocument.ExperimentStepSet = experimentStepSet;
     return(this);
 }