コード例 #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 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);
 }
コード例 #3
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);
 }
コード例 #4
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());
        }
コード例 #5
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);
 }
コード例 #6
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());
 }
コード例 #7
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);
 }
コード例 #8
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();
        }
コード例 #9
0
 public void ReqDeleteRow(TableRow tr)
 {
     var fex = new FlexHelper("DBFlex.Request");
     fex.AddArg(ArgEventName, "SQL.Corrections");
     fex.AddArg(ArgCommandName, "DeleteSchemeRow");
     fex.AddArg("Schema", CurrentSchema);
     fex.AddArg("Item", tr.Item);
     fex.Fire(MainGate);
 }
コード例 #10
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;
        }
コード例 #11
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;
            }
        }
コード例 #12
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");
 }
コード例 #13
0
 public static void ReqRemoovePattern(Client CoreGate, string PatternName)
 {
     var fex = new FlexHelper("UI.RemoovePattern");
     fex.AddArg("Name", PatternName);
     fex.Fire(CoreGate);
 }
コード例 #14
0
        public void OnEvent(BaseEvent evt)
        {
            using (var l = new Logger("Listener")) {
                #region сбор данных для автоматического режима не FlexEvent

                if (evt is HeatChangeEvent) {
                    var hce = evt as HeatChangeEvent;
                    if (CHeatNumber != hce.HeatNumber) {
                        CHeatNumber = hce.HeatNumber;
                        Program.Reset();
                        l.msg("Heat Changed. New Heat ID: {0}\n", CHeatNumber);
                        Program.Saver.HeatNumber = CHeatNumber;
                    }
                    else
                        l.msg("Heat No Changed. Heat ID: {0}\n", hce.HeatNumber);
                }

                if (evt is ScrapEvent) {
                    var scrapEvent = evt as ScrapEvent;
                    if (scrapEvent.ConverterNumber == Program.ConverterNumber) {
                        Program.AutoInData.MSc = scrapEvent.TotalWeight;
                        l.msg("Scrap mass: {0}", Program.AutoInData.MSc);
                        Program.IsRefrashData = true;
                    }
                }

                #endregion

                if (evt is FlexEvent) {
                    #region интерфейс для визухи

                    var fxe = evt as FlexEvent;
                    if (fxe.Operation.StartsWith("UI.GetNamePatterns")) {
                        l.msg(fxe.ToString());
                        Program.TablePaths = Program.ScanStore(Program.StorePath);
                        var names = Program.GetNamesFromAddress(Program.TablePaths);
                        var fex = new FlexHelper("Charge5.PatternNames");
                        for (int i = 0; i < names.Count; i++)
                            fex.AddArg(i.ToString(), names[i]);
                        fex.Fire(Program.MainGate);
                    }

                    if (fxe.Operation.StartsWith("UI.LoadPattern")) {
                        l.msg(fxe.ToString());
                        try {
                            Program.Tables = Program.LoadTables((string) fxe.Arguments["Name"], ref Program.InitTbl);
                        }
                        catch (Exception e) {
                            l.err("UI.LoadPattern: \n{0}", e.ToString());
                        }

                        var fex = new FlexHelper("Charge5.RespLoadPattern");
                        if (Program.Tables == null) {
                            l.err("pattern not loaded");
                            fex.AddArg("Loaded", false);
                        }
                        else
                            fex.AddArg("Loaded", true);
                        fex.Fire(Program.MainGate);
                    }

                    if (fxe.Operation.StartsWith("UI.Calc")) {
                        var inData = new InData();
                        var outData = new OutData();

                        l.msg(fxe.ToString());
                        try {
                            inData.SteelType = (int) fxe.Arguments["SteelType"]; //

                            inData.MHi = (int) fxe.Arguments["MHi"];
                            inData.MSc = (int) fxe.Arguments["MSc"];
                            inData.SiHi = (double) fxe.Arguments["SiHi"];
                            inData.THi = (int) fxe.Arguments["THi"];

                            inData.IsProcessingUVS = (bool) fxe.Arguments["IsProcessingUVS"]; //
                            var table = Program.Tables[inData.SteelType];
                            Program.Alg(table, inData, out outData);
                            Program.SendResultCalc(outData);
                        }
                        catch (Exception e) {
                            l.err("UI.Calc: \n{0}", e.ToString());
                        }
                    }

                    if (fxe.Operation.StartsWith("UI.GetPattern")) {
                        l.msg(fxe.ToString());
                        try {
                            var name = (string) fxe.Arguments["Name"];
                            Program.LoadTables(name, ref Program.InitTbl);
                            CSVTP_FlexEventConverter.AppName = "Charge5";
                            var flex = CSVTP_FlexEventConverter.PackToFlex(name, Program.InitTbl, Program.Tables);
                            var fex = new FlexHelper(flex.Operation);
                            fex.evt.Arguments = flex.Arguments;
                            fex.Fire(Program.MainGate);
                        }
                        catch (Exception e) {
                            l.err("UI.GetPattern: \n{0}", e.ToString());
                        }
                    }

                    if (fxe.Operation.StartsWith("UI.Tables")) {
                        var fex = new FlexHelper("Charge5.SavePatternResp");
                        l.msg(fxe.ToString());
                        try {
                            var patternName = "";
                            Charge5Classes.CSVTP_FlexEventConverter.UnpackFromFlex(
                                fxe,
                                ref Program.InitTbl,
                                ref Program.Tables,
                                ref patternName
                                );
                            Program.SaveTables(patternName, Program.InitTbl, Program.Tables);
                            fex.AddArg("Saved", true);
                        }
                        catch (Exception e) {
                            l.err("UI.GetPattern: \n{0}", e.ToString());
                            fex.AddArg("Saved", false);
                        }
                        fex.Fire(Program.MainGate);
                    }

                    if (fxe.Operation.StartsWith("UI.RemoovePattern")) {
                        var fex = new FlexHelper("Charge5.RemoovePatternResp");
                        l.msg(fxe.ToString());
                        try {
                            Program.RemooveTables((string) fxe.Arguments["Name"]);
                            fex.AddArg("Remooved", true);
                        }
                        catch (Exception e) {
                            l.err("UI.RemoovePattern: \n{0}", e.ToString());
                            fex.AddArg("Remooved", false);
                        }
                        fex.Fire(Program.MainGate);
                    }

                    #endregion

                    #region интерфейс для визухи в автоматическом режиме

                    if (fxe.Operation.StartsWith("UI.ModeCalc")) {
                        l.msg(fxe.ToString());
                        try {
                            Program.CalcModeIsAutomatic = (bool) fxe.Arguments["IsAutomatic"];
                            Program.IsRefrashData = true;
                        }
                        catch (Exception e) {
                            l.err("UI.CalcMode: \n{0}", e.ToString());
                        }
                    }

                    if (fxe.Operation.StartsWith("UI.DataCalc")) {
                        l.msg(fxe.ToString());
                        try {
                            var steelType = (int) fxe.Arguments["SteelType"];
                            if ((steelType >= 0) && (steelType <= 6)) // имеем только 7 типов стали
                            {
                                Program.AutoInData.SteelType = steelType;
                                Program.IsRefrashData = true;
                            }
                            else
                                throw new Exception("Не верное значение типа стали, >7 или <0");
                            Program.AutoInData.IsProcessingUVS = (bool) fxe.Arguments["IsProcessingUVS"];
                        }
                        catch (Exception e) {
                            l.err("UI.CalcData: \n{0}", e.ToString());
                        }
                    }

                    #endregion

                    #region сбор данных для автоматического режима FlexEvent

                    if (fxe.Operation.StartsWith("PipeCatcher.Call.PCK_DATA.PGET_WGHIRON1")) {
                        if ((string) fxe.Arguments["SHEATNO"] == Convert.ToString(HeatNumberToLong(CHeatNumber))) {
                            l.msg("Iron Correction from Pipe: {0}\n", fxe.Arguments["NWGH_NETTO"]);
                            Program.AutoInData.MHi =
                                (int) Math.Round(Convert.ToDouble(fxe.Arguments["NWGH_NETTO"])*1000);
                            Program.IsRefrashData = true;
                        }
                        else {
                            l.msg(
                                "Iron Correction from Pipe: wrong heat number - expected {0} found {1}",
                                CHeatNumber, fxe.Arguments["SHEATNO"]
                                );
                        }
                    }

                    if (fxe.Operation.StartsWith("PipeCatcher.Call.PCK_DATA.PGET_XIMIRON")) {
                        if ((string) fxe.Arguments["HEAT_NO"] == Convert.ToString(HeatNumberToLong(CHeatNumber))) {
                            l.msg("Xim Iron from Pipe: T = {0}, Si = {1}\n", fxe.Arguments["HM_TEMP"],
                                  fxe.Arguments["ANA_SI"]);
                            Program.AutoInData.SiHi = Convert.ToDouble(fxe.Arguments["ANA_SI"]);
                            Program.AutoInData.THi = Convert.ToInt32(fxe.Arguments["HM_TEMP"]);
                            Program.IsRefrashData = true;
                        }
                        else {
                            l.msg(
                                "Xim Iron from Pipe: wrong heat number - expected {0} found {1}",
                                CHeatNumber, fxe.Arguments["HEAT_NO"]
                                );
                        }
                    }

                    #endregion
                }
            }
        }
コード例 #15
0
 public void ReqInsertRow(TableRow tr)
 {
     var fex = new FlexHelper("DBFlex.Request");
     fex.AddArg(ArgEventName, "SQL.Corrections");
     fex.AddArg(ArgCommandName, "InsertSchemeRow");
     fex.AddArg("Schema", CurrentSchema);
     fex.AddArg("Item", tr.Item);
     fex.AddArg("Cmin", tr.CMin);
     fex.AddArg("Cmax", tr.CMax);
     fex.AddArg("Oxygen", tr.Oxygen);
     fex.AddArg("Heating", tr.Heating);
     fex.Fire(MainGate);
 }
コード例 #16
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;
     }
 }
コード例 #17
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);
        }
コード例 #18
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;
                }
            }
        }
コード例 #19
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;
 }
コード例 #20
0
 public static void FireFixCRecalc(double carbon)
 {
     var fex = new FlexHelper("CorrectionCT.DataFix");
     fex.AddArg("C", carbon);
     fex.Fire(Program.MainGate);
 }
コード例 #21
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);
 }
コード例 #22
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);
 }
コード例 #23
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);
        }
コード例 #24
0
 public void ReqScheme(int schemaN)
 {
     var fex = new FlexHelper("DBFlex.Request");
     fex.AddArg(ArgEventName, "SQL.Corrections");
     fex.AddArg(ArgCommandName, "GetScheme");
     fex.AddArg("Schema", schemaN);
     fex.Fire(MainGate);
     //LogWrite(fex.evt);
 }