//public static void BlowingEndRequest() //{ // var fex = new ConnectionProvider.FlexHelper("SublanceGenerator.BlowingEndRequest"); // fex.AddArg("SId", SIdK); // fex.Fire(Program.MainGate); //} public static void DoStopBlow() { var fex = new ConnectionProvider.FlexHelper("OPC.ComEndBlowing"); fex.AddArg("EndBlowingSignal", 1); fex.Fire(Program.MainGate); InstantLogger.log(fex.evt.ToString()); }
public static void PushCarbon(double carbon) { const double tresholdCarbon = 0.00; carbon = carbon < tresholdCarbon ? tresholdCarbon : carbon; // ограничение на углерод var fex = new ConnectionProvider.FlexHelper("OGDecarbonaterFine.Result"); fex.AddArg("C", carbon); fex.Fire(Program.MainGate); }
public static void Iterate(HeatData heatData) { using (var l = new Logger("Iterate")) { var calculatedCarboneEvent = new CalculatedCarboneEvent(); if (!TotalCarbonMassCalculated) { if ( (heatData.IronMass > 0) && (heatData.IronCarbonPercent > 0) && (heatData.ScrapMass > 0) && (heatData.ScrapCarbonPercent > 0) && (heatData.SteelCarbonPercent > 0) ) { TotalCarbonMass = Decarbonater.HeatCarbonMass( heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent, heatData.SteelCarbonPercent ); RemainCarbonMass = TotalCarbonMass; RemainCarbonPercent = GetCarbonPercent(RemainCarbonMass, heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent); if ((TotalCarbonMass > 0) && (heatData.OxygenVolumeRate > 0) && HeatIsStarted) { // start heat TotalCarbonMassCalculated = true; l.msg("##### [TotalCarbonMassCalculated: {0}][RemainCarbonPercent]", TotalCarbonMass, RemainCarbonPercent); } else l.msg("HeatCarbonMass returned bad result: {0}", TotalCarbonMass); } else { l.err( "bad data for HeatCarbonMass [IronMass: {0}][IronCarbonPercent: {1}][ScrapMass: {2}][ScrapCarbonPercent: {3}][SteelCarbonPercent: {4}]", heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent, heatData.SteelCarbonPercent ); } } else // if (!GasCarbonMassFinished) { heatData.DeltaT = m_sw.ElapsedMilliseconds*0.001; m_sw.Restart(); if ( (heatData.CarbonMonoxideVolumePercent > 0) && (heatData.OffgasVolumeRate > 0) && (heatData.DeltaT > 0) && (heatData.Kgasan > 0) ) { double GCMResult = Decarbonater.GasanCarbonMass( heatData.CarbonMonoxideVolumePercent, heatData.OffgasVolumeRate, heatData.DeltaT, heatData.Kgasan ); if (GCMResult >= 0) { if (heatData.OxygenVolumeRate > 0) RemainCarbonMass -= GCMResult; ////////////////////////////// } else l.err("GasanCarbonMass return bad result: {0}", GCMResult); if ( (RemainCarbonMass > 0) && (heatData.IronMass > 0) && (heatData.IronCarbonPercent > 0) && (heatData.ScrapMass > 0) && (heatData.ScrapCarbonPercent > 0) ) { RemainCarbonPercent = GetCarbonPercent( RemainCarbonMass, heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent ); } else { l.err( "bad data for GetCarbonPercent [RemainCarbonMass: {0}][IronMass: {1}][IronCarbonPercent: {2}][ScrapMass: {3}][ScrapCarbonPercent: {4}]", RemainCarbonMass, heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent ); } } else { l.err( "bad data for GasanCarbonMass [CarbonMonoxideVolumePercent: {0}][OffgasVolumeRate: {1}][DeltaT: {2}][Kgasan: {3}]", heatData.CarbonMonoxideVolumePercent, heatData.OffgasVolumeRate, heatData.DeltaT, heatData.Kgasan ); } } const double carbonTreshold = 0.095; RemainCarbonPercent = RemainCarbonPercent < carbonTreshold ? carbonTreshold : RemainCarbonPercent; // ограничение углерода var fex2 = new ConnectionProvider.FlexHelper("OffGasDecarbonater.Result"); fex2.AddArg("C", RemainCarbonPercent); fex2.Fire(Program.PushGate); ////////////////////////////////////////////////////////////////////// } }
public static void Iterate(HeatData heatData) { using (var l = new Logger("Iterate")) { var calculatedCarboneEvent = new CalculatedCarboneEvent(); if (!TotalCarbonMassCalculated) { if ( (heatData.IronMass > 0) && (heatData.IronCarbonPercent > 0) && (heatData.ScrapMass > 0) && (heatData.ScrapCarbonPercent > 0) && (heatData.SteelCarbonPercent > 0) ) { TotalCarbonMass = Decarbonater.HeatCarbonMass( heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent, heatData.SteelCarbonPercent ); RemainCarbonMass = TotalCarbonMass; RemainCarbonPercent = GetCarbonPercent(RemainCarbonMass, heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent); if (TotalCarbonMass > 0 && heatData.OxygenVolumeRate > 0) { TotalCarbonMassCalculated = true; l.msg("##### [TotalCarbonMassCalculated: {0}][RemainCarbonPercent]", TotalCarbonMass, RemainCarbonPercent); } else l.msg("HeatCarbonMass returned bad result: {0}", TotalCarbonMass); } else { l.err( "bad data for HeatCarbonMass [IronMass: {0}][IronCarbonPercent: {1}][ScrapMass: {2}][ScrapCarbonPercent: {3}][SteelCarbonPercent: {4}]", heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent, heatData.SteelCarbonPercent ); } } else if (!GasCarbonMassFinished) { heatData.DeltaT = m_sw.ElapsedMilliseconds*0.001; m_sw.Restart(); if ( (heatData.CarbonMonoxideVolumePercent > 0) && (heatData.OffgasVolumeRate > 0) && (heatData.DeltaT > 0) && (heatData.Kgasan > 0) ) { double GCMResult = Decarbonater.GasanCarbonMass( heatData.CarbonMonoxideVolumePercent, heatData.OffgasVolumeRate, heatData.DeltaT, heatData.Kgasan ); if (GCMResult >= 0) { if (heatData.OxygenVolumeRate > 0) RemainCarbonMass -= GCMResult; ////////////////////////////// } else l.err("GasanCarbonMass return bad result: {0}", GCMResult); if ( (RemainCarbonMass > 0) && (heatData.IronMass > 0) && (heatData.IronCarbonPercent > 0) && (heatData.ScrapMass > 0) && (heatData.ScrapCarbonPercent > 0) ) { RemainCarbonPercent = GetCarbonPercent( RemainCarbonMass, heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent ); } else { l.err( "bad data for GetCarbonPercent [RemainCarbonMass: {0}][IronMass: {1}][IronCarbonPercent: {2}][ScrapMass: {3}][ScrapCarbonPercent: {4}]", RemainCarbonMass, heatData.IronMass, heatData.IronCarbonPercent, heatData.ScrapMass, heatData.ScrapCarbonPercent ); } GasCarbonMassFinished = VerifyGasCarbonFinished( heatData.OxygenVolumeTotal, heatData.OxygenVolumeCurrent, TotalCarbonMass, RemainCarbonMass, heatData.CarbonMonoxideVolumePercent, heatData.CarbonMonoxideVolumePercentPrevious, heatData.CarbonOxideVolumePercent, heatData.CarbonOxideVolumePercentPrevious ); } else { l.err( "bad data for GasanCarbonMass [CarbonMonoxideVolumePercent: {0}][OffgasVolumeRate: {1}][DeltaT: {2}][Kgasan: {3}]", heatData.CarbonMonoxideVolumePercent, heatData.OffgasVolumeRate, heatData.DeltaT, heatData.Kgasan ); } } else { var currentStateData = new MFCMData { CarbonMonoxideVolumePercent = heatData.CarbonMonoxideVolumePercent, CarbonOxideVolumePercent = heatData.CarbonOxideVolumePercent, HeightLanceCentimeters = heatData.HeightLanceCentimeters, OxygenVolumeRate = heatData.OxygenVolumeRate }; //MFMChooser //var CMCarbon = Decarbonater.MultiFactorCarbonMass(heatData.MatrixStateData, currentStateData); m_currentMatrix = MFMChooser(heatData); var matrixStateData = Program.MFCMDataGenerate(Program.MatrixStateDataFull[m_currentMatrix].MatrixList); var CMCarbon = Decarbonater.MultiFactorCarbonMass(matrixStateData, currentStateData); //if (CMCarbon < RemainCarbonPercent) RemainCarbonPercent = CMCarbon; RemainCarbonPercent = CMCarbon; if (MomentFixDataForMFactorModel(heatData.CarbonMonoxideVolumePercent, heatData.CarbonOxideVolumePercent)) // фиксируем для обучения { if (m_noFixData) { CurrentHeatResult.OxygenVolumeRate = heatData.OxygenVolumeRate; CurrentHeatResult.SteelCarbonCalculationPercent = RemainCarbonPercent; CurrentHeatResult.CarbonMonoxideVolumePercent = heatData.CarbonMonoxideVolumePercent; CurrentHeatResult.CarbonOxideVolumePercent = heatData.CarbonOxideVolumePercent; CurrentHeatResult.HeightLanceCentimeters = heatData.HeightLanceCentimeters; CurrentHeatResult.MFMEquationId = m_currentMatrix; // фиксируем матрицу по которой учим EnqueueWaitC(CurrentHeatResult); // ставим в очередь ожидания углерода Program.PushGate.PushEvent(new FixDataMfactorModelEvent()); // временная мера для перехода на старый углерод var fex = new ConnectionProvider.FlexHelper("CPlusProcessor.DataFix"); fex.Fire(Program.PushGate); Console.WriteLine(fex.evt + "\n"); ////////////////////////////////////////////////////////////////////// m_noFixData = false; } } } DataArchSec.SD.Add(new SecondData()); // заполняем для статистики во время плавки DataArchSec.SD[DataArchSec.SD.Count - 1].CarboneCalc = RemainCarbonPercent; DataArchSec.SD[DataArchSec.SD.Count - 1].Time = DateTime.Now.ToString(); DataArchSec.SD[DataArchSec.SD.Count - 1].CarboneMonoxide = heatData.CarbonMonoxideVolumePercent; DataArchSec.SD[DataArchSec.SD.Count - 1].CarboneOxide = heatData.CarbonOxideVolumePercent; DataArchSec.SD[DataArchSec.SD.Count - 1].HeightLance = heatData.HeightLanceCentimeters; DataArchSec.SD[DataArchSec.SD.Count - 1].OxygenVolumeCurrent = heatData.OxygenVolumeCurrent; // if (!GasCarbonMassFinished) { DataArchSec.SD[DataArchSec.SD.Count - 1].Model = "Gas Analise Mono factor Model"; l.msg("Gas Analise Mono factor Model"); } else { DataArchSec.SD[DataArchSec.SD.Count - 1].Model = "Multi Factor Model"; l.msg("Multi Factor Model № {0}", m_currentMatrix); } calculatedCarboneEvent.CarbonePercent = RemainCarbonPercent; calculatedCarboneEvent.CarboneMass = RemainCarbonMass; calculatedCarboneEvent.model = DataArchSec.SD[DataArchSec.SD.Count - 1].Model; Program.PushGate.PushEvent(calculatedCarboneEvent); //Program.PushGate.PushEvent(new CalculatedCarboneEvent()); // временная мера для перехода на старый углерод var fex2 = new ConnectionProvider.FlexHelper("CPlusProcessor.Result"); fex2.AddArg("C", RemainCarbonPercent); fex2.Fire(Program.PushGate); ////////////////////////////////////////////////////////////////////// } }
public static void Iterate(HeatData heatData) { using (var l = new Logger("Iterate")) { if (ModelIsStarted) { var currentStateData = new MFCMData { CarbonMonoxideVolumePercent = heatData.CarbonMonoxideVolumePercent, CarbonOxideVolumePercent = heatData.CarbonOxideVolumePercent, HeightLanceCentimeters = heatData.HeightLanceCentimeters, OxygenVolumeRate = heatData.OxygenVolumeRate }; m_currentMatrix = MFMChooser(heatData); var matrixStateData = Program.MFCMDataGenerate(Program.MatrixStateDataFull[m_currentMatrix].MatrixList); var CMCarbon = Decarbonater.MultiFactorCarbonMass(matrixStateData, currentStateData); //if (CMCarbon < RemainCarbonPercent) RemainCarbonPercent = CMCarbon; RemainCarbonPercent = CMCarbon; var fex2 = new ConnectionProvider.FlexHelper("SMFCarbon.Result"); fex2.AddArg("C", RemainCarbonPercent); fex2.Fire(Program.PushGate); Console.CursorTop = Console.CursorTop - 1; Console.WriteLine(" "); Console.CursorTop = Console.CursorTop - 1; Console.WriteLine("Carbon = " + RemainCarbonPercent + "%"); if (MomentFixDataForMFactorModel(heatData.CarbonMonoxideVolumePercent, heatData.CarbonOxideVolumePercent)) // фиксируем для обучения { if (!m_dataIsFixed) { CurrentHeatResult.OxygenVolumeRate = heatData.OxygenVolumeRate; CurrentHeatResult.SteelCarbonCalculationPercent = RemainCarbonPercent; CurrentHeatResult.CarbonMonoxideVolumePercent = heatData.CarbonMonoxideVolumePercent; CurrentHeatResult.CarbonOxideVolumePercent = heatData.CarbonOxideVolumePercent; CurrentHeatResult.HeightLanceCentimeters = heatData.HeightLanceCentimeters; CurrentHeatResult.MFMEquationId = m_currentMatrix; // фиксируем матрицу по которой учим EnqueueWaitC(CurrentHeatResult); // ставим в очередь ожидания углерода var fex = new ConnectionProvider.FlexHelper("SMFCarbon.DataFix"); fex.AddArg("C", RemainCarbonPercent); fex.Fire(Program.PushGate); l.msg(fex.evt + "\n"); m_dataIsFixed = true; } } } else { ModelIsStarted = ModelVerifiForStart( heatData.OxygenVolumeTotal, heatData.OxygenVolumeCurrent, heatData.CarbonMonoxideVolumePercent, heatData.CarbonMonoxideVolumePercentPrevious, heatData.CarbonOxideVolumePercent, heatData.CarbonOxideVolumePercentPrevious ); if (ModelIsStarted) { var fex = new ConnectionProvider.FlexHelper("SMFCarbon.ModelIsStarted"); fex.Fire(Program.PushGate); l.msg(fex.evt + "\n"); } Console.Write("."); } } }
public static void Iterate() { using (var l = new Logger("Iterate")) { var oxy = Oxigen.Average(SmoothInterval); var co = CarbonMonoxide.Average(SmoothInterval); if (VerificateB(oxy, co, HotMetallMass) && m_isNotfiredB) // рекомендация кислорода на продувку { var fex = new ConnectionProvider.FlexHelper("SublanceGenerator.RecommendMetering.B"); fex.AddArg("OxygenStartValue", m_oxygenStartValue); fex.AddArg("CurrentOxygen", oxy); fex.AddArg("CurrentCo", co); fex.AddArg("CurrentHotMetallMass", HotMetallMass); fex.Fire(Program.MainGate); string msg = String.Format("SublanceStart fired: \n{0}", fex.evt.ToString()); l.msg(msg); m_isNotfiredB = false; } if (VerificateK(TargetCk, TargetCku, Ck) && (PeriodNumber == 2) && m_isNotfiredK) // команда на старт зонда по углероду и предуставке { var fex = new ConnectionProvider.FlexHelper("SublanceGenerator.RecommendMetering.K"); fex.AddArg("TargetCk", TargetCk); fex.AddArg("TargetCku", TargetCku); fex.AddArg("Ck", Ck); fex.AddArg("CurrentOxygen", oxy); fex.AddArg("SId", SIdK); fex.Fire(Program.MainGate); string msg = String.Format("RecommendMetering.K fired: \n{0}", fex.evt.ToString()); l.msg(msg); m_isNotfiredK = false; } //PeriodNumber = 2; if ((PeriodNumber == 2) && m_isNotfiredPrognosis) // начинаем по старту многофакторной { if (VerificatePrognosis(TargetCk, ReactionTime, Ck)) // команда на старт зонда по прогнозу { var fex = new ConnectionProvider.FlexHelper("SublanceGenerator.RecommendMetering.Prognosis"); fex.AddArg("TargetCk", TargetCk); fex.AddArg("Ck", Ck); fex.AddArg("CurrentOxygen", oxy); fex.Fire(Program.MainGate); string msg = String.Format("RecommendMetering.Prognosis fired: \n{0}", fex.evt.ToString()); l.msg(msg); m_isNotfiredPrognosis = false; } } if (EndMeteringAccept && EndMeteringAlow) { EndMetering(); EndMeteringAccept = false; EndMeteringAlow = false; l.msg("End metering by iterator"); } } }
public static void Iterate(HeatData heatData) { using (var l = new Logger("Iterate")) { var calculatedCarboneEvent = new CalculatedCarboneEvent(); var currentStateData = new MFCMData { CarbonMonoxideVolumePercent = heatData.CarbonMonoxideVolumePercent, CarbonOxideVolumePercent = heatData.CarbonOxideVolumePercent, HeightLanceCentimeters = heatData.HeightLanceCentimeters, OxygenVolumeRate = heatData.OxygenVolumeRate }; //RemainCarbonPercent = Decarbonater.ComplexNMCProcess(heatData.MatrixStateData, currentStateData); RemainCarbonPercent = Decarbonater.ComplexNMCProcess(currentStateData); if (MomentFixDataForMFactorModel(heatData.OxygenVolumeCurrent, heatData.OxygenVolumeTotal, heatData.CarbonMonoxideVolumePercent, heatData.CarbonOxideVolumePercent)) // фиксируем для обучения { if (m_noFixData) { CurrentHeatResult.OxygenVolumeRate = heatData.OxygenVolumeRate; CurrentHeatResult.SteelCarbonCalculationPercent = RemainCarbonPercent; CurrentHeatResult.CarbonMonoxideVolumePercent = heatData.CarbonMonoxideVolumePercent; CurrentHeatResult.CarbonOxideVolumePercent = heatData.CarbonOxideVolumePercent; CurrentHeatResult.HeightLanceCentimeters = heatData.HeightLanceCentimeters; EnqueueWaitC(CurrentHeatResult); // ставим в очередь ожидания углерода //Program.PushGate.PushEvent(new FixDataMfactorModelEvent()); FireFixEvent(RemainCarbonPercent); m_noFixData = false; } } ModelIsStarted = ModelVerifiForStart(heatData.OxygenVolumeCurrent, heatData.CarbonMonoxideVolumePercent, heatData.CarbonOxideVolumePercent); if (ModelIsStarted) FireStartEvent(); calculatedCarboneEvent.model = "Complex neural Model"; calculatedCarboneEvent.CarbonePercent = RemainCarbonPercent; calculatedCarboneEvent.CarboneMass = RemainCarbonMass; var fex = new ConnectionProvider.FlexHelper("NeuralProcessorC.Calc"); fex.AddArg("TypeNeural", "non linear"); fex.AddArg("C", RemainCarbonPercent); fex.Fire(Program.PushGate); FireResultCarbonEvent(); //l.msg("fired carbon:\n{0}",fex.evt.ToString()); //Program.PushGate.PushEvent(calculatedCarboneEvent); //Program.PushGate.PushEvent(new CalculatedCarboneEvent()); } }
public static void FireResultCarbonEvent() { var fex = new ConnectionProvider.FlexHelper("NeuralProcessorC.Result"); fex.AddArg("C", RemainCarbonPercent); fex.Fire(Program.PushGate); Console.WriteLine(fex.evt + "\n"); }
public static void FireFixEvent(double carbon) { var fex = new ConnectionProvider.FlexHelper("NeuralProcessorC.DataFix"); fex.AddArg("C", carbon); fex.Fire(Program.PushGate); Console.WriteLine(fex.evt + "\n"); }