/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_ACRO_MT sheetRow_ACRO_MT) { maquinaInequacoes.CalculationMemory.UpdateVariable("xPOLO1", sheetRow_ACRO_MT.MC_POLO1); maquinaInequacoes.CalculationMemory.UpdateVariable("xMaqSA", sheetRow_ACRO_MT.MC_UHESantoAntonioNumUGs); maquinaInequacoes.CalculationMemory.UpdateVariable("xTR_prov", sheetRow_ACRO_MT.MC_FTRpr); maquinaInequacoes.CalculationMemory.UpdateVariable("Facro", sheetRow_ACRO_MT.MC_FACRO); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xRNE", sheetRow_N_NE_SE.MC_RNE); maquinaInequacoes.CalculationMemory.UpdateVariable("x_cargaNE", sheetRow_N_NE_SE.MC_CargaNE); maquinaInequacoes.CalculationMemory.UpdateVariable("xugxingo", sheetRow_N_NE_SE.MC_Xingo_NumUgs); maquinaInequacoes.CalculationMemory.UpdateVariable("xlimugx", sheetRow_N_NE_SE.LDvalorplanilha_Xingo_MinMaqs); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xpercarga", sheetRow_N_NE_SE.LDvalorplanilha_PerCargaNNE); maquinaInequacoes.CalculationMemory.UpdateVariable("xRNE", sheetRow_N_NE_SE.MC_RNE); maquinaInequacoes.CalculationMemory.UpdateVariable("xEXPN", sheetRow_N_NE_SE.MC_EXP_N); maquinaInequacoes.CalculationMemory.UpdateVariable("xEXPSE", sheetRow_N_NE_SE.MC_EXP_SE); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_ACRO_MT sheetRow_ACRO_MT) { maquinaInequacoes.CalculationMemory.UpdateVariable("xPolo", sheetRow_ACRO_MT.MC_POLO1); maquinaInequacoes.CalculationMemory.UpdateVariable("BtB", sheetRow_ACRO_MT.MC_FBtB); maquinaInequacoes.CalculationMemory.UpdateVariable("xMaqSA", sheetRow_ACRO_MT.MC_UHESantoAntonioNumUGs); maquinaInequacoes.CalculationMemory.UpdateVariable("xMaqJir", sheetRow_ACRO_MT.MC_UHJirauNumUgs); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="xDiaSemana"></param> /// <param name="xTipo"></param> /// <param name="Hverao"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_S_SE sheetRow_S_SE, string xDiaSemana, string xTipo, string Hverao) { maquinaInequacoes.CalculationMemory.UpdateVariable("xhora", CustomFunctions.Hora(sheetRow_S_SE.PK_HoraInicFim.Key + ":00")); //maquinaInequacoes.CalculationMemory.UpdateVariable("xDiaSemana", xDiaSemana); // maquinaInequacoes.CalculationMemory.UpdateVariable("xTipo", xTipo); //maquinaInequacoes.CalculationMemory.UpdateVariable("Hverao", Hverao); }
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); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_ACRO_MT sheetRow_ACRO_MT) { maquinaInequacoes.CalculationMemory.UpdateVariable("xPolo", sheetRow_ACRO_MT.MC_POLO1); maquinaInequacoes.CalculationMemory.UpdateVariable("xTR_prov", sheetRow_ACRO_MT.MC_FTRpr); maquinaInequacoes.CalculationMemory.UpdateVariable("xBtB", sheetRow_ACRO_MT.MC_FBtB); maquinaInequacoes.CalculationMemory.UpdateVariable("xGerSA", sheetRow_ACRO_MT.MC_UHESantoAntonioGerTotal); maquinaInequacoes.CalculationMemory.UpdateVariable("xGerJir", sheetRow_ACRO_MT.MC_UHJirauGer); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_SEVERA_N3 sheetRow_SEVERA_N3, SheetRow_S_SE sheetRow_S_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xpercarga", sheetRow_S_SE.LDvalorplanilha_PERIODO_DE_CARGA); maquinaInequacoes.CalculationMemory.UpdateVariable("xcargaSIN", sheetRow_S_SE.MC_CARGA_SIN); maquinaInequacoes.CalculationMemory.UpdateVariable("xelocc", sheetRow_S_SE.MC_POT_ELO_CC); maquinaInequacoes.CalculationMemory.UpdateVariable("xhbo", sheetRow_SEVERA_N3.MC_HBO); maquinaInequacoes.CalculationMemory.UpdateVariable("xlimite_rse", sheetRow_S_SE.LDvalorplanilha_LIM_RSE); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_SEVERA_N3 sheetRow_SEVERA_N3, SheetRow_S_SE sheetRow_S_SE, SheetRow_N_NE_SE sheetRow_N_NE_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xcargaSIN", sheetRow_S_SE.MC_CARGA_SIN); maquinaInequacoes.CalculationMemory.UpdateVariable("xcbrava", sheetRow_SEVERA_N3.MC_MqsCanaBrava); maquinaInequacoes.CalculationMemory.UpdateVariable("xhbo", sheetRow_SEVERA_N3.MC_HBO); maquinaInequacoes.CalculationMemory.UpdateVariable("xmq_sm", sheetRow_N_NE_SE.MC_SMGerando + sheetRow_N_NE_SE.MC_Maqs_SMCOp); maquinaInequacoes.CalculationMemory.UpdateVariable("xpercarga", sheetRow_S_SE.LDvalorplanilha_PERIODO_DE_CARGA); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_S_SE sheetRow_S_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xelo", sheetRow_S_SE.MC_POT_ELO_CC); //maquinaInequacoes.CalculationMemory.UpdateVariable("xangra", sheetRow_SUL.MC_UGs_Gerando_Araucaria); maquinaInequacoes.CalculationMemory.UpdateVariable("xMaq", sheetRow_S_SE.MC_Mq_60Hz); maquinaInequacoes.CalculationMemory.UpdateVariable("xGerIPU", sheetRow_S_SE.MC_GIPU_60Hz); maquinaInequacoes.CalculationMemory.UpdateVariable("xrsul", sheetRow_S_SE.MC_RSUL); maquinaInequacoes.CalculationMemory.UpdateVariable("xpercarga", sheetRow_S_SE.LDretorno_PERIODO_DE_CARGA); }
public void CarregarMemoriaDeCalculo() { Mediador mediador = new Mediador(); InequationEngine maquinaInequacoes = new InequationEngine(); mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao); Assert.AreEqual(true, true); }
/// <summary> /// Método para popular a decisão com {inequação, bloco V}. Bloco F = vazio. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="decisaoLinha"></param> public void AtualizarListaDeDecisoes(InequationEngine maquinaInequacoes, KeyValuePair<string, string> decisaoLinha) { Inequation inequacao = new Inequation(decisaoLinha.Key); ActionBlock blocoAcaoTrueObj = new ActionBlock(decisaoLinha.Value); ActionBlock blocoAcaoFalseObj = new ActionBlock(string.Empty); Decision decisao = new Decision(inequacao, blocoAcaoTrueObj, blocoAcaoFalseObj); maquinaInequacoes.DecisionsList.AddDecision(decisao); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_S_SE sheetRow_S_SE, SheetRow_SUL sheetRow_SUL) { maquinaInequacoes.CalculationMemory.UpdateVariable("xrsul", sheetRow_S_SE.MC_RSUL); maquinaInequacoes.CalculationMemory.UpdateVariable("xcargasul", sheetRow_S_SE.MC_CARGA_SUL); maquinaInequacoes.CalculationMemory.UpdateVariable("xugarauc", sheetRow_SUL.MC_UGs_Gerando_Araucaria); maquinaInequacoes.CalculationMemory.UpdateVariable("x_refFRS_Ger", sheetRow_SUL.LD_ValorReferenciaFRS_Usinas); maquinaInequacoes.CalculationMemory.UpdateVariable("xFRS_GerUSs", sheetRow_SUL.MC_FRS - sheetRow_S_SE.MC_Gera_Usinas); maquinaInequacoes.CalculationMemory.UpdateVariable("xJLP", sheetRow_SUL.MC_J_Lacerda_P); maquinaInequacoes.CalculationMemory.UpdateVariable("xJLM", sheetRow_SUL.MC_J_Lacerda_M); maquinaInequacoes.CalculationMemory.UpdateVariable("xJLG", sheetRow_SUL.MC_J_Lacerda_G); maquinaInequacoes.CalculationMemory.UpdateVariable("xJLGG", sheetRow_SUL.MC_J_Lacerda_GG); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_ACRO_MT sheetRow_ACRO_MT) { maquinaInequacoes.CalculationMemory.UpdateVariable("xFACRO", sheetRow_ACRO_MT.MC_FBtB); maquinaInequacoes.CalculationMemory.UpdateVariable("xMaqSA", sheetRow_ACRO_MT.MC_UHESantoAntonioNumUGs); maquinaInequacoes.CalculationMemory.UpdateVariable("xMaqJir", sheetRow_ACRO_MT.MC_UHJirauNumUgs); maquinaInequacoes.CalculationMemory.UpdateVariable("xilha1", sheetRow_ACRO_MT.MC_UHESantoAntonioGeracaoIlha1); maquinaInequacoes.CalculationMemory.UpdateVariable("xilha2", sheetRow_ACRO_MT.MC_UHESantoAntonioGeracaoIlha2); maquinaInequacoes.CalculationMemory.UpdateVariable("xmesq", sheetRow_ACRO_MT.MC_UHESantoAntonioGeracaoMEsqrd); maquinaInequacoes.CalculationMemory.UpdateVariable("xJirau", sheetRow_ACRO_MT.MC_UHJirauGer); maquinaInequacoes.CalculationMemory.UpdateVariable("xTR_prov", sheetRow_ACRO_MT.MC_FTRpr); maquinaInequacoes.CalculationMemory.UpdateVariable("xPOLO1", sheetRow_ACRO_MT.MC_POLO1); maquinaInequacoes.CalculationMemory.UpdateVariable("xBtB", sheetRow_ACRO_MT.MC_FBtB); }
public void CarregarVariavelDuplicada() { InequationEngine maquinaInequacoes = new InequationEngine(); maquinaInequacoes.CalculationMemory.Add(new Variable("a", VariableDataType.String)); try { maquinaInequacoes.CalculationMemory.Add(new Variable("a", VariableDataType.String)); } catch (InequationEngineException iInEngEx) { Assert.AreEqual(iInEngEx.ExceptionType.ToString(), ExceptionType.ExistingVariableInCalcMemory.ToString()); return; } Assert.Fail(); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE, SheetRow_S_SE sheetRow_S_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xMqSM", sheetRow_N_NE_SE.MC_SMGerando); maquinaInequacoes.CalculationMemory.UpdateVariable("xSM_cs", sheetRow_N_NE_SE.MC_Maqs_SMCOp); maquinaInequacoes.CalculationMemory.UpdateVariable("xMqIPU", sheetRow_S_SE.LDvalorplanilha_Mqs_crt_IPU_max); maquinaInequacoes.CalculationMemory.UpdateVariable("xMqLJ", sheetRow_N_NE_SE.MC_Maqs_Laj); maquinaInequacoes.CalculationMemory.UpdateVariable("xMqPX", sheetRow_N_NE_SE.MC_Maqs_Px); maquinaInequacoes.CalculationMemory.UpdateVariable("xcarga_SIN", sheetRow_N_NE_SE.MC_CARGASIN); maquinaInequacoes.CalculationMemory.UpdateVariable("xECE_IPU_TUC", sheetRow_N_NE_SE.LDvalorplanilha_ECETUCIPU); maquinaInequacoes.CalculationMemory.UpdateVariable("xpercarga", sheetRow_N_NE_SE.LDvalorplanilha_PerCargaNNE); maquinaInequacoes.CalculationMemory.UpdateVariable("xEXPN", sheetRow_N_NE_SE.MC_EXP_N); maquinaInequacoes.CalculationMemory.UpdateVariable("xFNS", sheetRow_N_NE_SE.MC_FNS); maquinaInequacoes.CalculationMemory.UpdateVariable("xMW_ug_ipu", sheetRow_S_SE.MC_GIPU_60Hz / sheetRow_S_SE.MC_Mq_60Hz); maquinaInequacoes.CalculationMemory.UpdateVariable("xFSENE", sheetRow_N_NE_SE.MC_FSENE); }
public void AtualizarVariaveisDaMemoriaDeCalculo() { Mediador mediador = new Mediador(); InequationEngine maquinaInequacoes = new InequationEngine(); mediador.CarregarMemoriaDeCalculo(maquinaInequacoes, nomeFuncao); mediador.CarregarListaDecisoes(maquinaInequacoes, nomeFuncao); 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]); } Assert.AreEqual(true, true); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xSM_CSin", sheetRow_N_NE_SE.MC_Maqs_SMCOp); maquinaInequacoes.CalculationMemory.UpdateVariable("xcarga_SIN", sheetRow_N_NE_SE.MC_CARGASIN); maquinaInequacoes.CalculationMemory.UpdateVariable("xMqSM", sheetRow_N_NE_SE.MC_SMGerando); }
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)); } }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_ACRO_MT sheetRow_ACRO_MT) { maquinaInequacoes.CalculationMemory.UpdateVariable("xBtB", sheetRow_ACRO_MT.MC_GeracaoItqPPdr); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_S_SE sheetRow_S_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xFIV", sheetRow_S_SE.MC_FIV); maquinaInequacoes.CalculationMemory.UpdateVariable("xFSE", sheetRow_S_SE.MC_FSE_Programado); maquinaInequacoes.CalculationMemory.UpdateVariable("xMqs", sheetRow_S_SE.MC_Mq_60Hz); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xRNE", sheetRow_N_NE_SE.MC_RNE); maquinaInequacoes.CalculationMemory.UpdateVariable("xger_xingo", sheetRow_N_NE_SE.MC_Xingo_Gera); }
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); } }
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"); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_S_SE sheetRow_S_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xpercarga", sheetRow_S_SE.LDretorno_PERIODO_DE_CARGA); maquinaInequacoes.CalculationMemory.UpdateVariable("xNMaqIpu", sheetRow_S_SE.MC_Mq_60Hz); maquinaInequacoes.CalculationMemory.UpdateVariable("xGerIPU", sheetRow_S_SE.MC_GIPU_60Hz); }
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); }
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); } }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE, SheetRow_S_SE sheetRow_S_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xcarga_SIN", sheetRow_N_NE_SE.MC_CARGASIN); maquinaInequacoes.CalculationMemory.UpdateVariable("xMqIPU", sheetRow_S_SE.LDvalorplanilha_Mqs_crt_IPU_max); }
/// <summary> /// Atualiza as variáveis da memória de cálculo de acordo com os valores contidos nos parâmetros. /// </summary> /// <param name="maquinaInequacoes"></param> /// <param name="sheetRow_S_SE"></param> public void AtualizarVariaveisDaMemoriaDeCalculo(InequationEngine maquinaInequacoes, SheetRow_N_NE_SE sheetRow_N_NE_SE) { maquinaInequacoes.CalculationMemory.UpdateVariable("xlogica24", "Ligada"); maquinaInequacoes.CalculationMemory.UpdateVariable("xcarga_SIN", sheetRow_N_NE_SE.MC_CARGASIN); }
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; maquinaInequacoes.Compile(); maquinaInequacoes.Execute(); Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 0.0); horaA = "11:00:22"; horaB = "11:00:22"; 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(), 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(), 100.0); expressao = "(a = b)"; decisao.Inequation.Expression = expressao; maquinaInequacoes.Compile(); maquinaInequacoes.Execute(); Assert.AreEqual(maquinaInequacoes.CalculationMemory["result"].GetValue(), 100.0); }