//-------------------------------------------------------------------------------------------------// public override ExperimentInfo RunExperiment(ExperimentInfo experimentInfo) { const string STRLOG_MethodName = "RunExperiment"; Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // Create a result report ready to fill in experimentInfo.resultReport = new ResultReport(); try { // // Parse the XML specification string to generate a validation report (should be accepted!) // Specification specification = new Specification(this.configuration, this.equipmentServiceProxy); ValidationReport validationReport = specification.Parse(experimentInfo.xmlSpecification); if (validationReport.accepted == false) { throw new ArgumentException(validationReport.errorMessage); } experimentInfo.setupId = specification.SetupId; // // Create an instance of the driver for the specified setup and then // execute the experiment and return the result information // ResultInfo resultInfo = null; // // All setups use the equipment driver // DriverEquipment driver = new DriverEquipment(this.equipmentServiceProxy, this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); // // Create an instance of LabExperimentResult to convert the experiment results to an XML string // ExperimentResult experimentResult = new ExperimentResult( experimentInfo.experimentId, experimentInfo.sbName, DateTime.Now, this.unitId, (Configuration)this.labConfiguration, specification, resultInfo); // // Fill in the result report // experimentInfo.resultReport.experimentResults = experimentResult.ToString(); experimentInfo.resultReport.statusCode = (int)resultInfo.statusCode; experimentInfo.resultReport.errorMessage = resultInfo.errorMessage; } catch (Exception ex) { experimentInfo.resultReport.statusCode = (int)StatusCodes.Failed; experimentInfo.resultReport.errorMessage = ex.Message; Logfile.WriteError(ex.Message); } Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); return(experimentInfo); }
//-------------------------------------------------------------------------------------------------// public override ExperimentInfo RunExperiment(ExperimentInfo experimentInfo) { const string STRLOG_MethodName = "RunExperiment"; Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // Create a result report ready to fill in experimentInfo.resultReport = new ResultReport(); try { // // Parse the XML specification string to generate a validation report (should be accepted!) // Specification specification = new Specification(this.configuration, this.equipmentServiceProxy); ValidationReport validationReport = specification.Parse(experimentInfo.xmlSpecification); if (validationReport.accepted == false) { throw new ArgumentException(validationReport.errorMessage); } experimentInfo.setupId = specification.SetupId; // // Create an instance of the driver for the specified setup and then // execute the experiment and return the result information // ResultInfo resultInfo = null; // // All setups use the equipment driver // DriverEquipment driver = new DriverEquipment(this.equipmentServiceProxy, this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); // // Create an instance of LabExperimentResult to convert the experiment results to an XML string // ExperimentResult experimentResult = new ExperimentResult( experimentInfo.experimentId, experimentInfo.sbName, DateTime.Now, this.unitId, (Configuration)this.labConfiguration, specification, resultInfo); // // Fill in the result report // experimentInfo.resultReport.experimentResults = experimentResult.ToString(); experimentInfo.resultReport.statusCode = (int)resultInfo.statusCode; experimentInfo.resultReport.errorMessage = resultInfo.errorMessage; } catch (Exception ex) { experimentInfo.resultReport.statusCode = (int)StatusCodes.Failed; experimentInfo.resultReport.errorMessage = ex.Message; Logfile.WriteError(ex.Message); } Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); return experimentInfo; }
//-------------------------------------------------------------------------------------------------// public override void Create() { const string STRLOG_MethodName = "Create"; Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // // Create local class instances just to check that all is in order // Configuration configuration = (Configuration)this.appData.labConfiguration; Specification specification = new Specification(configuration, null); ExperimentResult experimentResult = new ExperimentResult(configuration); // // Create instances of the experiment engines // this.appData.labExperimentEngines = new ExperimentEngine[appData.farmSize]; for (int i = 0; i < appData.farmSize; i++) { this.appData.labExperimentEngines[i] = new ExperimentEngine(i, this.appData); } Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); }
//-------------------------------------------------------------------------------------------------// public override ExperimentInfo RunExperiment(ExperimentInfo experimentInfo) { const string STRLOG_MethodName = "RunExperiment"; Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // Create a result report ready to fill in experimentInfo.resultReport = new ResultReport(); try { // // Parse the XML specification string to generate a validation report (should be accepted!) // Specification specification = new Specification(this.configuration, this.equipmentServiceProxy); ValidationReport validationReport = specification.Parse(experimentInfo.xmlSpecification); if (validationReport.accepted == false) { throw new ArgumentException(validationReport.errorMessage); } experimentInfo.setupId = specification.SetupId; // // Create an instance of the driver for the specified setup and then // execute the experiment and return the result information // ResultInfo resultInfo = null; if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsTime) || specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsDistance)) { if (this.equipmentServiceProxy != null) { // // Hardware is available to this unit, run it there // DriverRadioactivity driver = new DriverRadioactivity(this.equipmentServiceProxy, this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } else { // // This unit does not have hardware available, run the simulation instead // DriverSimActivity driver = new DriverSimActivity(this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } } else if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsAbsorber)) { DriverAbsorbers driver = new DriverAbsorbers(this.equipmentServiceProxy, this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTime) || specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistance)) { DriverSimActivity driver = new DriverSimActivity(this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTimeNoDelay) || specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistanceNoDelay)) { DriverSimActivity driver = new DriverSimActivity(this.configuration, this.labExperimentInfo.cancelExperiment, false); resultInfo = (ResultInfo)driver.Execute(specification); } // // Create an instance of LabExperimentResult to convert the experiment results to an XML string // ExperimentResult experimentResult = new ExperimentResult( experimentInfo.experimentId, experimentInfo.sbName, DateTime.Now, this.unitId, (Configuration)this.labConfiguration, specification, resultInfo); // // Fill in the result report // experimentInfo.resultReport.experimentResults = experimentResult.ToString(); experimentInfo.resultReport.statusCode = (int)resultInfo.statusCode; experimentInfo.resultReport.errorMessage = resultInfo.errorMessage; } catch (Exception ex) { experimentInfo.resultReport.statusCode = (int)StatusCodes.Failed; experimentInfo.resultReport.errorMessage = ex.Message; Logfile.WriteError(ex.Message); } Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); return(experimentInfo); }
//-------------------------------------------------------------------------------------------------// public override ExperimentInfo RunExperiment(ExperimentInfo experimentInfo) { const string STRLOG_MethodName = "RunExperiment"; Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // Create a result report ready to fill in experimentInfo.resultReport = new ResultReport(); try { // // Parse the XML specification string to generate a validation report (should be accepted!) // Specification specification = new Specification(this.configuration, this.equipmentServiceProxy); ValidationReport validationReport = specification.Parse(experimentInfo.xmlSpecification); if (validationReport.accepted == false) { throw new ArgumentException(validationReport.errorMessage); } experimentInfo.setupId = specification.SetupId; // // Create an instance of the driver for the specified setup and then // execute the experiment and return the result information // ResultInfo resultInfo = null; if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsTime) || specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsDistance)) { if (this.equipmentServiceProxy != null) { // // Hardware is available to this unit, run it there // DriverRadioactivity driver = new DriverRadioactivity(this.equipmentServiceProxy, this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } else { // // This unit does not have hardware available, run the simulation instead // DriverSimActivity driver = new DriverSimActivity(this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } } else if (specification.SetupId.Equals(Consts.STRXML_SetupId_RadioactivityVsAbsorber)) { DriverAbsorbers driver = new DriverAbsorbers(this.equipmentServiceProxy, this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTime) || specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistance)) { DriverSimActivity driver = new DriverSimActivity(this.configuration, this.labExperimentInfo.cancelExperiment); resultInfo = (ResultInfo)driver.Execute(specification); } else if (specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsTimeNoDelay) || specification.SetupId.Equals(Consts.STRXML_SetupId_SimActivityVsDistanceNoDelay)) { DriverSimActivity driver = new DriverSimActivity(this.configuration, this.labExperimentInfo.cancelExperiment, false); resultInfo = (ResultInfo)driver.Execute(specification); } // // Create an instance of LabExperimentResult to convert the experiment results to an XML string // ExperimentResult experimentResult = new ExperimentResult( experimentInfo.experimentId, experimentInfo.sbName, DateTime.Now, this.unitId, (Configuration)this.labConfiguration, specification, resultInfo); // // Fill in the result report // experimentInfo.resultReport.experimentResults = experimentResult.ToString(); experimentInfo.resultReport.statusCode = (int)resultInfo.statusCode; experimentInfo.resultReport.errorMessage = resultInfo.errorMessage; } catch (Exception ex) { experimentInfo.resultReport.statusCode = (int)StatusCodes.Failed; experimentInfo.resultReport.errorMessage = ex.Message; Logfile.WriteError(ex.Message); } Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); return experimentInfo; }