当前位置: 首页>>代码示例>>C#>>正文


C# InequationEngine.Execute方法代码示例

本文整理汇总了C#中ONS.Compiler.Business.InequationEngine.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# InequationEngine.Execute方法的具体用法?C# InequationEngine.Execute怎么用?C# InequationEngine.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ONS.Compiler.Business.InequationEngine的用法示例。


在下文中一共展示了InequationEngine.Execute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecutarExpressaoSimples

        public void ExecutarExpressaoSimples()
        {
            int a=1, b=2;
            string expressao = "(a+b)>0";
            string blocoAcaoTrue = "a=0;b=-1";
            string blocoAcaoFalse = "a=-1;b=0";

            InequationEngine maquinaInequacoes = new InequationEngine();
            maquinaInequacoes.CalculationMemory.Add(new Variable("a", VariableDataType.Numeric, a));
            maquinaInequacoes.CalculationMemory.Add(new Variable("b", VariableDataType.Numeric, b));

            Inequation inequacao = new Inequation(expressao);
            ActionBlock blocoAcaoTrueObj = new ActionBlock(blocoAcaoTrue);
            ActionBlock blocoAcaoFalseObj = new ActionBlock(blocoAcaoFalse);

            Decision decisao = new Decision(inequacao, blocoAcaoTrueObj, blocoAcaoFalseObj);
            maquinaInequacoes.DecisionsList.AddDecision(decisao);

            maquinaInequacoes.Compile();

            maquinaInequacoes.Execute();

            Assert.AreEqual(maquinaInequacoes.CalculationMemory["a"].GetValue(), 0.0);
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["b"].GetValue(), -1.0);
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:25,代码来源:MaquinaInequacoesUnitTests.cs

示例2: ExecutarComDados

        public void ExecutarComDados()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();

            mediador.CarregarDados_SheetRow_N_NE_SE();

            for (int i = 0; i < mediador.linhas_N_NE_SE.Count; i++)
            {
                AtualizarVariaveisDaMemoriaDeCalculo(maquinaInequacoes, mediador.linhas_N_NE_SE[i]);
                maquinaInequacoes.Execute();

                Variable maq = maquinaInequacoes.CalculationMemory["maqs"];

                Assert.AreEqual(maq.GetValue(), mediador.linhas_N_NE_SE[i].LDvalorplanilha_Xingo_MinMaqs);
            }
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:22,代码来源:Modulo_N_NE_SE_semECE_RNE_2009_min_Xingo.cs

示例3: Executar

        public void Executar()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();
            //TODO: medir tempo compilação vc execução
            maquinaInequacoes.Execute();

            Variable maq = maquinaInequacoes.CalculationMemory["maqs"];

            Assert.AreEqual(maq.GetValue(), 0.0);
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:16,代码来源:Modulo_N_NE_SE_semECE_RNE_2009_min_Xingo.cs

示例4: ExecutarComDados

        public void ExecutarComDados()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();

            mediador.CarregarDados_SheetRow_ACRO_MT();

            for (int i = 0; i < mediador.linhas_ACRO_MT.Count; i++)
            {
                AtualizarVariaveisDaMemoriaDeCalculo(maquinaInequacoes, mediador.linhas_ACRO_MT[i]);
                maquinaInequacoes.Execute();

                Variable limite = maquinaInequacoes.CalculationMemory["lim"];

                Assert.AreEqual(Math.Round((double)limite.GetValue(),0), Math.Round((double)mediador.linhas_ACRO_MT[i].LDvalorplanilha_Lim_FACROInf,0));
            }
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:22,代码来源:Modulo_RACRO_Limite_Inf_FACRO.cs

示例5: ExecutarComDados

        public void ExecutarComDados()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();

            mediador.CarregarDados_SheetRow_S_SE();

            for (int i = 0; i < mediador.linhas_S_SE.Count; i++)
            {
                AtualizarVariaveisDaMemoriaDeCalculo(maquinaInequacoes, mediador.linhas_S_SE[i], "Terça-Feira", "ÚTIL", "NORMAL");
                maquinaInequacoes.Execute();

                Variable PeriodoCarga_SE_CO = maquinaInequacoes.CalculationMemory["PeriodoCarga_SE_CO"];

                Assert.AreEqual(PeriodoCarga_SE_CO.GetValue(), mediador.linhas_S_SE[i].LDretorno_PERIODO_DE_CARGA);
            }
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:22,代码来源:Modulo_PERIODO_SE_CO_RNE_2009_PeriodoCarga_SE_CO.cs

示例6: Executar

        public void Executar()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();

            Variable PeriodoCarga_SE_CO = maquinaInequacoes.CalculationMemory["PeriodoCarga_SE_CO"];

            Assert.AreEqual(PeriodoCarga_SE_CO.GetValue(), "LEVE");
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:15,代码来源:Modulo_PERIODO_SE_CO_RNE_2009_PeriodoCarga_SE_CO.cs

示例7: ExecutarOperacaoComparacaoHora

        public void ExecutarOperacaoComparacaoHora()
        {
            string pattern = "HH:mm:ss";
            string horaA = "20:27:31";
            string horaB = "20:09:50";
            DateTime a = DateTime.Now;
            DateTime b = DateTime.Now;
            double result = double.MinValue;
            DateTime horaConvertidaFlee = DateTime.Now;

            // Testa a maior que b
            string expressao = "(a>b)";
            string blocoAcaoTrue = "result=100;";
            string blocoAcaoFalse = "result=0;";

            if (!DateTime.TryParseExact(horaA, pattern, null, System.Globalization.DateTimeStyles.None, out a) || !DateTime.TryParseExact(horaB, pattern, null, System.Globalization.DateTimeStyles.None, out b))
            {
                throw new Exception("Erro no parsing das variáveis de hora.");
            }

            InequationEngine maquinaInequacoes = new InequationEngine();
            maquinaInequacoes.CalculationMemory.Add(new Variable("a", VariableDataType.Time, a));
            maquinaInequacoes.CalculationMemory.Add(new Variable("b", VariableDataType.Time, b));
            maquinaInequacoes.CalculationMemory.Add(new Variable("result", VariableDataType.Numeric, result));
            maquinaInequacoes.CalculationMemory.Add(new Variable("horaA", VariableDataType.String, horaA));

            Inequation inequacao = new Inequation(expressao);
            ActionBlock blocoAcaoTrueObj = new ActionBlock(blocoAcaoTrue);
            ActionBlock blocoAcaoFalseObj = new ActionBlock(blocoAcaoFalse);

            Decision decisao = new Decision(inequacao, blocoAcaoTrueObj, blocoAcaoFalseObj);
            maquinaInequacoes.DecisionsList.AddDecision(decisao);

            maquinaInequacoes.Compile();

            maquinaInequacoes.Execute();

            Assert.AreEqual(maquinaInequacoes.CalculationMemory["a"].GetValue(), a);
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["b"].GetValue(), b);
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 100.0);

            expressao = "(a >= b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 100.0);

            expressao = "(a<b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 0.0);

            expressao = "(a <= b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 0.0);

            expressao = "(a = b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 0.0);

            horaA = "15:17:31";
            horaB = "15:27:31";
            if (!DateTime.TryParseExact(horaA, pattern, null, System.Globalization.DateTimeStyles.None, out a) || !DateTime.TryParseExact(horaB, pattern, null, System.Globalization.DateTimeStyles.None, out b))
            {
                throw new Exception("Erro no parsing das variáveis de hora.");
            }
            maquinaInequacoes.CalculationMemory.UpdateVariable("a", a);
            maquinaInequacoes.CalculationMemory.UpdateVariable("b", b);

            expressao = "(a > b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 0.0);

            expressao = "(a < b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 100.0);

            expressao = "(a >= b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 0.0);

            expressao = "(a <= b)";
            decisao.Inequation.Expression = expressao;
            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();
            Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 100.0);

            expressao = "(a = b)";
            decisao.Inequation.Expression = expressao;
//.........这里部分代码省略.........
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:101,代码来源:MaquinaInequacoesUnitTests.cs

示例8: ExecutarComDados

        public void ExecutarComDados()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();

            mediador.CarregarDados_SheetRow_SEVERA_N3();
            mediador.CarregarDados_SheetRow_S_SE();

            for (int i = 0; i < mediador.linhas_S_SE.Count; i++)
            {
                AtualizarVariaveisDaMemoriaDeCalculo(maquinaInequacoes, mediador.linhas_S_SE[i]);
                maquinaInequacoes.Execute();

                Variable limite = maquinaInequacoes.CalculationMemory["lim"];

                Assert.AreEqual(limite.GetValue(), mediador.linhas_SEVERA_N3[i].LDvalorplanilha_LIMIT_RSUL);
            }
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:23,代码来源:Modulo_Limites_MOPs_Limite_RSUL_n3.cs

示例9: CarregarDados_SheetRow_S_SE

        public void CarregarDados_SheetRow_S_SE()
        {
            linhas_S_SE.Clear();

            //Abre CSV como texto
            string fileName = GetCaminhoCompletoArquivoTeste_ValidacaoLimites_Aba_S_SE();
            System.IO.StreamReader sr = new System.IO.StreamReader(File.OpenRead(fileName));

            int iLinhaIdx = 0;

            while (sr.Peek() != -1)
            {
                string line = sr.ReadLine();

                // separa linha do CSV
                string[] valores = line.Split(',');
                double primeiraColunaComValor = 0.0;

                if (valores.Length > 3 && double.TryParse(valores[3], out primeiraColunaComValor))
                {

                    SheetRow_S_SE sheetRow_S_SE = new SheetRow_S_SE();
                    sheetRow_S_SE.PK_HoraInicFim = new KeyValuePair<string, string>(valores[1].Trim(), valores[2].Trim());
                    sheetRow_S_SE.MC_FSE_Programado = double.Parse(valores[3]);
                    sheetRow_S_SE.MC_RSE_Eletrico = double.Parse(valores[4]);
                    sheetRow_S_SE.MC_RSUL = double.Parse(valores[5]);
                    sheetRow_S_SE.MC_FBAIN = double.Parse(valores[6]);
                    sheetRow_S_SE.MC_FINBA = double.Parse(valores[7]);
                    sheetRow_S_SE.MC_POT_ELO_CC = double.Parse(valores[8]);
                    sheetRow_S_SE.MC_FIV = double.Parse(valores[9]);
                    sheetRow_S_SE.MC_GIPU_60Hz = double.Parse(valores[10]);
                    sheetRow_S_SE.MC_Mq_60Hz = double.Parse(valores[11]);
                    sheetRow_S_SE.MC_CARGA_SIN = double.Parse(valores[12]);
                    sheetRow_S_SE.MC_CARGA_SUL = double.Parse(valores[13]);
                    sheetRow_S_SE.MC_LIM_ELO_CC = valores[23].Trim().ToLower();
                    sheetRow_S_SE.MC_Gera_Usinas = double.Parse(valores[25]);

                    sheetRow_S_SE.LDvalorplanilha_LIM_FBAIN = double.Parse(valores[14]);
                    sheetRow_S_SE.LDvalorplanilha_LIM_FINBA = double.Parse(valores[15]);
                    sheetRow_S_SE.LDvalorplanilha_LIM_FSE = double.Parse(valores[16]);
                    sheetRow_S_SE.LDvalorplanilha_LIM_RSE = double.Parse(valores[17]);
                    sheetRow_S_SE.LDvalorplanilha_LIM_RSUL_FSUL_SUP_RSUL = double.Parse(valores[18]);
                    sheetRow_S_SE.LDvalorplanilha_LIM_RSUL_FSUL_INF_FSUL = double.Parse(valores[19]);
                    sheetRow_S_SE.LDvalorplanilha_Mqs_crt_IPU_max = double.Parse(valores[20]);
                    sheetRow_S_SE.LDvalorplanilha_Limite_GIPU_SUP = double.Parse(valores[21]);
                    sheetRow_S_SE.LDvalorplanilha_Limite_GIPU_INF = double.Parse(valores[22]);
                    sheetRow_S_SE.LDvalorplanilha_PERIODO_DE_CARGA = valores[24].Trim();
                    sheetRow_S_SE.LDvalorplanilha_Valor_referencia_FRS_Usinas = double.Parse(valores[26]);

                    linhas_S_SE.Add(iLinhaIdx, sheetRow_S_SE);
                    iLinhaIdx++;
                }

            }

            // Atualiza retorno do periodo de carga (LDretorno_PERIODO_DE_CARGA)
            // TODO: passar parametro bool se for para executar (cuidado com complexidade ciclomática)

            InequationEngine maquinaInequacoes = new InequationEngine();
            CarregarMemoriaDeCalculo(maquinaInequacoes, "Modulo_PERIODO_SE_CO_RNE_2009-PeriodoCarga_SE_CO");
            CarregarListaDecisoes(maquinaInequacoes, "Modulo_PERIODO_SE_CO_RNE_2009-PeriodoCarga_SE_CO");
            maquinaInequacoes.Compile();

            foreach (int key in linhas_S_SE.Keys)
            {
                maquinaInequacoes.CalculationMemory.UpdateVariable("xhora", CustomFunctions.Hora(linhas_S_SE[key].PK_HoraInicFim.Key + ":00"));
                maquinaInequacoes.Execute();
                linhas_S_SE[key].LDretorno_PERIODO_DE_CARGA = maquinaInequacoes.CalculationMemory["PeriodoCarga_SE_CO"].GetValue().ToString();
            }
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:70,代码来源:Mediador.cs

示例10: ExecutarComDados

        public void ExecutarComDados()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();

            mediador.CarregarDados_SheetRow_SEVERA_N3();
            mediador.CarregarDados_SheetRow_S_SE();
            mediador.CarregarDados_SheetRow_N_NE_SE();

            for (int i = 0; i < mediador.linhas_S_SE.Count; i++)
            {
                AtualizarVariaveisDaMemoriaDeCalculo(maquinaInequacoes, mediador.linhas_SEVERA_N3[i], mediador.linhas_S_SE[i], mediador.linhas_N_NE_SE[i]);
                maquinaInequacoes.Execute();

                Variable limite = maquinaInequacoes.CalculationMemory["lim"];
                Variable limiteTexto = maquinaInequacoes.CalculationMemory["limTexto"];

                if (limiteTexto.GetValue().ToString().Trim() != string.Empty)
                    Assert.AreEqual(limiteTexto.GetValue(), "!Maq.C.Brava!");
                else
                    Assert.AreEqual(limite.GetValue(), mediador.linhas_SEVERA_N3[i].LDvalorplanilha_LIMIT_FNS);

            }
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:29,代码来源:Modulo_Limites_MOPs_LIM_FNS_n3.cs

示例11: Executar

        public void Executar()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();
            //TODO: medir tempo compilação vc execução
            maquinaInequacoes.Execute();

            Variable limite = maquinaInequacoes.CalculationMemory["lim"];
            Variable limiteTexto = maquinaInequacoes.CalculationMemory["limTexto"];

            /*
            double result = double.MinValue;
            double.TryParse(limiteTexto.GetValue().ToString().Trim(), out result);
            Assert.AreEqual(limite.GetValue(), 0.0);
            */
            if (limiteTexto.GetValue().ToString().Trim() != string.Empty)
                Assert.AreEqual(limiteTexto.GetValue(), "!Maq.C.Brava!");
            else
                Assert.AreEqual(limite.GetValue(), 0.0);
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:25,代码来源:Modulo_Limites_MOPs_LIM_FNS_n3.cs

示例12: Executar

        public void Executar()
        {
            Mediador mediador = new Mediador();

            InequationEngine maquinaInequacoes = new InequationEngine();
            mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao);
            mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao);

            maquinaInequacoes.Compile();
            maquinaInequacoes.Execute();

            Variable limite = maquinaInequacoes.CalculationMemory["lim"];

            Assert.AreEqual(limite.GetValue(), 3000.0);
        }
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:15,代码来源:Modulo_Interligacao_SSE_refFRS_Ger.cs


注:本文中的ONS.Compiler.Business.InequationEngine.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。