Exemple #1
0
        public static void SaveOutputDataInPi(Outputs UnitOutputTags, IList <PIPoint> points, eRCM_KernelControl objACIkernal, Service unit)
        {
            IList <AFValue> valuesToWrite = new List <AFValue>();
            List <Tag>      lstTagResult  = new List <Tag>();
            var             LoadArray     = objACIkernal.LoadArray(unit.LoadStep);
            //Load Step
            object IdealLS        = UnitOutputTags.LoadStep.Ideal.Value;
            object IdealLSDetails = UnitOutputTags.LoadStep.IdealDetails.Value;
            var    loadStep       = LoadSteps.GetLoadSteps(objACIkernal, UnitOutputTags.LoadStep);

            //lstTagResult.Add(loadStep.Current);
            //lstTagResult.Add(loadStep.CurrentDetails);
            //lstTagResult.Add(loadStep.Ideal);
            //lstTagResult.Add(loadStep.IdealDetails);
            lstTagResult.Add(loadStep.NextDown);
            lstTagResult.Add(loadStep.NextUp);
            //Load Prediction
            //var loadPredictionResult = LoadPrediction.GetLoadPrediction(objACIkernal, UnitOutputTags.LoadPrediction);
            //lstTagResult.Add(loadPredictionResult.Current);
            //lstTagResult.Add(loadPredictionResult.Ideal);
            //Flow Prediction
            //var flowPredictionResult = FlowPrediction.GetFlowPrediction(objACIkernal, UnitOutputTags.FlowPrediction);
            //lstTagResult.Add(flowPredictionResult.Current);
            //lstTagResult.Add(flowPredictionResult.Ideal);
            //Meachinical Efficiency
            UnitOutputTags.MechanicalEfficiency.Value = objACIkernal.MechanicalEfficiency;
            lstTagResult.Add(UnitOutputTags.MechanicalEfficiency);
            //Current Torque
            UnitOutputTags.CurrentTorque.Value = objACIkernal.CurrentTorque;
            lstTagResult.Add(UnitOutputTags.CurrentTorque);
            //Max Load
            UnitOutputTags.MaxLoad.Value = objACIkernal.MaxAllowedLoad;
            lstTagResult.Add(UnitOutputTags.MaxLoad);
            //ErroCode objERCM.FullEnglishErrors(objERCM.ErrorArray(objERCM.CurrentLoadStep), 0)
            //UnitOutputTags.ErrorCode.Value = objACIkernal.FullEnglishErrors(objACIkernal.ErrorArray(objACIkernal.CurrentLoadStep), 0);
            //UnitOutputTags.ErrorCode.Value = objACIkernal.ErrorArray(objACIkernal.CurrentLoadStep);
            //lstTagResult.Add(UnitOutputTags.ErrorCode);
            //Rated Load
            UnitOutputTags.RatedLoad.Value = objACIkernal.RatedLoad;
            lstTagResult.Add(UnitOutputTags.RatedLoad);
            //Rated Speed
            UnitOutputTags.RatedSpeed.Value = objACIkernal.RatedSpeed;
            lstTagResult.Add(UnitOutputTags.RatedSpeed);
            //Min Load/Flow Change Allowed
            UnitOutputTags.MinChangeAllowed.Value = objACIkernal.MinLoadFlowChangeAllowed;
            lstTagResult.Add(UnitOutputTags.MinChangeAllowed);
            //Max Load Change Allowed
            UnitOutputTags.MaxChangeAllowed.Value = objACIkernal.MaxLoadChangeAllowed;
            lstTagResult.Add(UnitOutputTags.MaxChangeAllowed);
            //Min Speed
            UnitOutputTags.MinSpeed.Value = objACIkernal.MinSpeedCurrentLS();
            lstTagResult.Add(UnitOutputTags.MinSpeed);
            //Max Speed
            UnitOutputTags.MaxSpeed.Value = objACIkernal.MaxSpeedCurrentLS();
            lstTagResult.Add(UnitOutputTags.MaxSpeed);
            //Stage Info
            var stageInfoResult = StageInfo.GetStageInfoList(objACIkernal, UnitOutputTags.StageInfo, unit);

            foreach (var stage in stageInfoResult)
            {
                // Trace.WriteLine("StageNumber:" + stage.StageNumber);
                lstTagResult.Add(stage.CompressionRatio);
                lstTagResult.Add(stage.DischargePressureAtFlange);
                lstTagResult.Add(stage.DischargePressureAtGadge);
                lstTagResult.Add(stage.DischargeTemperature);
                lstTagResult.Add(stage.Load);
                lstTagResult.Add(stage.RatioActualVsTheoriticalPressure);
                lstTagResult.Add(stage.RatioActualVsTheoriticalTemperature);
            }
            //Load Balance
            var lbResult = LoadBalance.GetLoadBalance(objACIkernal, UnitOutputTags.LoadBalance);

            foreach (var stage in lbResult)
            {
                // Trace.WriteLine("StageNumber:" + stage.Stages);
                lstTagResult.Add(stage.Ratio);
            }
            //Head End Info
            var headEndResult = HeadEndInfo.GetHeadEndInfo(objACIkernal, UnitOutputTags.HeadEndInfo);

            foreach (var headEndCylinder in headEndResult)
            {
                lstTagResult.Add(headEndCylinder.DischargeVE);
                lstTagResult.Add(headEndCylinder.Flow);
                lstTagResult.Add(headEndCylinder.Load);
                lstTagResult.Add(headEndCylinder.SuctionVE);
            }
            //Crank End
            var crankEndResult = CrankEndInfo.GetHeadEndInfo(objACIkernal, UnitOutputTags.CrankEndInfo);

            foreach (var crankEndCylinder in crankEndResult)
            {
                lstTagResult.Add(crankEndCylinder.DischargeVE);
                lstTagResult.Add(crankEndCylinder.Flow);
                lstTagResult.Add(crankEndCylinder.Load);
                lstTagResult.Add(crankEndCylinder.SuctionVE);
                lstTagResult.Add(crankEndCylinder.EstimatedDischargeTemperature);
            }
            //Compression Forces
            var compForcesResults = CompressionForces.GetCompressionForces(objACIkernal, UnitOutputTags.CompressionForces);

            foreach (var throws in compForcesResults)
            {
                lstTagResult.Add(throws.Force);
            }
            //Tension Forces
            var tensForcesResults = TensionForces.GetTensionForces(objACIkernal, UnitOutputTags.TensionForces);

            foreach (var throws in tensForcesResults)
            {
                lstTagResult.Add(throws.Force);
            }
            //Fuel Rate
            //var fuelRatesResult = FuelRates.GetFuelRates(objACIkernal, UnitOutputTags.FuelRate, unit);
            //lstTagResult.Add(fuelRatesResult.Current);
            //lstTagResult.Add(fuelRatesResult.Ideal);
            lstTagResult.Add(UnitOutputTags.MaxAllowedDischargePressure);
            lstTagResult.Add(UnitOutputTags.IdealFlow90T);
            lstTagResult.Add(UnitOutputTags.IdealFuelRate90T);
            lstTagResult.Add(UnitOutputTags.IdealLoad90T);
            lstTagResult.Add(UnitOutputTags.IdealLoadStep90T);
            lstTagResult.Add(UnitOutputTags.IdealLoadStepDetail90T);
            lstTagResult.Add(UnitOutputTags.IdealFlow95T);
            lstTagResult.Add(UnitOutputTags.IdealFuelRate95T);
            lstTagResult.Add(UnitOutputTags.IdealLoad95T);
            lstTagResult.Add(UnitOutputTags.IdealLoadStep95T);
            lstTagResult.Add(UnitOutputTags.IdealLoadStepDetail95T);
            UnitOutputTags.LoadStep.Ideal.Value = IdealLS;
            lstTagResult.Add(UnitOutputTags.LoadStep.Ideal);
            UnitOutputTags.LoadStep.IdealDetails.Value = IdealLSDetails;
            lstTagResult.Add(UnitOutputTags.LoadStep.IdealDetails);
            lstTagResult.Add(UnitOutputTags.LoadPrediction.Ideal);
            lstTagResult.Add(UnitOutputTags.FlowPrediction.Ideal);
            lstTagResult.Add(UnitOutputTags.FuelRate.Ideal);
            lstTagResult.Add(UnitOutputTags.LoadStep.Current);
            lstTagResult.Add(UnitOutputTags.LoadStep.CurrentDetails);
            lstTagResult.Add(UnitOutputTags.LoadPrediction.Current);
            lstTagResult.Add(UnitOutputTags.FlowPrediction.Current);
            lstTagResult.Add(UnitOutputTags.FuelRate.Current);
            lstTagResult.Add(UnitOutputTags.ErrorCode);

            foreach (var pipoint in points)
            {
                var     tagValue     = lstTagResult.Where(x => x.Name == pipoint.Name).Select(x => x.Value).FirstOrDefault();
                AFValue afValueFloat = new AFValue(tagValue, DateTime.Now)
                {
                    PIPoint = pipoint
                };
                valuesToWrite.Add(afValueFloat);
            }

            piServer.UpdateValues(valuesToWrite, AFUpdateOption.InsertNoCompression, AFBufferOption.BufferIfPossible);
            Console.WriteLine("Pi Values Added for " + unit.UnitName + " at" + DateTime.Now + " Successfully");
        }