public void Process(BoundNameMaterialsEvent _event) { try { this._Module._Heat.BoundNameMaterialsHistory.Add(_event); } catch { } }
public void OnEvent(BaseEvent evt) { using (var l = new Logger("ModelRunner::Listener")) { if (evt is OPCDirectReadEvent) { var odr = evt as OPCDirectReadEvent; if (odr.EventName == "HeatChangeEvent") { var hce = new HeatChangeEvent(); hce.HeatNumber = /*++*/HeatNumber; Program.m_pushGate.PushEvent(hce); } else if (odr.EventName == "visAdditionTotalEvent") { var vate = new visAdditionTotalEvent(); vate.RB5TotalWeight = 5; vate.RB6TotalWeight = 6; vate.RB7TotalWeight = 7; vate.RB8TotalWeight = 8; vate.RB9TotalWeight = 9; vate.RB10TotalWeight = 10; vate.RB11TotalWeight = 11; vate.RB12TotalWeight = 12; Program.m_pushGate.PushEvent(vate); } else if (odr.EventName == "BoundNameMaterialsEvent") { var bnme = new BoundNameMaterialsEvent(); bnme.Bunker5MaterialName = ReEncoder("ДОЛОМС"); bnme.Bunker6MaterialName = ReEncoder("ALKонц"); bnme.Bunker7MaterialName = ReEncoder("KOKS "); bnme.Bunker8MaterialName = ReEncoder("ИЗВЕСТ"); bnme.Bunker9MaterialName = ReEncoder("ИЗВЕСТ"); bnme.Bunker10MaterialName = ReEncoder("ФОМ "); bnme.Bunker11MaterialName = ReEncoder("ДОЛМИТ"); bnme.Bunker12MaterialName = ReEncoder("ДОЛОМС"); Program.m_pushGate.PushEvent(bnme); } } } }
public void MaterialsFill(BoundNameMaterialsEvent bnme) { int bunkerID = 0; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker5MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB5"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W3"; bunkerID = 1; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker6MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB6"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W3"; bunkerID = 2; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker7MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB7"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W4"; bunkerID = 3; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker8MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB8"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W5"; bunkerID = 4; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker9MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB9"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W6"; bunkerID = 5; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker10MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB10"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W7"; bunkerID = 6; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker11MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB11"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W7"; bunkerID = 7; dgHaderAdditions.Rows[bunkerID].Cells[0].Value = Encoder(bnme.Bunker12MaterialName); dgHaderAdditions.Rows[bunkerID].Cells[1].Value = "RB12"; dgHaderAdditions.Rows[bunkerID].Cells[2].Value = "W7"; }
private void React(object data) { var e = data as BaseEvent; if (e != null) { Type eventType = e.GetType(); Console.WriteLine("Incoming event. Event type is " + eventType); if (eventType == typeof(OPCDirectReadEvent)) { var opcDirectReadEvent = e as OPCDirectReadEvent; if (opcDirectReadEvent != null) Console.WriteLine("OPCDirectReadEvent asking for " + opcDirectReadEvent.EventName); if (opcDirectReadEvent != null && (opcDirectReadEvent).EventName == typeof(BoundNameMaterialsEvent).Name) { var reaction = new BoundNameMaterialsEvent { Bunker5MaterialName = "ДОЛОМС", Bunker6MaterialName = "ALКонц", Bunker7MaterialName = "KOKS ", Bunker8MaterialName = "ИЗВЕСТ", Bunker9MaterialName = "ИЗВЕСТ", Bunker10MaterialName = "ДОЛОМС", Bunker11MaterialName = "ФОМ ", Bunker12MaterialName = "МАХГ " }; _gate.PushEvent(reaction); //HeatChangeEvent HCE = new HeatChangeEvent(); //HCE.HeatNumber = 23989; //_gate.PushEvent(HCE); //Thread.Sleep(3000); Console.WriteLine("BoundNameMaterialsEvent send"); var realO = new BlowingEvent() { O2TotalVol = 0 }; _gate.PushEvent(realO); for (int i = 1; i < 11; i++) { var additions = new visAdditionTotalEvent { RB5TotalWeight = 100 * i, RB6TotalWeight = 100 * i, RB7TotalWeight = 100 * i, RB8TotalWeight = 100 * i, RB9TotalWeight = 100 * i, RB10TotalWeight = 100 * i, RB11TotalWeight = 100 * i, RB12TotalWeight = 100 * i }; _gate.PushEvent(additions); Thread.Sleep(5000); } for (int i = 0; i < 10; i++) { var realO2 = new BlowingEvent() { O2TotalVol = 1 }; _gate.PushEvent(realO2); Thread.Sleep(1000); } var realzeroO2 = new BlowingEvent() { O2TotalVol = 0 }; _gate.PushEvent(realzeroO2); } if (opcDirectReadEvent != null && (opcDirectReadEvent).EventName == typeof(ModeVerticalPathEvent).Name) { var reaction = new ModeVerticalPathEvent { VerticalPathMode = 1 }; _gate.PushEvent(reaction); Console.WriteLine("ModeVerticalPathEvent send"); } if (opcDirectReadEvent != null && (opcDirectReadEvent).EventName == typeof(ModeLanceEvent).Name) { var reaction = new ModeLanceEvent { LanceMode = 3, O2FlowMode = 3 }; _gate.PushEvent(reaction); Console.WriteLine("ModeLanceEvent send"); } } if (eventType == typeof(SteelMakingPatternEvent)) { if (_processingHeat) { return; } _processingHeat = true; var steelMakingPatternEvent = e as SteelMakingPatternEvent; if (steelMakingPatternEvent != null) { int stepsCount = steelMakingPatternEvent.steps.Count; for (int i = 0; i < stepsCount; i++) { var reaction = new HeatSchemaStepEvent { Step = i }; var realO2 = new BlowingEvent() { O2TotalVol = 25000 * i / stepsCount }; var realLance = new LanceEvent() { LanceHeight = 700 - (700 * i / stepsCount) }; _gate.PushEvent(reaction); Console.WriteLine("HeatSchemaStepEvent send"); InstantLogger.log(DateTime.Now.ToString() + " Новый шаг, HeatSchemaStepEvent send\r\n"); _gate.PushEvent(realO2); Console.WriteLine("BlowingEvent send"); _gate.PushEvent(realLance); Console.WriteLine("LanceEvent send"); Thread.Sleep(5000); } } //var fex = new FlexHelper("CorrectionCT.RecommendBalanceBlow"); //fex.AddArg("CorrectionOxygenT", 18700); //fex.AddArg("CorrectionOxygenC", 18710); //fex.AddArg("CurrentC", 0.432); //fex.AddArg("TargetC", 0.432); //fex.AddArg("CurrentT", 1670); //fex.AddArg("TargetT", 1680); //fex.Fire(_gate); var lastReaction = new HeatSchemaStepEvent { Step = -1 }; _gate.PushEvent(lastReaction); Console.WriteLine("HeatSchemaStepEvent with stop signal send"); _processingHeat = false; } } }