private void verifyInputForLambda(TestCase aTestCase, Workbook workbook) { Step aStep = new Step(); aStep.Name = "Step1 - Verify input"; aTestCase.AddModelElement(aStep); /*********************************** TRAIN DATA ***********************************/ SubStep aSubStep = new SubStep(); aSubStep.Name = "SubStep1 - Train data"; aStep.AddModelElement(aSubStep); addAction(aSubStep, "Kernel.TrainData.BrakingParameters.ConversionModel.Initialize()"); addAction(aSubStep, "Kernel.SpeedAndDistanceMonitoring.ReleaseSpeedSupervision.UpdateReleaseSpeed()"); addExpectation(aSubStep, "Kernel.TrainData.BrakingParameters.ConversionModel.ConversionModelIsUsed() == True"); /********************************* BRAKE PARAMETERS *********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep2 - Brake parameters"; aStep.AddModelElement(aSubStep); Worksheet aWorksheet = workbook.Sheets[5] as Worksheet; Range aRange = aWorksheet.UsedRange; addAction(aSubStep, "Kernel.SpeedAndDistanceMonitoring.TargetSupervision.InitializeTimeIntervals()"); /* Verifying kto */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.kto() == {0:0.0#}", (double)(aRange.Cells[7, 6] as Range).Value2)); if (TargetSpeed == 0) /* In this case, the values of T_brake_emergency_cmt and T_brake_service_cmt do not make sense (3.13.3.4.4.1) */ { /* Verifying T_brake_emergency_cm0 */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_emergency_cm0 == {0:0.0#}", (double)(aRange.Cells[8, 6] as Range).Value2)); /* Verifying T_brake_service_cm0 */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_service_cm0 == {0:0.0#}", (double)(aRange.Cells[10, 6] as Range).Value2)); } else /* In this case, the values of T_brake_emergency_cm0 and T_brake_service_cm0 do not make sense (3.13.3.4.4.1) */ { /* Verifying T_brake_emergency_cmt */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_emergency_cmt == {0:0.0#}", (double)(aRange.Cells[9, 6] as Range).Value2)); /* Verifying T_brake_service_cmt */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_service_cmt == {0:0.0#}", (double)(aRange.Cells[11, 6] as Range).Value2)); } /* Verifying T_be */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.T_be() == {0:0.0#}", (double)(aRange.Cells[12, 6] as Range).Value2)); /* Verifying T_bs */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.T_bs() == {0:0.0#}", (double)(aRange.Cells[13, 6] as Range).Value2)); /********************* BRAKE PARAMETERS (A_brake_emergency) *********************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep3 - Brake parameters (A_brake_emergency)"; aStep.AddModelElement(aSubStep); /* Verifying A_brake_emergency */ double doubleValue = -1; double temp; for (int i = 16; i <= 27; i++) { temp = (double)(aRange.Cells[i, 10] as Range).Value2; if (doubleValue != temp) { if (doubleValue != -1) { addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_emergency(V => {0:0.0########}),\n Val2 => {1:0.0########}\n)", (double)(aRange.Cells[i, 9] as Range).Value2 - 0.000000001, doubleValue)); } doubleValue = temp; double speedValue = (double)(aRange.Cells[i, 9] as Range).Value2; if (Math.Abs(speedValue - Math.Round(speedValue, 8)) > 0) { speedValue += 0.000000001; } addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_emergency(V => {0:0.0########}),\n Val2 => {1:0.0########}\n)", speedValue, doubleValue)); } } /* Verifying V_lim EBI */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_emergency.Val1.SpeedStep,\n Val2 => {0:0.0########}\n)", (double)(aRange.Cells[17, 9] as Range).Value2)); /*********************** BRAKE PARAMETERS (A_brake_service) ***********************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep4 - Brake parameters (A_brake_service)"; aStep.AddModelElement(aSubStep); /* Verifying A_brake_service */ doubleValue = -1; for (int i = 16; i <= 27; i++) { temp = (double)(aRange.Cells[i, 14] as Range).Value2; if (doubleValue != temp) { if (doubleValue != -1) { addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_service(V => {0:0.0########}),\n Val2 => {1:0.0########}\n)", (double)(aRange.Cells[i, 13] as Range).Value2 - 0.000000001, doubleValue)); } doubleValue = temp; double speedValue = (double)(aRange.Cells[i, 13] as Range).Value2; if (Math.Abs(speedValue - Math.Round(speedValue, 8)) > 0) { speedValue += 0.000000001; } addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_service(V => {0:0.0########}),\n Val2 => {1:0.0########}\n)", speedValue, doubleValue)); } } /* Verifying V_lim BS */ addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_service.Val1.SpeedStep,\n Val2 => {0:0.0########}\n)", (double)(aRange.Cells[17, 13] as Range).Value2)); }
private void verifyInputForGamma(TestCase aTestCase, Workbook workbook) { Step aStep = new Step(); aStep.Name = "Step1 - Verify input"; aTestCase.AddModelElement(aStep); /*********************************** TRAIN DATA ***********************************/ SubStep aSubStep = new SubStep(); aSubStep.Name = "SubStep1 - Train data"; aStep.AddModelElement(aSubStep); addAction(aSubStep, "Kernel.SpeedAndDistanceMonitoring.ReleaseSpeedSupervision.UpdateReleaseSpeed()"); addExpectation(aSubStep, "Kernel.TrainData.BrakingParameters.ConversionModel.ConversionModelIsUsed() == False"); }
private void intializeEFS(TestCase aTestCase, Workbook workbook) { Step aStep = new Step(); aStep.Name = "Step1 - Setup"; aTestCase.AddModelElement(aStep); SubStep aSubStep = new SubStep(); aSubStep.Name = "SubStep1 - Setup"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); TestAction levelInitialization = new TestAction(); levelInitialization.Expression = "Kernel.Level <- Kernel.LevelData\n{\n Value => Level.L1,\n DataState => DataState.Valid\n}"; aSubStep.AddModelElement(levelInitialization); TestAction odometryInitialization = new TestAction(); odometryInitialization.Expression = "Odometry.NominalDistance <- 0.0"; aSubStep.AddModelElement(odometryInitialization); }
private void initializeInputForLambda(TestCase aTestCase, Workbook workbook) { Step aStep = new Step(); aStep.Name = "Step1 - Initialize input"; aTestCase.AddModelElement(aStep); /*********************************** TRAIN DATA ***********************************/ SubStep aSubStep = new SubStep(); aSubStep.Name = "SubStep1 - Train data"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); /* This is a lambda train => no brake models defined in the train data */ addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.EBModels <- EMPTY")); addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.SBModels <- EMPTY")); addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.NormalServiceBrakeModels <- EMPTY")); addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.T_brake_emergency <- EMPTY")); addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.T_brake_service <- EMPTY")); /* Initializing the maximum train speed */ /* This value must be in the range {0km/h; 200km/h}, otherwise the conversion model will not be applicable */ addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.TrainData.Value.MaximumSpeed <- {0:0.0}", 180.0)); Worksheet aWorksheet = workbook.Sheets[1] as Worksheet; bool isPassengerTrain; importCommonTrainDataInformation(aSubStep, aWorksheet, out isPassengerTrain); /*********************************** TRACK DATA ***********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep2 - Track data"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); /* This is a lambda train => track condition brake inhibition profile is not applicable */ addAction(aSubStep, String.Format("Kernel.TrackDescription.TrackConditions.TCProfile <- EMPTY")); aWorksheet = workbook.Sheets[2] as Worksheet; importCommonTrackDataInformation(aSubStep, aWorksheet); /*********************************** NATIONAL VALUES ***********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep3 - National values"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[3] as Worksheet; importCommonNationalValuesInformation(aSubStep, aWorksheet); /*********************************** FIXED VALUES ***********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep4 - Fixed values"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[4] as Worksheet; importCommonFixedValuesInformation(aSubStep, aWorksheet); /****************************** BRAKE PARAMETERS (lambda) ******************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep5 - Brake parameters"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[5] as Worksheet; Range aRange = aWorksheet.UsedRange; addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.TrainData.Value.BrakePercentage <- {0:0.0#}", (double)(aRange.Cells[3, 6] as Range).Value2)); /*************************** INTERGRATED CORRECTION FACTORS ***************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep6 - Integrated correction factors"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[8] as Worksheet; aRange = aWorksheet.UsedRange; /* Initializing Kr_int */ int index = 0; double doubleValue = -1; double temp; for (int i = 0; i < 9; i++) { temp = (double)(aRange.Cells[i + 32, 2] as Range).Value2; if (doubleValue != temp) { double location = (double)(aRange.Cells[i + 32, 1] as Range).Value2; doubleValue = temp; addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKrInt.Val{0} <- Kernel.NationalValues.KrIntValue\n{{\n LengthStep => {1:0.0},\n Value => {2:0.0####}\n}}", index, location, doubleValue)); index++; } } addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKrInt.Val{0} <- Kernel.NationalValues.KrIntValue\n{{\n LengthStep => Default.BaseTypes.Length.Infinity,\n Value => {1:0.0####}\n}}", index, doubleValue)); /* Case of a passenger train */ if (isPassengerTrain) { /* Initializing Kv_int */ double a = -1; double b = -1; double tempA, tempB; index = 0; for (int i = 0; i <= 9; i++) { tempA = (double)(aRange.Cells[i + 5, 5] as Range).Value2; tempB = (double)(aRange.Cells[i + 31, 5] as Range).Value2; if (a != tempA || b != tempB) { double speed = (double)(aRange.Cells[i + 5, 4] as Range).Value2; a = tempA; b = tempB; addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.Val{0} <- Kernel.NationalValues.KvIntValue_PassengerTrain\n{{\n SpeedStep => {1:0.0},\n ValueA => {2:0.0#},\n ValueB => {3:0.0#}\n}}", index, speed, a, b)); index++; } } addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.Val{0} <- Kernel.NationalValues.KvIntValue_PassengerTrain\n{{\n SpeedStep => Default.BaseTypes.Speed.Infinity,\n ValueA => {1:0.0#},\n ValueB => {2:0.0#}\n}}", index, a, b)); } else /* Case of freight trains */ { /* Initializing Kv_int */ doubleValue = -1; index = 0; for (int i = 0; i <= 9; i++) { temp = (double)(aRange.Cells[i + 5, 2] as Range).Value2; if (doubleValue != temp) { double speed = (double)(aRange.Cells[i + 5, 1] as Range).Value2; doubleValue = temp; addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_FreightTrain.Val{0} <- Kernel.NationalValues.KvIntValue_FreightTrain\n{{\n SpeedStep => {1:0.0},\n Value => {2:0.0#}\n}}", index, speed, doubleValue)); index++; } } addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_FreightTrain.Val{0} <- Kernel.NationalValues.KvIntValue_FreightTrain\n{{\n SpeedStep => Default.BaseTypes.Speed.Infinity,\n Value => {1:0.0#}\n}}", index, doubleValue)); } /* Initializing A_NVP12 */ addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.A_NVP12 <- {0:0.0}", (double)(aRange.Cells[44, 4] as Range).Value2)); /* Initializing A_NVP23 */ addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.A_NVP23 <- {0:0.0}", (double)(aRange.Cells[44, 6] as Range).Value2)); /* Initializing Kt_int */ addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorForBrakeBuildUpTime <- {0:0.0}", (double)(aRange.Cells[47, 4] as Range).Value2)); }
private void initializeInputForGamma(TestCase aTestCase, Workbook workbook) { Step aStep = new Step(); aStep.Name = "Step1 - Initialize input"; aTestCase.AddModelElement(aStep); /*********************************** TRAIN DATA ***********************************/ SubStep aSubStep = new SubStep(); aSubStep.Name = "SubStep1 - Train data"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); /* This is a gamma train => we have to initialize brake models in the train data */ addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.EBModels <- Kernel.TrainData.BrakingParameters.EBModelSet\n{{\n ModelSet => Kernel.TrainData.BrakingParameters.BrakingModelSet{{}},\n Kdry_rstValuesSet => Kernel.TrainData.BrakingParameters.Kdry_rstValuesSet{{}},\n Kwet_rstValuesSet => Kernel.TrainData.BrakingParameters.Kwet_rstValuesSet{{}}\n}}")); addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.SBModels <- Kernel.TrainData.BrakingParameters.SBModelSet{{}}")); /* Initializing the maximum train speed */ /* I didn't find this value in ERA sheets, but I observed than their P function can exceed 160 km/h => the maximum speed should be greater than 160 km/h */ addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.TrainData.Value.MaximumSpeed <- {0:0.0}", 180.0)); Worksheet aWorksheet = workbook.Sheets[1] as Worksheet; bool isPassengerTrain; importCommonTrainDataInformation(aSubStep, aWorksheet, out isPassengerTrain); /*********************************** TRACK DATA ***********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep2 - Track data"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[2] as Worksheet; importCommonTrackDataInformation(aSubStep, aWorksheet); /*********************************** NATIONAL VALUES ***********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep3 - National values"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[3] as Worksheet; importCommonNationalValuesInformation(aSubStep, aWorksheet); /*********************************** FIXED VALUES ***********************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep4 - Fixed values"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[4] as Worksheet; importCommonFixedValuesInformation(aSubStep, aWorksheet); /****************************** BRAKE PARAMETERS (gamma) ******************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep5 - Brake parameters"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[6] as Worksheet; importGammaBrakeParameters(aSubStep, aWorksheet, 2, 8, true); // first combination importGammaBrakeParameters(aSubStep, aWorksheet, 3, 20, false); // second combination /*************************** CORRECTION FACTOR KDRY_RST ***************************/ aSubStep = new SubStep(); aSubStep.Name = "SubStep6 - Correction factor kdry_rst"; aSubStep.setSkipEngine(true); aStep.AddModelElement(aSubStep); aWorksheet = workbook.Sheets[7] as Worksheet; }
private void fillBrakingParametersExpectations(TestCase aTestCase, int stepNumber, string name, string expression, List<double> distanceValues, List<double> speedValues, List<double> values) { Step aStep = new Step(); aStep.Name = String.Format("Step{0} - {1}", stepNumber, name); aTestCase.AddModelElement(aStep); SubStep aSubStep = new SubStep(); aSubStep.Name = String.Format("SubStep1 - Verify {0} values", name); aStep.AddModelElement(aSubStep); for (int i = 0; i < values.Count; i++) { if (values[i] != -1) { Expectation expectation = new Expectation(); expectation.Expression = String.Format(CultureInfo.InvariantCulture, expression, Math.Round(distanceValues[i], 2), Math.Round(speedValues[i], 2), Math.Round(values[i], 4)); aSubStep.AddModelElement(expectation); } } }