Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Drivers driver = Drivers.Marine;//this.riskForm.Driver;
- CoatingQualities coatingQuality = CoatingQualities.Medium;//this.riskForm.CoatingQuality;
- InsulationTypes insulationType = InsulationTypes.MineralWool;//this.riskForm.InsulationType;
- InsulationConditions insulationCondition = InsulationConditions.Average;//this.riskForm.InsulationCondition;
- Complexities complexity = Complexities.Average;//this.riskForm.Complexity;
- bool interfacePenalty = true;//this.riskForm.InterfacePenalty;
- bool pipeSupport = false;//this.riskForm.PipeSupport;
- Pipe pipe = element as Pipe;
- float press = 0.0f, temp = 0.0f; double minWall = pipe.minWallThickness;
- bool designOrFabricationPenalty = false, presenceOfCracking = false;
- double allowedStress = 9000, weldJointEfficiency = 0.5, tensileStrength = 0, yieldStrength = 56104;
- PhDsoft.C4D.MainApplication.BusinessLogic.Plant3DImporting.ComputeMinimumPipingThicknessCommand dImporting = new BusinessLogic.Plant3DImporting.ComputeMinimumPipingThicknessCommand(this.document.Application);
- if ((lastPressure) > pipe.DesignPressure && lastTemperature >= pipe.DesignTemperature)
- {
- press = (float)(lastPressure);
- temp = lastTemperature;
- minWall = dImporting.ComputeMinimumWallThickness4RealTime(pipe, press, temp);
- }
- else if ((lastPressure) > pipe.DesignPressure && lastTemperature < pipe.DesignTemperature)
- {
- press = (float)(lastPressure);
- temp = lastTemperature;
- minWall = dImporting.ComputeMinimumWallThickness4RealTime(pipe, press, pipe.DesignTemperature);
- }
- else if ((lastPressure) <= pipe.DesignPressure && lastTemperature > pipe.DesignTemperature)
- {
- press = (float)(lastPressure);
- temp = lastTemperature;
- minWall = dImporting.ComputeMinimumWallThickness4RealTime(pipe, pipe.DesignPressure, temp);
- }
- //lastRead = 6.1f;
- /*double lastRead = 5;*///pipe.Thickness - (rnd.Next(0, 50) * 0.1);
- //lastRead = 2;
- var compType = this.ComputeComponentType(pipe.NominalDiameter);
- //pipe.OperatingTemperature
- List<InspectionEffectiveness> inspectionEffectivenessesList = new List<InspectionEffectiveness>();
- inspectionEffectivenessesList.Add(new InspectionEffectiveness { inspectionCategory = InspectionCategories.D, id = 1 });
- inspectionEffectivenessesList.Add(new InspectionEffectiveness { inspectionCategory = InspectionCategories.C, id = 2 });
- inspectionEffectivenessesList.Add(new InspectionEffectiveness { inspectionCategory = InspectionCategories.B, id = 3 });
- //inspectionEffectivenessesList.Add(new InspectionEffectiveness { inspectionCategory = InspectionCategories.A, id = 4 });
- DamageFactorExternalCorrosion damageFactorExternalCorrosion = new DamageFactorExternalCorrosion(lastRead, pipe.Campaign.Date, lastTemperature, driver, interfacePenalty, designOrFabricationPenalty,
- new DateTime(2017, 03, 17), lastRead, pipe.Campaign.Date,
- coatingQuality, allowedStress, weldJointEfficiency, minWall, tensileStrength, yieldStrength, minWall, inspectionEffectivenessesList);
- DamageFactorExternalCLSCC damageFactorExternalCLSCC = new DamageFactorExternalCLSCC(pipe.Campaign.Date, lastTemperature, driver, new DateTime(2017, 03, 17), pipe.Campaign.Date,
- coatingQuality, inspectionEffectivenessesList, presenceOfCracking);
- List<ExternalDamageFactor> externalDamageFactors = new List<ExternalDamageFactor>();
- externalDamageFactors.Add(damageFactorExternalCorrosion);
- //externalDamageFactors.Add(damageFactorCUIF);
- externalDamageFactors.Add(damageFactorExternalCLSCC);
- //externalDamageFactors.Add(damageFactorCUICLSCC);
- ProbabilityOfFailure probabilityOfFailure = new ProbabilityOfFailure(500, -1, EquipmentTypes.Pipe, compType);
- Double totalDamageFactor = probabilityOfFailure.GetTotalDamageFactor(externalDamageFactors, new List<ThinningDamageFactor>(), false, new List<SCCDamageFactor>());
- Double pfValue = probabilityOfFailure.GetProbabilityFailure(externalDamageFactors, null, false, null);
- List<Double> otherComponentMass = new List<double>();
- otherComponentMass.Add(50);
- otherComponentMass.Add(30);
- ConsequenceAnalysisLevelOne consequenceAnalysisLevelOne = new ConsequenceAnalysisLevelOne(RepresentativeFluids.ACID, StoredFluidPhase.GAS,
- EquipmentTypes.Pipe, compType, lastTemperature, lastTemperature, pipe.NominalDiameter, lastPressure, 101.325, 0.1, 1000, otherComponentMass, 0.15, DetectionClassification.B,
- IsolationClassification.B, new Costs(5000, 20000, 14, 15, 16, 17), 5.2, null);
- consequenceAnalysisLevelOne.Init();
- RiskAnalysis risk = new RiskAnalysis();
- var final = consequenceAnalysisLevelOne.FinalConsequenceArea();
- Double riskFinancial = risk.DeterminateRisk(pfValue, consequenceAnalysisLevelOne.TotalFinancialConsequence());
- Double riskArea = risk.DeterminateRisk(pfValue, consequenceAnalysisLevelOne.FinalConsequenceArea());
- var riskMatrixFinancial = risk.RiskMatrixFinancial(totalDamageFactor, consequenceAnalysisLevelOne.TotalFinancialConsequence(), PhDSoft.Utils.Enum.RiskMatrix.Unbalanced);
- var riskMatrixArea = risk.RiskMatrixAreaBased(totalDamageFactor, consequenceAnalysisLevelOne.FinalConsequenceArea(), PhDSoft.Utils.Enum.RiskMatrix.Unbalanced);
- (pipe as PipingStructureElement).FinancialRisk = riskMatrixFinancial.Item1;
- (pipe as PipingStructureElement).AreaRisk = riskMatrixArea.Item1;
- int key = ClassifyElement(risk.RiskMatrixAreaBased(totalDamageFactor, consequenceAnalysisLevelOne.FinalConsequenceArea(), PhDSoft.Utils.Enum.RiskMatrix.Unbalanced));
- List<string> elementTypeNamesToRefresh = new List<string>();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement