コード例 #1
0
 public static void FireCarbon(double c, int periodlNumber)
 {
     var fex = new FlexHelper("CarbonSwitcher.Result");
     fex.AddArg("C", c);
     fex.AddArg("PeriodlNumber", periodlNumber);
     fex.Fire(Program.MainGate);
 }
コード例 #2
0
 public static void ReqCalc(Client CoreGate, InData modelInData)
 {
     var fex = new FlexHelper("UI.Calc");
     fex.AddArg("SteelType", modelInData.SteelType);
     fex.AddArg("MHi", modelInData.MHi);
     fex.AddArg("MSc", modelInData.MSc);
     fex.AddArg("SiHi", modelInData.SiHi);
     fex.AddArg("THi", modelInData.THi);
     fex.AddArg("IsProcessingUVS", modelInData.IsProcessingUVS);
     fex.Fire(CoreGate);
 }
コード例 #3
0
 public static void FireTimerHandler(object source, ElapsedEventArgs e)
 {
     var fex = new FlexHelper("CoreMeteringEvent");
     fex.AddArg("SendTime", DateTime.Now);
     FlexList.Add(fex.evt);
     fex.Fire(MainGate);
     var last = ResultList.Count - 1;
     ResultList[last].FieredEvents++;
     //Console.Write(".");
     //SaveMatrix(ArchPath);
 }
コード例 #4
0
 public void Init()
 {
     mixerTimer.Interval = 1000;
     mixerTimer.AutoReset = false;
     mixerTimer.Enabled = true;
     mixerTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
     // список доступных миксеров
     var fex = new FlexHelper("OPC.Read-OPC.HM-Chemistry.Event.");
     fex.Fire(Program.MainGate);
     // текущий номер плавки
     Program.MainGate.PushEvent(new OPCDirectReadEvent() { EventName = typeof(HeatChangeEvent).Name });
 }
コード例 #5
0
 public void Init()
 {
     MainGate = new Client(ClientName, this);
     MainGate.Subscribe();
     mixerTimer.Interval = 1000;
     mixerTimer.AutoReset = false;
     mixerTimer.Enabled = true;
     mixerTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
     // список доступных миксеров
     var fex = new FlexHelper("OPC.Read-OPC.HM-Chemistry.Event.");
     ClientFace.ironTable.dgw.RowCount = 0;
     fex.Fire(MainGate);
     // текущий номер плавки
     MainGate.PushEvent(new OPCDirectReadEvent() {EventName = typeof (HeatChangeEvent).Name});
 }
コード例 #6
0
        public static void SendResultCalc(OutData outData)
        {
            var fex = new FlexHelper("Charge5.ResultCalc");

            fex.AddArg("MDlm", outData.MDlm); // int
            fex.AddArg("MDlms", outData.MDlms); // int
            fex.AddArg("MFom", outData.MFom); // int
            fex.AddArg("MHi", outData.MHi); // int
            fex.AddArg("MLi", outData.MLi); // int
            fex.AddArg("MSc", outData.MSc); // int
            fex.AddArg("IsFound", outData.IsFound); // bool

            fex.Fire(Program.MainGate);

            Implements.InstantLogger.msg(fex.evt.ToString());
        }
コード例 #7
0
 public static void fireFlex(FlexEvent d)
 {
     var fex = new FlexHelper(d.Operation);
     fex.evt.Flags = d.Flags;
     foreach (var a in d.Arguments) {
         var v = ((Element) a.Value).val;
         if (v is byte[]) {
             var vv = v as byte[];
             string s = "";
             for (var i = 0; i < vv.Length; i++) {
                 int c = vv[i];
                 if (c > 127) c += 0x0350;
                 s += Convert.ToChar(c);
             }
             ///!sb.AppendFormat("/{0}", s);
             v = s;
         }
         fex.AddArg(a.Key, v);
     }
     fex.Fire(MainGate);
 }
コード例 #8
0
 public static void FireFixEvent(double carbon)
 {
     var fex = new FlexHelper("UniversalCPlus.DataFix");
     fex.AddArg("C", carbon);
     fex.Fire(Program.MainGate);
     InstantLogger.msg(fex.evt + "\n");
 }
コード例 #9
0
        public static void Iterate()
        {
            if (ModelIsStarted) {
                if (m_dataIsFixed) {
                    if (!m_dataIsEnqueue) {
                        CurrentState.SteelCarbonPercentCalculated = Decarbonater.MFactorUniversalCarbonPlus(m_matrix,
                                                                                                   CurrentState);
                        CurrentState.SteelCarbonPercentCalculated =
                            CarbonClipper(CurrentState.SteelCarbonPercentCalculated);
                        if (VerifyForEnqueueWaitC()) EnqueueWaitC(); // ставим в очередь если плавка нормальная
                        m_dataIsEnqueue = true;
                        FireCurrentCarbon(CurrentState.SteelCarbonPercentCalculated);
                        FireFixEvent(CurrentState.SteelCarbonPercentCalculated);
                    }
                }
                else {
                    var co2 = HDSmoother.CO2.Average(PeriodSec);
                    var co = HDSmoother.CO.Average(PeriodSec);
                    CurrentState.CarbonVP = co*0.43 + co2 * 0.27;
                    CurrentState.CarbonIVP += CurrentState.CarbonVP;
                    CurrentState.TimeFromX += IntervalSec;
                    CurrentState.SteelCarbonPercentCalculated = Decarbonater.MFactorUniversalCarbonPlus(m_matrix, CurrentState);

                    //if (!m_dataIsEnqueue) m_lastCarbon = CurrentState.SteelCarbonPercentCalculated;
                    CurrentState.SteelCarbonPercentCalculated = CarbonClipper(CurrentState.SteelCarbonPercentCalculated);
                    FireCurrentCarbon(CurrentState.SteelCarbonPercentCalculated); // fire flex

                    //Console.WriteLine("Carbone = " + CurrentState.SteelCarbonPercentCalculated + "%");
                    m_dataIsFixed = ModelVerifiForFix();
                }
            }
            else {
                ModelIsStarted = ModelVerifiForStart();

                if (ModelIsStarted) {
                    FireCurrentCarbon(0.095);
                    var fex = new FlexHelper("UniversalCPlus.ModelIsStarted");
                    fex.Fire(Program.MainGate);
                    InstantLogger.msg(fex.evt + "\n");
                }
            }

            if (HDSmoother.HeatIsStarted)
                CurrentState.HightQualityHeat = HightQualityHeatVerify();
        }
コード例 #10
0
 public String ProcessNews()
 {
     using (Logger l = new Logger("PipeCatcher"))
     {
         OraCmd.CommandText = ProcName;
         OraCmd.CommandType = System.Data.CommandType.StoredProcedure;
         OraCmd.Parameters.Clear();
         OraCmd.Parameters.Add(new OracleParameter("NRECID", OracleDbType.Decimal, System.Data.ParameterDirection.Input)).Value = RecId;
         OraCmd.Parameters.Add(new OracleParameter("REFCURSOR", OracleDbType.RefCursor, System.Data.ParameterDirection.Output));
        // OraCmd.Parameters["NRECID"].Value = RecId;
         if (OraCmd.Connection.State != System.Data.ConnectionState.Closed)
         {
             OraCmd.Connection.Close();
         }
         OraCmd.Connection.Open();
         OraReader = OraCmd.ExecuteReader();
         var str = String.Format("\nCALL {0}({1})", ProcName, RecId);
         if (OraReader.HasRows)
         {
             var f = new FlexHelper("PipeCatcher.Call." + ProcName);
             str += "+++";
             OraReader.Read();
             f.AddArg("@ProcName", ProcName);
             for (int i = 0; i < OraReader.FieldCount; i++)
             {
                 f.AddArg(OraReader.GetName(i), OraReader[i]);
                 str += "\n" + OraReader.GetName(i) + "\t: " + OraReader[i];
             }
             f.Fire(Program.CoreGate);
         }
         else
         {
             str += "---";
         }
         OraReader.Close();
         return str;
     }
 }
コード例 #11
0
        public static void FireCurrentCarbon(double carbon)
        {
            const double tresholdCarbon = 0.03;
            carbon = carbon < tresholdCarbon ? tresholdCarbon : carbon; // ограничение на углерод

            var fex = new FlexHelper("UniversalCPlus.Result");
            fex.AddArg("C", carbon);
            fex.Fire(Program.MainGate);
            InstantLogger.msg("carbon = {0}", carbon);
        }
コード例 #12
0
 public static void StopBlowFlagRelease()
 {
     var fex = new ConnectionProvider.FlexHelper("OPC.ComEndBlowing");
     fex.AddArg("EndBlowingSignal", 0);
     fex.Fire(Program.MainGate);
     InstantLogger.log(fex.evt.ToString());
 }
コード例 #13
0
 public static void SublanceDataLost(object source, ElapsedEventArgs e)
 {
     WaitSublanceData.Enabled = false;
     var fex = new ConnectionProvider.FlexHelper("CorrectionCT.SublanceDataLost");
     fex.Fire(Program.MainGate);
     InstantLogger.log(fex.evt.ToString());
 }
コード例 #14
0
        private static void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            m_vPathIsOutput = !VPathDataIsEqual(HDataList[m_position].Bunkers, m_vPathDataLast);
            if (m_vPathIsOutput) {
                Console.WriteLine(
                    "{17:0000}: {0:00000} > {1:000} | {2:0000.0} | {3:00.0} | {4:00.0} | {5:00.0} | {6:00.0} | {7:00.0} | {8:00.0} " +
                    "| {9:0000} | {10:0000} | {11:0000} | {12:0000} | {13:0000} | {14:0000} | {15:0000} | {16:0000}",
                    m_totalO2,
                    HDataList[m_position].HeightLance,
                    HDataList[m_position].RateO2,
                    HDataList[m_position].H2,
                    HDataList[m_position].O2,
                    HDataList[m_position].CO,
                    HDataList[m_position].CO2,
                    HDataList[m_position].N2,
                    HDataList[m_position].Ar,
                    HDataList[m_position].Bunkers.RB5,
                    HDataList[m_position].Bunkers.RB6,
                    HDataList[m_position].Bunkers.RB7,
                    HDataList[m_position].Bunkers.RB8,
                    HDataList[m_position].Bunkers.RB9,
                    HDataList[m_position].Bunkers.RB10,
                    HDataList[m_position].Bunkers.RB11,
                    HDataList[m_position].Bunkers.RB12,
                    ++m_step
                    );
                m_vPathDataLast = HDataList[m_position].Bunkers;
            }
            else {
                Console.WriteLine(
                    "{9:0000}: {0:00000} > {1:000} | {2:0000.0} | {3:00.0} | {4:00.0} | {5:00.0} | {6:00.0} | {7:00.0} | {8:00.0}",
                    m_totalO2,
                    HDataList[m_position].HeightLance,
                    HDataList[m_position].RateO2,
                    HDataList[m_position].H2,
                    HDataList[m_position].O2,
                    HDataList[m_position].CO,
                    HDataList[m_position].CO2,
                    HDataList[m_position].N2,
                    HDataList[m_position].Ar,
                    ++m_step
                    );
            }
            var le = new LanceEvent();
            le.LanceHeight = HDataList[m_position].HeightLance;
            le.O2Flow = HDataList[m_position].RateO2;
            le.O2TotalVol = (int) m_totalO2;

            var offGA = new OffGasAnalysisEvent();
            offGA.H2 = HDataList[m_position].H2;
            offGA.O2 = HDataList[m_position].O2;
            offGA.CO = HDataList[m_position].CO;
            offGA.CO2 = HDataList[m_position].CO2;
            offGA.N2 = HDataList[m_position].N2;
            offGA.Ar = HDataList[m_position].Ar;

            var fex = new FlexHelper("UDP.OffGasAnalysisEvent");
            fex.AddArg("H2", HDataList[m_position].H2);
            fex.AddArg("O2", HDataList[m_position].O2);
            fex.AddArg("CO", HDataList[m_position].CO);
            fex.AddArg("CO2", HDataList[m_position].CO2);
            fex.AddArg("N2", HDataList[m_position].N2);
            fex.AddArg("Ar", HDataList[m_position].Ar);
            fex.Fire(MainGate);

            var offG = new OffGasEvent();
            offG.OffGasFlow = HDataList[m_position].VOffGas;
            offG.OffGasTemp = (int) Math.Round(HDataList[m_position].TOffGas);

            var bE = new BlowingEvent();
            bE.O2TotalVol = (int) m_totalO2;
            bE.BlowingFlag = 1;

            var vate = new visAdditionTotalEvent();
            vate.RB5TotalWeight = HDataList[m_position].Bunkers.RB5;
            vate.RB6TotalWeight = HDataList[m_position].Bunkers.RB6;
            vate.RB7TotalWeight = HDataList[m_position].Bunkers.RB7;
            vate.RB8TotalWeight = HDataList[m_position].Bunkers.RB8;
            vate.RB9TotalWeight = HDataList[m_position].Bunkers.RB9;
            vate.RB10TotalWeight = HDataList[m_position].Bunkers.RB10;
            vate.RB11TotalWeight = HDataList[m_position].Bunkers.RB11;
            vate.RB12TotalWeight = HDataList[m_position].Bunkers.RB12;

            if ((HDataList[m_position].SublanceC > 0) && !m_sublanceCIsPushed) {
                Int64 reminder = 0;
                Int64 res = Math.DivRem(m_heatNumber, 10000, out reminder);
                Int64 longHN = res*100000 + reminder;
                MainGate.PushEvent(new visSpectrluksEvent() {C = HDataList[m_position].SublanceC, HeatNumber = longHN});
                Console.WriteLine("specroluks push Heat = {0} ", longHN);
                MainGate.PushEvent(new SublanceCEvent() {C = HDataList[m_position].SublanceC});
                m_sublanceCIsPushed = true;
                Console.WriteLine("Carbone pushed C = {0}, heatNumber = {1}", HDataList[m_position].SublanceC, longHN);
            }

            var doge = new DecompressionOffGasEvent();
            m_decompressionOffGas = HDataList[m_position].DecompressionOffGas == Int32.MinValue
                                        ? m_decompressionOffGas
                                        : HDataList[m_position].DecompressionOffGas;
            doge.Decompression = m_decompressionOffGas;

            MainGate.PushEvent(le);
            MainGate.PushEvent(offGA);
            MainGate.PushEvent(offG);
            MainGate.PushEvent(bE);
            MainGate.PushEvent(doge);

            m_totalO2 += HDataList[m_position].RateO2*0.01666666666666666666666666666667;

            if (m_vPathIsOutput) MainGate.PushEvent(vate);

            //Console.WriteLine("m_position -- {0}; HDataList.Count -- {1}", m_position, HDataList.Count);
            if (m_position < HDataList.Count - 1)
                m_position++;
            else {
                Console.WriteLine("Exit 0");
                System.Environment.Exit(0);
                m_timer.Enabled = false;
            }
        }
コード例 #15
0
 public static void DoStopBlow()
 {
     var fex = new ConnectionProvider.FlexHelper("OPC.ComEndBlowing");
     fex.AddArg("EndBlowingSignal", 1);
     fex.Fire(Program.MainGate);
     InstantLogger.log(fex.evt.ToString());
     BlowStopSignalPushed = true;
 }
コード例 #16
0
 public static void FireStartCRecalc()
 {
     var fex = new FlexHelper("CorrectionCT.ModelIsStarted");
     fex.Fire(Program.MainGate);
 }
コード例 #17
0
        private void PatternSave()
        {
            for (int i = 0; i < CountTables; i++)
                Tables[i] = UpdateCsvtpFromTd(DGTables[i], Tables[i]);

            CSVTP_FlexEventConverter.AppName = "UI";
            var flex = CSVTP_FlexEventConverter.PackToFlex(PatternLoadedName, InitTbl, Tables);
            ConsolePush("Паттерн запакован");
            var fex = new FlexHelper(flex.Operation);
            fex.evt.Arguments = flex.Arguments;
            fex.Fire(Requester.MainGate);
            StatusChange("Паттерн отправлен на сохранение...");
        }
コード例 #18
0
 public static void FireResultCRecalc(double carbon)
 {
     var fex = new FlexHelper("CorrectionCT.Result");
     fex.AddArg("C", carbon);
     fex.Fire(Program.MainGate);
     InstantLogger.msg("Recaclc C = {0}", carbon);
 }
コード例 #19
0
 public static void FireFixCRecalc(double carbon)
 {
     var fex = new FlexHelper("CorrectionCT.DataFix");
     fex.AddArg("C", carbon);
     fex.Fire(Program.MainGate);
 }
コード例 #20
0
 public static void EndMeteringAccept()
 {
     var fex = new ConnectionProvider.FlexHelper("CorrectionCT.EndMeteringAccept");
     fex.Fire(Program.MainGate);
     InstantLogger.log(fex.evt.ToString());
 }
コード例 #21
0
 public static void ReqPatternNames(Client CoreGate)
 {
     var fex = new FlexHelper("UI.GetNamePatterns");
     fex.Fire(CoreGate);
 }
コード例 #22
0
        private static void transmitter(object state)
        {
            //Console.BackgroundColor = ConsoleColor.Red;
            //Console.ForegroundColor = ConsoleColor.White;
            mainGate = new ConnectionProvider.Client();

            CultureInfo culture = CultureInfo.InvariantCulture;
            System.Threading.Thread.Sleep(1000);
            //mainGate.PushEvent(new comBlowingSchemaEvent()); // после запуска программы листенер пропускает первое сообщение через раз, как временное решение проблемы сообщение с -1
            //mainGate.PushEvent(new HeatChangeEvent() {HeatNumber = 1133});
            //mainGate.PushEvent(new BoundNameMaterialsEvent() {Bunker1MaterialName = "m1", Bunker2MaterialName = "m2", Bunker3MaterialName = "m3"});
            //mainGate.PushEvent(new OPCDirectReadEvent() { EventName = typeof(BoundNameMaterialsEvent).Name });
            //mainGate.PushEvent(new OPCDirectReadEvent() {EventName = typeof(WeighersStateEvent).Name});

            //mainGate.PushEvent(new comAdditionsSchemaEvent());
            //mainGate.PushEvent(new cntWeigher3JobReadyEvent() {Counter = 1137});
            //mainGate.PushEvent(new cntWeigher4JobReadyEvent() { Counter = 1137 });
            //mainGate.PushEvent(new cntWeigher5JobReadyEvent() { Counter = 1137 });
            //mainGate.PushEvent(new cntWeigher6JobReadyEvent() { Counter = 1137 });
            //mainGate.PushEvent(new cntWeigher7JobReadyEvent() { Counter = 1137 });
            //mainGate.PushEvent(new comBlowingSchemaEvent());

            //mainGate.PushEvent(new cntBlowingSchemaEvent() {Counter = 1137});
            //mainGate.PushEvent(new cntO2FlowRateEvent() { Counter = 1137 });
            //var be = new BlowingEvent() {O2TotalVol = 0};
            //int oxyRate = 100;
            //while (true)
            //{
            //    be.O2TotalVol += oxyRate;
            //    mainGate.PushEvent(be);
            //    Thread.Sleep(500);
            //}
            //int ii = 0;
            //while (true)
            //{
            //    mainGate.PushEvent(new HeatChangeEvent() {HeatNumber = ii++});
            //    Thread.Sleep(100);
            //}

            //Console.BackgroundColor = ConsoleColor.Black;
            //Console.ForegroundColor = ConsoleColor.Green;
            /*lock (consoleLock)
            {
                Console.WriteLine("transmitter...................................................................................[started]\n");
            }*/

            var dimm = new int[] {1, 2, 3};

            var fxe = new FlexHelper("TestComplex");

            fxe.AddComplexArg("dimm", dimm);
            fxe.Fire(mainGate);
            Console.WriteLine("Send:");
            Console.WriteLine(fxe.evt);

            //var fex = new FlexHelper("OPC.Flex.Suka");
            //fex.AddArg("val-i2", 1133);
            //fex.AddArg("val-r4", -11.33);
            //fex.AddArg("val-s", "Zalupa");
            //fex.Fire(mainGate);
            //mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 221111 });

            //mainGate.PushEvent(new visSpectrluksEvent() { HeatNumber = 2201111, C = 0.05 });

            InstantLogger.log("transmitter", "Started", InstantLogger.TypeMessage.important);
            string[] strings;

            try {
                strings = File.ReadAllLines("BlowData.csv");
            }
            catch {
                strings = new string[0];
                //Console.Write("cannot read the file");
                InstantLogger.log("Cannot read the file", "Error", InstantLogger.TypeMessage.error);
                return;
            }
            //Console.Write(strings.ToString() + "\n");

            comBlowingSchemaEvent blowingSchemaEvent = new comBlowingSchemaEvent();
            List<int> O2Vol = new List<int>();
            List<int> LancePosition = new List<int>();
            List<double> O2Flow = new List<double>();
            int O2SchemaNumber = 0;
            O2Vol.Add(-1); // выравнивание чтобы совпадали номера
            LancePosition.Add(-1); // выравнивание чтобы совпадали номера
            O2Flow.Add(-1); // выравнивание чтобы совпадали номера

            for (int i = 1; i < strings.Count(); i++) // в нулевой строке заголовки
            {
                string[] values = strings[i].Split(' ');

                O2SchemaNumber = int.Parse(values[0], culture);
                O2Vol.Add(int.Parse(values[1], culture));
                LancePosition.Add(int.Parse(values[2], culture));
                O2Flow.Add(double.Parse(values[3], culture));
            }
            /* lock (consoleLock)
            {
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.WriteLine("transmitter...................................................................................[send]\n");
            }*/
            InstantLogger.log("transmitter", "Send", InstantLogger.TypeMessage.unimportant);

            blowingSchemaEvent.O2SchemaNumber = O2SchemaNumber;
            blowingSchemaEvent.O2VolStep1 = O2Vol.ElementAt(1);
            blowingSchemaEvent.O2VolStep2 = O2Vol.ElementAt(2);
            blowingSchemaEvent.O2VolStep3 = O2Vol.ElementAt(3);
            blowingSchemaEvent.O2VolStep4 = O2Vol.ElementAt(4);
            blowingSchemaEvent.O2VolStep5 = O2Vol.ElementAt(5);
            blowingSchemaEvent.O2VolStep6 = O2Vol.ElementAt(6);
            blowingSchemaEvent.O2VolStep7 = O2Vol.ElementAt(7);
            blowingSchemaEvent.O2VolStep8 = O2Vol.ElementAt(8);
            blowingSchemaEvent.O2VolStep9 = O2Vol.ElementAt(9);
            blowingSchemaEvent.O2VolStep10 = O2Vol.ElementAt(10);
            blowingSchemaEvent.O2VolStep11 = O2Vol.ElementAt(11);
            blowingSchemaEvent.O2VolStep12 = O2Vol.ElementAt(12);
            blowingSchemaEvent.O2VolStep13 = O2Vol.ElementAt(13);
            blowingSchemaEvent.O2VolStep14 = O2Vol.ElementAt(14);
            blowingSchemaEvent.O2VolStep15 = O2Vol.ElementAt(15);
            blowingSchemaEvent.O2VolStep16 = O2Vol.ElementAt(16);
            blowingSchemaEvent.O2VolStep17 = O2Vol.ElementAt(17);
            blowingSchemaEvent.O2VolStep18 = O2Vol.ElementAt(18);
            blowingSchemaEvent.O2VolStep19 = O2Vol.ElementAt(19);
            blowingSchemaEvent.O2VolStep20 = O2Vol.ElementAt(20);
            blowingSchemaEvent.LancePositionStep1 = LancePosition.ElementAt(1);
            blowingSchemaEvent.LancePositionStep2 = LancePosition.ElementAt(2);
            blowingSchemaEvent.LancePositionStep3 = LancePosition.ElementAt(3);
            blowingSchemaEvent.LancePositionStep4 = LancePosition.ElementAt(4);
            blowingSchemaEvent.LancePositionStep5 = LancePosition.ElementAt(5);
            blowingSchemaEvent.LancePositionStep6 = LancePosition.ElementAt(6);
            blowingSchemaEvent.LancePositionStep7 = LancePosition.ElementAt(7);
            blowingSchemaEvent.LancePositionStep8 = LancePosition.ElementAt(8);
            blowingSchemaEvent.LancePositionStep9 = LancePosition.ElementAt(9);
            blowingSchemaEvent.LancePositionStep10 = LancePosition.ElementAt(10);
            blowingSchemaEvent.LancePositionStep11 = LancePosition.ElementAt(11);
            blowingSchemaEvent.LancePositionStep12 = LancePosition.ElementAt(12);
            blowingSchemaEvent.LancePositionStep13 = LancePosition.ElementAt(13);
            blowingSchemaEvent.LancePositionStep14 = LancePosition.ElementAt(14);
            blowingSchemaEvent.LancePositionStep15 = LancePosition.ElementAt(15);
            blowingSchemaEvent.LancePositionStep16 = LancePosition.ElementAt(16);
            blowingSchemaEvent.LancePositionStep17 = LancePosition.ElementAt(17);
            blowingSchemaEvent.LancePositionStep18 = LancePosition.ElementAt(18);
            blowingSchemaEvent.LancePositionStep19 = LancePosition.ElementAt(19);
            blowingSchemaEvent.LancePositionStep20 = LancePosition.ElementAt(20);
            blowingSchemaEvent.O2FlowStep1 = O2Flow.ElementAt(1);
            blowingSchemaEvent.O2FlowStep2 = O2Flow.ElementAt(2);
            blowingSchemaEvent.O2FlowStep3 = O2Flow.ElementAt(3);
            blowingSchemaEvent.O2FlowStep4 = O2Flow.ElementAt(4);
            blowingSchemaEvent.O2FlowStep5 = O2Flow.ElementAt(5);
            blowingSchemaEvent.O2FlowStep6 = O2Flow.ElementAt(6);
            blowingSchemaEvent.O2FlowStep7 = O2Flow.ElementAt(7);
            blowingSchemaEvent.O2FlowStep8 = O2Flow.ElementAt(8);
            blowingSchemaEvent.O2FlowStep9 = O2Flow.ElementAt(9);
            blowingSchemaEvent.O2FlowStep10 = O2Flow.ElementAt(10);
            blowingSchemaEvent.O2FlowStep11 = O2Flow.ElementAt(11);
            blowingSchemaEvent.O2FlowStep12 = O2Flow.ElementAt(12);
            blowingSchemaEvent.O2FlowStep13 = O2Flow.ElementAt(13);
            blowingSchemaEvent.O2FlowStep14 = O2Flow.ElementAt(14);
            blowingSchemaEvent.O2FlowStep15 = O2Flow.ElementAt(15);
            blowingSchemaEvent.O2FlowStep16 = O2Flow.ElementAt(16);
            blowingSchemaEvent.O2FlowStep17 = O2Flow.ElementAt(17);
            blowingSchemaEvent.O2FlowStep18 = O2Flow.ElementAt(18);
            blowingSchemaEvent.O2FlowStep19 = O2Flow.ElementAt(19);
            blowingSchemaEvent.O2FlowStep20 = O2Flow.ElementAt(20);

            SteelMakingPatternEvent steelMakingPatternEvent = new SteelMakingPatternEvent();
            steelMakingPatternEvent.materialsName[0] = "SUKA yana";
            steelMakingPatternEvent.materialsName[1] = "ДОЛОМС";
            steelMakingPatternEvent.materialsName[2] = "3material";
            steelMakingPatternEvent.materialsName[3] = "4material";
            steelMakingPatternEvent.materialsName[4] = "PULSE-CC";
            steelMakingPatternEvent.materialsName[5] = "6material";
            steelMakingPatternEvent.materialsName[6] = "7material";
            steelMakingPatternEvent.materialsName[7] = "8material";
            steelMakingPatternEvent.materialsName[8] = "9material";
            steelMakingPatternEvent.materialsName[9] = "ЯНА";

            steelMakingPatternEvent.steps.Add(new Converter.SteelMakingClasses.Step());
            steelMakingPatternEvent.steps[0].lance.LancePositin = 700;
            steelMakingPatternEvent.steps[0].lance.O2Flow = 450;
            steelMakingPatternEvent.steps[0].O2Volume = 0;

            /*     for (int i = 0; i < 10; i++)
            {
                steelMakingPatternEvent.steps[0].additions.addition[i].MaterialPortionWeight = 0;
            }
             */

            Random rnd1 = new Random();
            int qq = 0;
            for (int step = 1; step <= 25; step++) {
                steelMakingPatternEvent.steps.Add(new Converter.SteelMakingClasses.Step());
                steelMakingPatternEvent.steps[step].lance.LancePositin =
                    steelMakingPatternEvent.steps[step - 1].lance.LancePositin - 25;
                steelMakingPatternEvent.steps[step].lance.O2Flow = 1000;
                steelMakingPatternEvent.steps[step].O2Volume = steelMakingPatternEvent.steps[step - 1].O2Volume + 100;
                //qq = rnd1.Next(10);
                //steelMakingPatternEvent.steps[step].additions.addition[rnd1.Next(10)].MaterialPortionWeight = rnd1.Next(100,1000);
                int weigherid = rnd1.Next(5);
                steelMakingPatternEvent.steps[step].weigherLines[weigherid].PortionWeight = rnd1.Next(100, 1000);
                //steelMakingPatternEvent.steps[step].weigherLines[weigherid].BunkerId = rnd1.Next(8);
                if (weigherid == 0)
                    steelMakingPatternEvent.steps[step].weigherLines[weigherid].BunkerId = rnd1.Next(0, 2);
                if (weigherid == 1)
                    steelMakingPatternEvent.steps[step].weigherLines[weigherid].BunkerId = 2;
                if (weigherid == 2)
                    steelMakingPatternEvent.steps[step].weigherLines[weigherid].BunkerId = 3;
                if (weigherid == 3)
                    steelMakingPatternEvent.steps[step].weigherLines[weigherid].BunkerId = 4;
                if (weigherid == 4)
                    steelMakingPatternEvent.steps[step].weigherLines[weigherid].BunkerId = rnd1.Next(5, 8);

                /* for (int i = 0; i < 10; i++)
                {
                    steelMakingPatternEvent.steps[step].additions.addition[i].MaterialPortionWeight = 1000 + i*100 + i*10 + i;
                }*/

                /*steelMakingPatternEvent.steps[step].additions.addition[0].MaterialPortionWeight = 100;
                steelMakingPatternEvent.steps[step].additions.addition[0].O2VolPortionMateria =
                    steelMakingPatternEvent.steps[step].lance.O2Volume;*/
            }
            /* steelMakingPatternEvent.steps[5].additions.addition[0].MaterialPortionWeight = 50;
            steelMakingPatternEvent.steps[10].additions.addition[0].MaterialPortionWeight = 100;

            steelMakingPatternEvent.steps[7].additions.addition[1].MaterialPortionWeight = 71;
            steelMakingPatternEvent.steps[15].additions.addition[1].MaterialPortionWeight = 151;*/

            /* steelMakingPatternEvent.steps[0].additions.addition[0].MaterialPortionWeight = 100;
            steelMakingPatternEvent.steps[0].additions.addition[0].O2VolPortionMateria = 200;

            steelMakingPatternEvent.steps[0].additions.addition[1].MaterialPortionWeight = 100;
            steelMakingPatternEvent.steps[0].additions.addition[1].O2VolPortionMateria = 200;

            steelMakingPatternEvent.steps[0].additions.addition[2].MaterialPortionWeight = 200;
            steelMakingPatternEvent.steps[0].additions.addition[2].O2VolPortionMateria = 200;

            steelMakingPatternEvent.steps[1].additions.addition[3].MaterialPortionWeight = 200;
            steelMakingPatternEvent.steps[1].additions.addition[3].O2VolPortionMateria = 200;*/

            //steelMakingPatternEvent.steps[0].additions.
            BlowingEvent blowingEvent = new BlowingEvent();
            blowingEvent.O2TotalVol = 0;
            //    mainGate.PushEvent(blowingEvent);

            //   mainGate.PushEvent(steelMakingPatternEvent);

            //blowingEvent.O2TotalVol = 200;
            /*     ComName1MatEvent ssss =new ComName1MatEvent();
            ssss.Name = "TEST";

            ComName2MatEvent cccc = new ComName2MatEvent();
            cccc.Name[0] = (char) 6;
            cccc.Name[1] = (char) 1;
            cccc.Name[3] = (char) 32;*/
            var WSE = new WeighersStateEvent();
            WSE.Weigher3Empty = 1;
            WSE.Weigher3LoadFree = 1;
            WSE.Weigher3UnLoadFree = 1;
            WSE.Weigher4Empty = 1;
            WSE.Weigher4LoadFree = 1;
            WSE.Weigher4UnLoadFree = 1;
            WSE.Weigher5Empty = 1;
            WSE.Weigher5LoadFree = 1;
            WSE.Weigher5UnLoadFree = 1;
            WSE.Weigher6Empty = 1;
            WSE.Weigher6LoadFree = 1;
            WSE.Weigher6UnLoadFree = 1;
            WSE.Weigher7Empty = 1;
            WSE.Weigher7LoadFree = 1;
            WSE.Weigher7UnLoadFree = 1;

            //!!!!!     mainGate.PushEvent(steelMakingPatternEvent);

            //mainGate.PushEvent(new OPCDirectReadEvent() { EventName = "comAdditionsEvent" });
            //int currentStep = 0;
            //while (true)
            //{
            //    if (currentStep > 15)
            //    {
            //        currentStep = 0;
            //    }
            //    else
            //    {
            //        currentStep++;
            //        mainGate.PushEvent(new HeatSchemaStepEvent {Step = currentStep});
            //        Thread.Sleep(1000);
            //    }
            //}

            int cnt = 0;
            int step2 = 0;
            bool stepChange = false;
            /*   while (true)
            {
                         blowingEvent.O2TotalVol +=10;
                mainGate.PushEvent(blowingEvent);
                //mainGate.PushEvent(WSE);
                cnt++;
                if (cnt > 10)
                {
                    //mainGate.PushEvent(steelMakingPatternEvent);
                    //Thread.Sleep(3000);
                    cnt = 0;
                }
               // mainGate.PushEvent(new cntWatchDogPLC01Event());

                //mainGate.PushEvent(WSE);
                if (steelMakingPatternEvent.steps.Count > step2)
                {
                    if (steelMakingPatternEvent.steps[step2].O2Volume < blowingEvent.O2TotalVol)
                    {
                        step2++;
                        stepChange = true;
                    }
                }
                if (steelMakingPatternEvent.steps.Count > step2)
                {
                    if (stepChange)
                    {
                        if (steelMakingPatternEvent.steps[step2].weigherLines[0].PortionWeight > 0)
                        {
                            mainGate.PushEvent(new WeighersStateEvent()
                                                   {Weigher3Empty = 1, Weigher3LoadFree = 1, Weigher3UnLoadFree = 1});
                            stepChange = false;
                            InstantLogger.log("W3 - " +
                                       steelMakingPatternEvent.steps[step2].weigherLines[0].PortionWeight.ToString());
                        }
                        if (steelMakingPatternEvent.steps[step2].weigherLines[1].PortionWeight > 0)
                        {
                            mainGate.PushEvent(new WeighersStateEvent()
                                                   {Weigher4Empty = 1, Weigher4LoadFree = 1, Weigher4UnLoadFree = 1});
                            stepChange = false;
                            InstantLogger.log("W4 - " +
                                       steelMakingPatternEvent.steps[step2].weigherLines[1].PortionWeight.ToString());
                        }
                        if (steelMakingPatternEvent.steps[step2].weigherLines[2].PortionWeight > 0)
                        {
                            mainGate.PushEvent(new WeighersStateEvent()
                                                   {Weigher5Empty = 1, Weigher5LoadFree = 1, Weigher5UnLoadFree = 1});
                            stepChange = false;
                            InstantLogger.log("W5 - " +
                                       steelMakingPatternEvent.steps[step2].weigherLines[2].PortionWeight.ToString());
                        }
                        if (steelMakingPatternEvent.steps[step2].weigherLines[3].PortionWeight > 0)
                        {
                            mainGate.PushEvent(new WeighersStateEvent()
                                                   {Weigher6Empty = 1, Weigher6LoadFree = 1, Weigher6UnLoadFree = 1});
                            stepChange = false;
                            InstantLogger.log("W6 - " +
                                       steelMakingPatternEvent.steps[step2].weigherLines[3].PortionWeight.ToString());
                        }
                        if (steelMakingPatternEvent.steps[step2].weigherLines[4].PortionWeight > 0)
                        {
                            mainGate.PushEvent(new WeighersStateEvent()
                                                   {Weigher7Empty = 1, Weigher7LoadFree = 1, Weigher7UnLoadFree = 1});
                            stepChange = false;
                            InstantLogger.log("W7 - " +
                                       steelMakingPatternEvent.steps[step2].weigherLines[4].PortionWeight.ToString());
                        }
                    }
                }

                Thread.Sleep(1000);
            }*/

            //comO2FlowRateEvent _comO2FlowRateEvent = new comO2FlowRateEvent();
            //BlowingEvent blowingEvent = new BlowingEvent();
            //blowingEvent.O2TotalVol = 1000;

            //_comO2FlowRateEvent.O2TotalVol = 1000;
            //mainGate.PushEvent(_comO2FlowRateEvent);
            // mainGate.PushEvent(new cntO2FlowRateEvent());
            //mainGate.PushEvent(blowingSchemaEvent);
            //mainGate.PushEvent(new cntBlowingSchemaEvent());
            //_comO2FlowRateEvent.iCnvNr = 1;
            /*  while (true)
            {
                _comO2FlowRateEvent.O2TotalVol++;
                blowingEvent.O2TotalVol++;
                mainGate.PushEvent(blowingEvent);
                //mainGate.PushEvent(_comO2FlowRateEvent);
                mainGate.PushEvent(new cntWatchDogPLC01Event());
              //  mainGate.PushEvent(new cntBlowingSchemaEvent());
                //mainGate.PushEvent(new cntWatchDogPLC1Event());
                mainGate.PushEvent(_comO2FlowRateEvent);
                //mainGate.PushEvent(new cntWatchDogPLC1Event());
                Thread.Sleep(1000);
            }*/
            //SteelMakingPatternEvent ss = new SteelMakingPatternEvent();
            //ss.steps.Add(new Converter.SteelMakingClasses.Step() { Period = 777});
            //ss.steps.Add(new Converter.SteelMakingClasses.Step());
            //Console.Write(ss.ToString());
            //Console.Write(ss.steps[0].Period.ToString());
            // mainGate.PushEvent(ss);
            /* while (true)
            {
                lock (mainGate)
                {
                    mainGate.PushEvent(blowingSchemaEvent);
                    blowingSchemaEvent.O2FlowStep20++;
                }
                Thread.Sleep(1000);
            }*/
        }
コード例 #23
0
        private static void WatchDogSendTimeoutHandler(object state)
        {
            var fex = new FlexHelper("OPC.WatchdogsForL1");

            fex.AddArg("WDPLC1", m_watchdogSendValue);
            fex.AddArg("WDPLC2", m_watchdogSendValue);
            fex.AddArg("WDPLC3", m_watchdogSendValue);
            //fex.AddArg("WDPLC01", m_watchdogValue);
            fex.Fire(m_mainGate);

            if (m_watchdogSendValue < 999) m_watchdogSendValue++;
            else m_watchdogSendValue = 0;
        }
コード例 #24
0
        public static void Iterate()
        {
            var currentSecond = DateTime.Now.Second;
            if (Math.Abs(LastIterateSecond - currentSecond) >= 1) // чтоб не чаще 1 раза в секунду
            {
                LastIterateSecond = currentSecond;
                if (ModelList[Cfg.SecondModel].IsStarted) {
                    if (ModelList[Cfg.ThirdModel].IsStarted) {
                        if (!ModelList[Cfg.ThirdModel].IsFixed) {
                            if (ModelList[Cfg.ThirdModel].C > 0)
                                FireCarbon(ModelList[Cfg.ThirdModel].C, 3);
                        }
                        else {
                            //if (!ModelList[Cfg.ThirdModel].IsFiredFixed)
                            //{
                            //    var fex = new FlexHelper("CarbonSwitcher.DataFix");
                            //    fex.AddArg("C", ModelList[Cfg.SecondModel].C); //посылаем от 2й для выгрузки
                            //    fex.Fire(Program.MainGate);
                            //    ModelList[Cfg.SecondModel].IsFiredFixed = true;
                            //}
                        }
                    }
                    else {
                        if (!ModelList[Cfg.SecondModel].IsFixed) {
                            if (ModelList[Cfg.SecondModel].C > 0) {
                                //FireCarbon(ModelList[Cfg.SecondModel].C, 2);

                                var secondCarbon = ModelList[Cfg.FirstModel].C*KFirst +
                                                   ModelList[Cfg.SecondModel].C*KSecond;
                                Implements.InstantLogger.msg(
                                    "CReal = {0}; Cmixed = {1}; K1 = {2}; K2 = {3}; K1 + K2 = {4}",
                                    ModelList[Cfg.SecondModel].C, secondCarbon, KFirst, KSecond, KFirst + KSecond);
                                var periodSwitch = KSecond < 1 ? -2 : 2; // если еще не переключились, то -2
                                FireCarbon(secondCarbon, periodSwitch);

                                if (Math.Round(KFirst - SwitchSpeed, 3) > 0.0) KFirst -= SwitchSpeed;
                                else KFirst = 0.0;
                                KFirst = Math.Round(KFirst, 5);
                                KSecond = Math.Round(1.0 - KFirst, 5);
                                //Console.Write("#");
                            }
                        }
                        else {
                            if (!ModelList[Cfg.SecondModel].IsFiredFixed) {
                                var fex = new FlexHelper("CarbonSwitcher.DataFix");
                                fex.AddArg("C", ModelList[Cfg.SecondModel].C);
                                fex.Fire(Program.MainGate);
                                ModelList[Cfg.SecondModel].IsFiredFixed = true;
                            }
                        }
                    }
                }
                else {
                    FireCarbon(ModelList[Cfg.FirstModel].C, 1);
                    KFirst = 1;
                }
            }
        }
コード例 #25
0
 public static void GiveDlmsCooling(double currentT, double targetT)
 {
     var diff = targetT - currentT;
     if (diff < -10) {
         var fex = new ConnectionProvider.FlexHelper("CorrectionCT.GiveDlmsCooling");
         fex.Fire(Program.MainGate);
         InstantLogger.msg(fex.evt.ToString());
     }
 }
コード例 #26
0
 public static void ReqRemoovePattern(Client CoreGate, string PatternName)
 {
     var fex = new FlexHelper("UI.RemoovePattern");
     fex.AddArg("Name", PatternName);
     fex.Fire(CoreGate);
 }
コード例 #27
0
 public static void SetControlMode(bool isAutomatic)
 {
     var fex = new ConnectionProvider.FlexHelper("OPC.ComControlMode");
     if (isAutomatic) {
         fex.AddArg("LanceMode", 3);
         fex.AddArg("VpathMode", 3);
     }
     else {
         fex.AddArg("LanceMode", 0);
         fex.AddArg("VpathMode", 0);
     }
     fex.Fire(m_pushGate);
 }
コード例 #28
0
        public static void Iterator()
        {
            var msg = "";

            CorrectionOxyT = CalcT(MatrixT, Data);
            //CorrectionOxyC = CalcC(MatrixC, Data);
            CorrectionOxyC = -1; // != 0
            //EndBlowingOxygen = CorrectionOxyT; // додувать по температуре
            if (IsFiered) {
                InstantLogger.msg("End blowing oxygen: {0} || Current Oxygen: {1} || End: {2}", EndBlowingOxygen,
                                  CurrentOxygen, ((int) (EndBlowingOxygen - CurrentOxygen)).ToString());
            }
            if (CorrectionOxyT != 0)
                Console.WriteLine("CorrectionOxyT = " + CorrectionOxyT);
            //if (CorrectionOxyC != 0)
            //{
            //    Console.WriteLine("CorrectionOxyC = " + CorrectionOxyC);
            //}
            if (IsUncorrectMetering) {
                CorrectionOxyT = -5;
                msg += String.Format("\nнекорректный замер");
            }
            if (CorrectionOxyT != 0 && CorrectionOxyC != 0 && !IsFiered) {
                if ((CorrectionOxyT == -3) && (Data.TargetTuMax != 0)) {
                    //CorrectionDoloms = CalcDolmsCooling(Math.Abs(Data.CurrentT - Data.TargetT), Data.CurrentC);
                    CorrectionDoloms = CalcDolmsCooling(Math.Abs(Data.CurrentT - (((Data.TargetT + Data.TargetTuMax) + Data.TargetT) * 0.5)), Data.CurrentC); // до середины между максимальным целевым и целевым
                    msg += String.Format("\nрекомендуется выполнить охлаждение Doloms = {0} тонны", CorrectionDoloms);
                    GiveDlmsCooling(Data.CurrentT, Data.TargetT);
                }

                var fex = new ConnectionProvider.FlexHelper("CorrectionCT.RecommendBalanceBlow");
                fex.AddArg("CorrectionOxygenT", CorrectionOxyT); // int
                fex.AddArg("CorrectionOxygenC", CorrectionOxyC); // int
                fex.AddArg("CorrectionDoloms", CorrectionDoloms); // double
                fex.AddArg("CurrentC", Data.CurrentC); // double
                fex.AddArg("TargetC", Data.TargetC); // double
                fex.AddArg("CurrentT", Data.CurrentT); // int
                fex.AddArg("TargetT", Data.TargetT); // int
                fex.AddArg("SId", SidB); // Guid

                fex.Fire(Program.MainGate);

                IsFiered = true;

                InstantLogger.msg(fex.evt.ToString());

                EndBlowingOxygen = CorrectionOxyT + CurrentOxygen; // додувать по температуре

                InstantLogger.msg("End blowing oxygen {0}{1}", EndBlowingOxygen, msg);
            }
            if ((CurrentOxygen > EndBlowingOxygen) && !BlowStopSignalPushed && AutomaticStop && IsActualOxygen)
                DoStopBlow();
        }
コード例 #29
0
        public static void MainHandler()
        {
            var allRight = true;
            var offgasOkay = !m_offgasEventAbsent;
            var watchdogOkay = !(m_wd1Timeout || m_wd2Timeout || m_wd3Timeout || m_wd01Timeout);
            var description = new List<string>();

            if (m_offgasEventAbsent) {
                allRight = false;
                description.Add(String.Format("OffgasEvent absent more than {0} second", MaxSecondDelayOffGasEvent));
            }

            if (!watchdogOkay)
            {
                allRight = false;
                description.Add(String.Format("Something from watchdog did not change more than {0} second", MaxSecondDelayWatchdogChange));
            }

            var fex = new FlexHelper("L1.Keeper");

            fex.AddArg("AllRight", allRight);
            fex.AddArg("OffgasOkay", offgasOkay);
            fex.AddArg("WatchdogOkay", watchdogOkay);

            fex.AddArg("Wd1Timeout", m_wd1Timeout);
            fex.AddArg("Wd2Timeout", m_wd2Timeout);
            fex.AddArg("Wd3Timeout", m_wd3Timeout);
            fex.AddArg("Wd01Timeout", m_wd01Timeout);

            fex.AddComplexArg("Description", description);

            if (!allRight) InstantLogger.err(fex.evt.ToString());
            fex.Fire(m_mainGate);
        }
コード例 #30
0
 public static void ReqScheme(int schemaN)
 {
     var fex = new FlexHelper("DBFlex.Request");
     fex.AddArg(Implements.DBFlex.ArgEventName, "SQL.Corrections");
     fex.AddArg(Implements.DBFlex.ArgCommandName, "GetScheme");
     fex.AddArg("Schema", schemaN);
     fex.Fire(MainGate);
 }