Пример #1
0
        public void PentagonsAlgorithmOuputsAreCorrect()
        {
            var dga     = new DissolvedGasAnalysis(currDate, 32.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            var outputs = Outputs;
            var algo    = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());

            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.PD], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.PD], algo.Outputs[2].Description);

            dga  = new DissolvedGasAnalysis(currDate, 32.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            algo = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());
            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.S], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.S], algo.Outputs[2].Description);

            dga  = new DissolvedGasAnalysis(currDate, 0.0, 100.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            algo = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());
            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.T1], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.O], algo.Outputs[2].Description);

            dga  = new DissolvedGasAnalysis(currDate, 0.0, 100.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            algo = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());
            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.T2], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.C], algo.Outputs[2].Description);

            dga  = new DissolvedGasAnalysis(currDate, 0.0, 10.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            algo = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());
            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.T3], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.T3_H], algo.Outputs[2].Description);

            dga  = new DissolvedGasAnalysis(currDate, 0.0, 0.0, 0.0, 100.0, 100.0, 0.0, 0.0, 0.0, 0.0);
            algo = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());
            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.D2], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.D2], algo.Outputs[2].Description);

            dga  = new DissolvedGasAnalysis(currDate, 100.0, 0.0, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0);
            algo = new DuvalPentagonsAlgorithm(dga.ToSerialisedJson());
            algo.Execute();
            Assert.AreEqual(FailureType.Description[FailureType.Code.D1], algo.Outputs[1].Description);
            Assert.AreEqual(FailureType.Description[FailureType.Code.D1], algo.Outputs[2].Description);
        }
Пример #2
0
        public static object DUVALPENTAGONS(
            [ExcelArgument(Description = "The Dissolved Gas Analysis that will be assessed.")]
            string dga)
        {
            try
            {
                var algo = new DuvalPentagonsAlgorithm(dga);
                algo.Execute();

                var output = new StringBuilder();

                foreach (var item in algo.Outputs)
                {
                    output.AppendLine($"[ {item.Name} => {item.Description} ]");
                }

                return(output.ToString());
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }