Ajustes para implementação do agitador de calda
This commit is contained in:
parent
94bc4c988d
commit
520b83e40b
|
|
@ -56,6 +56,8 @@
|
|||
this.tabDeteccoes = new System.Windows.Forms.TabPage();
|
||||
this.pnlDeteccoesRua = new System.Windows.Forms.Panel();
|
||||
this.tabPulverizador = new System.Windows.Forms.TabPage();
|
||||
this.btnDeslsigarAgitador = new System.Windows.Forms.Button();
|
||||
this.btnLigarAgitador = new System.Windows.Forms.Button();
|
||||
this.lblPressaoSP = new System.Windows.Forms.Label();
|
||||
this.nudPressaoSP = new System.Windows.Forms.NumericUpDown();
|
||||
this.btnDesligarBomba = new System.Windows.Forms.Button();
|
||||
|
|
@ -81,8 +83,8 @@
|
|||
this.chbPulverizador = new System.Windows.Forms.CheckBox();
|
||||
this.flwCamerasSolo = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.chbSonarAtivado = new System.Windows.Forms.CheckBox();
|
||||
this.btnLigarAgitador = new System.Windows.Forms.Button();
|
||||
this.btnDeslsigarAgitador = new System.Windows.Forms.Button();
|
||||
this.lblPotenciaSP = new System.Windows.Forms.Label();
|
||||
this.nudPotenciaSP = new System.Windows.Forms.NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chartGraficos)).BeginInit();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabMapa.SuspendLayout();
|
||||
|
|
@ -95,6 +97,7 @@
|
|||
this.pnlDir_ET.SuspendLayout();
|
||||
this.pnlDir_DT.SuspendLayout();
|
||||
this.pnlDir_DF.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaSP)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlAtuadores
|
||||
|
|
@ -366,6 +369,8 @@
|
|||
//
|
||||
// tabPulverizador
|
||||
//
|
||||
this.tabPulverizador.Controls.Add(this.lblPotenciaSP);
|
||||
this.tabPulverizador.Controls.Add(this.nudPotenciaSP);
|
||||
this.tabPulverizador.Controls.Add(this.btnDeslsigarAgitador);
|
||||
this.tabPulverizador.Controls.Add(this.btnLigarAgitador);
|
||||
this.tabPulverizador.Controls.Add(this.lblPressaoSP);
|
||||
|
|
@ -381,6 +386,30 @@
|
|||
this.tabPulverizador.Text = "Pulverizador";
|
||||
this.tabPulverizador.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnDeslsigarAgitador
|
||||
//
|
||||
this.btnDeslsigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnDeslsigarAgitador.Location = new System.Drawing.Point(244, 67);
|
||||
this.btnDeslsigarAgitador.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnDeslsigarAgitador.Name = "btnDeslsigarAgitador";
|
||||
this.btnDeslsigarAgitador.Size = new System.Drawing.Size(120, 28);
|
||||
this.btnDeslsigarAgitador.TabIndex = 31;
|
||||
this.btnDeslsigarAgitador.Text = "Desligar Agitador";
|
||||
this.btnDeslsigarAgitador.UseVisualStyleBackColor = true;
|
||||
this.btnDeslsigarAgitador.Click += new System.EventHandler(this.btnDeslsigarAgitador_Click);
|
||||
//
|
||||
// btnLigarAgitador
|
||||
//
|
||||
this.btnLigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnLigarAgitador.Location = new System.Drawing.Point(118, 67);
|
||||
this.btnLigarAgitador.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnLigarAgitador.Name = "btnLigarAgitador";
|
||||
this.btnLigarAgitador.Size = new System.Drawing.Size(104, 28);
|
||||
this.btnLigarAgitador.TabIndex = 30;
|
||||
this.btnLigarAgitador.Text = "Ligar Agitador";
|
||||
this.btnLigarAgitador.UseVisualStyleBackColor = true;
|
||||
this.btnLigarAgitador.Click += new System.EventHandler(this.btnLigarAgitador_Click);
|
||||
//
|
||||
// lblPressaoSP
|
||||
//
|
||||
this.lblPressaoSP.AutoSize = true;
|
||||
|
|
@ -411,7 +440,7 @@
|
|||
// btnDesligarBomba
|
||||
//
|
||||
this.btnDesligarBomba.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnDesligarBomba.Location = new System.Drawing.Point(244, 17);
|
||||
this.btnDesligarBomba.Location = new System.Drawing.Point(244, 21);
|
||||
this.btnDesligarBomba.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnDesligarBomba.Name = "btnDesligarBomba";
|
||||
this.btnDesligarBomba.Size = new System.Drawing.Size(120, 28);
|
||||
|
|
@ -423,7 +452,7 @@
|
|||
// btnLigarBomba
|
||||
//
|
||||
this.btnLigarBomba.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnLigarBomba.Location = new System.Drawing.Point(118, 17);
|
||||
this.btnLigarBomba.Location = new System.Drawing.Point(118, 21);
|
||||
this.btnLigarBomba.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnLigarBomba.Name = "btnLigarBomba";
|
||||
this.btnLigarBomba.Size = new System.Drawing.Size(104, 28);
|
||||
|
|
@ -654,29 +683,27 @@
|
|||
this.chbSonarAtivado.UseVisualStyleBackColor = true;
|
||||
this.chbSonarAtivado.CheckedChanged += new System.EventHandler(this.chbSonarAtivado_CheckedChanged);
|
||||
//
|
||||
// btnLigarAgitador
|
||||
// lblPotenciaSP
|
||||
//
|
||||
this.btnLigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnLigarAgitador.Location = new System.Drawing.Point(118, 73);
|
||||
this.btnLigarAgitador.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnLigarAgitador.Name = "btnLigarAgitador";
|
||||
this.btnLigarAgitador.Size = new System.Drawing.Size(104, 28);
|
||||
this.btnLigarAgitador.TabIndex = 30;
|
||||
this.btnLigarAgitador.Text = "Ligar Agitador";
|
||||
this.btnLigarAgitador.UseVisualStyleBackColor = true;
|
||||
this.btnLigarAgitador.Click += new System.EventHandler(this.btnLigarAgitador_Click);
|
||||
this.lblPotenciaSP.AutoSize = true;
|
||||
this.lblPotenciaSP.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblPotenciaSP.Location = new System.Drawing.Point(21, 57);
|
||||
this.lblPotenciaSP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.lblPotenciaSP.Name = "lblPotenciaSP";
|
||||
this.lblPotenciaSP.Size = new System.Drawing.Size(77, 13);
|
||||
this.lblPotenciaSP.TabIndex = 33;
|
||||
this.lblPotenciaSP.Text = "Potencia SP";
|
||||
//
|
||||
// btnDeslsigarAgitador
|
||||
// nudPotenciaSP
|
||||
//
|
||||
this.btnDeslsigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnDeslsigarAgitador.Location = new System.Drawing.Point(244, 73);
|
||||
this.btnDeslsigarAgitador.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnDeslsigarAgitador.Name = "btnDeslsigarAgitador";
|
||||
this.btnDeslsigarAgitador.Size = new System.Drawing.Size(120, 28);
|
||||
this.btnDeslsigarAgitador.TabIndex = 31;
|
||||
this.btnDeslsigarAgitador.Text = "Desligar Agitador";
|
||||
this.btnDeslsigarAgitador.UseVisualStyleBackColor = true;
|
||||
this.btnDeslsigarAgitador.Click += new System.EventHandler(this.btnDeslsigarAgitador_Click);
|
||||
this.nudPotenciaSP.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.nudPotenciaSP.Location = new System.Drawing.Point(21, 73);
|
||||
this.nudPotenciaSP.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.nudPotenciaSP.Name = "nudPotenciaSP";
|
||||
this.nudPotenciaSP.Size = new System.Drawing.Size(79, 19);
|
||||
this.nudPotenciaSP.TabIndex = 32;
|
||||
this.nudPotenciaSP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.nudPotenciaSP.ValueChanged += new System.EventHandler(this.nudPotenciaSP_ValueChanged);
|
||||
//
|
||||
// frmOperacaoManual
|
||||
//
|
||||
|
|
@ -730,6 +757,7 @@
|
|||
this.pnlDir_DT.PerformLayout();
|
||||
this.pnlDir_DF.ResumeLayout(false);
|
||||
this.pnlDir_DF.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaSP)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
@ -787,5 +815,7 @@
|
|||
private System.Windows.Forms.CheckBox chbSonarAtivado;
|
||||
private System.Windows.Forms.Button btnDeslsigarAgitador;
|
||||
private System.Windows.Forms.Button btnLigarAgitador;
|
||||
private System.Windows.Forms.Label lblPotenciaSP;
|
||||
private System.Windows.Forms.NumericUpDown nudPotenciaSP;
|
||||
}
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ namespace AgroBase.Forms.Operacoes
|
|||
gridDados.Rows.Add("Volume Vazado", "", "mL");
|
||||
gridDados.Rows.Add("Angulo Barra Esquerda", "", "°");
|
||||
gridDados.Rows.Add("Angulo Barra Direita", "", "°");
|
||||
gridDados.Rows.Add("Angulo Barra Altura", "", "°");
|
||||
gridDados.Rows.Add("Potencia Agitador", "", "%");
|
||||
gridDados.Rows.Add("", "", "");
|
||||
gridDados.Rows.Add("Roll", "", "");
|
||||
gridDados.Rows.Add("Pitch", "", "");
|
||||
|
|
@ -555,7 +555,7 @@ namespace AgroBase.Forms.Operacoes
|
|||
gridDados.Rows[32].Cells[1].Value = (_Atuador?.VolumeVazaoMl ?? 0).ToString("0.00");
|
||||
gridDados.Rows[33].Cells[1].Value = (_Atuador?.AnguloBarraEsquerda ?? 0).ToString("0.00");
|
||||
gridDados.Rows[34].Cells[1].Value = (_Atuador?.AnguloBarraDireita ?? 0).ToString("0.00");
|
||||
gridDados.Rows[35].Cells[1].Value = (_Atuador?.AnguloBarraAltura ?? 0).ToString("0.00");
|
||||
gridDados.Rows[35].Cells[1].Value = (Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.ContadorCarga?.AgitadorCalda?._Potencia ?? 0).ToString("0.00");
|
||||
gridDados.Rows[36].Cells[1].Value = "";
|
||||
gridDados.Rows[37].Cells[1].Value = (_IMU?.InclinacaoLateral ?? 0).ToString("0.00");
|
||||
gridDados.Rows[38].Cells[1].Value = (_IMU?.InclinacaoFrontal ?? 0).ToString("0.00");
|
||||
|
|
@ -583,6 +583,7 @@ namespace AgroBase.Forms.Operacoes
|
|||
{
|
||||
var Atuador = Variaveis.OperacaoEmAndamento.DispAtu;
|
||||
nudPressaoSP.Value = Convert.ToInt32(Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha);
|
||||
nudPotenciaSP.Value = (decimal)(Atuador.Dados?.ContadorCarga?.AgitadorCalda?.PotenciaSP ?? 0);
|
||||
|
||||
int panelWidth = pnlAtuadores.Width;
|
||||
int circleDiameter = 40; // Diâmetro dos círculos grandes
|
||||
|
|
@ -639,33 +640,38 @@ namespace AgroBase.Forms.Operacoes
|
|||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == "BMBLN");
|
||||
if (Bomba != null)
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: true, Valor: Convert.ToInt32(nudPressaoSP.Value), Forcar: true);
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: true, Valores: new System.Collections.Generic.List<double?>() { Convert.ToInt32(nudPotenciaSP.Value), Convert.ToInt32(nudPressaoSP.Value) }, Forcar: true);
|
||||
}
|
||||
|
||||
private void btnDesligarBomba_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == "BMBLN");
|
||||
if (Bomba != null)
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: false, Valor: Convert.ToInt32(nudPressaoSP.Value), Forcar: true);
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: false, Forcar: true);
|
||||
}
|
||||
|
||||
private void btnLigarAgitador_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == "BMBAGT");
|
||||
if (Bomba != null)
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: true, Forcar: true);
|
||||
var Agitador = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == "BMBAGT");
|
||||
if (Agitador != null)
|
||||
GeneralJoystick.EnviarComandoAtuador(Agitador.Componente, Agitador.ID, Status: true, Valores: new System.Collections.Generic.List<double?>() { Convert.ToInt32(nudPotenciaSP.Value) }, Forcar: true);
|
||||
}
|
||||
|
||||
private void btnDeslsigarAgitador_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == "BMBAGT");
|
||||
if (Bomba != null)
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: false, Forcar: true);
|
||||
var Agitador = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault(x => x.ID == "BMBAGT");
|
||||
if (Agitador != null)
|
||||
GeneralJoystick.EnviarComandoAtuador(Agitador.Componente, Agitador.ID, Status: false, Forcar: true);
|
||||
}
|
||||
|
||||
private void nudPressaoSP_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha = Convert.ToInt32(((NumericUpDown)sender).Value);
|
||||
|
||||
}
|
||||
|
||||
private void nudPotenciaSP_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pnlAtuadores_Paint(object sender, PaintEventArgs e)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
this.lblAnteciparManobraM = new System.Windows.Forms.Label();
|
||||
this.txtAnteciparManobraM = new System.Windows.Forms.TextBox();
|
||||
this.lblAnteciparManobra = new System.Windows.Forms.Label();
|
||||
this.chbDirAuxilioSonar = new System.Windows.Forms.CheckBox();
|
||||
this.chbImuParadaInclinacao = new System.Windows.Forms.CheckBox();
|
||||
this.chbOakParadaObstaculo = new System.Windows.Forms.CheckBox();
|
||||
this.chbO_Snr = new System.Windows.Forms.CheckBox();
|
||||
|
|
@ -61,10 +60,12 @@
|
|||
this.lblAngulomax = new System.Windows.Forms.Label();
|
||||
this.nudAnguloMinimo = new System.Windows.Forms.NumericUpDown();
|
||||
this.nudVelocidadeMP = new System.Windows.Forms.NumericUpDown();
|
||||
this.chbDirAuxilioSonar = new System.Windows.Forms.CheckBox();
|
||||
this.lblVelocidadeMP = new System.Windows.Forms.Label();
|
||||
this.nudAnguloMaximo = new System.Windows.Forms.NumericUpDown();
|
||||
this.lblAngulomin = new System.Windows.Forms.Label();
|
||||
this.gpbP_Mov = new System.Windows.Forms.GroupBox();
|
||||
this.chbMovAuxilioSonar = new System.Windows.Forms.CheckBox();
|
||||
this.chbMovimentacaoAutomatica = new System.Windows.Forms.CheckBox();
|
||||
this.nudVelocidadeComErvas = new System.Windows.Forms.NumericUpDown();
|
||||
this.lblKmhCErvas = new System.Windows.Forms.Label();
|
||||
|
|
@ -92,7 +93,7 @@
|
|||
this.nudCapacidadereservatorio = new System.Windows.Forms.NumericUpDown();
|
||||
this.lblUnCapcaidadereservatorio = new System.Windows.Forms.Label();
|
||||
this.lblCapacidadereservatorio = new System.Windows.Forms.Label();
|
||||
this.chbMovAuxilioSonar = new System.Windows.Forms.CheckBox();
|
||||
this.cmbAgitadorModo = new System.Windows.Forms.ComboBox();
|
||||
this.gpbModulos.SuspendLayout();
|
||||
this.gpbP_Knt.SuspendLayout();
|
||||
this.gpbP_Sen.SuspendLayout();
|
||||
|
|
@ -222,18 +223,6 @@
|
|||
this.lblAnteciparManobra.TabIndex = 15;
|
||||
this.lblAnteciparManobra.Text = "Antecipar manobra";
|
||||
//
|
||||
// chbDirAuxilioSonar
|
||||
//
|
||||
this.chbDirAuxilioSonar.AutoSize = true;
|
||||
this.chbDirAuxilioSonar.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
|
||||
this.chbDirAuxilioSonar.Location = new System.Drawing.Point(9, 180);
|
||||
this.chbDirAuxilioSonar.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.chbDirAuxilioSonar.Name = "chbDirAuxilioSonar";
|
||||
this.chbDirAuxilioSonar.Size = new System.Drawing.Size(157, 22);
|
||||
this.chbDirAuxilioSonar.TabIndex = 13;
|
||||
this.chbDirAuxilioSonar.Text = "Assistido por Sonar";
|
||||
this.chbDirAuxilioSonar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chbImuParadaInclinacao
|
||||
//
|
||||
this.chbImuParadaInclinacao.AutoSize = true;
|
||||
|
|
@ -358,6 +347,7 @@
|
|||
//
|
||||
// gpbP_Atu
|
||||
//
|
||||
this.gpbP_Atu.Controls.Add(this.cmbAgitadorModo);
|
||||
this.gpbP_Atu.Controls.Add(this.chbPulverizadorAutomatico);
|
||||
this.gpbP_Atu.Controls.Add(this.nudAtuarem);
|
||||
this.gpbP_Atu.Controls.Add(this.lblAtuarem);
|
||||
|
|
@ -376,7 +366,7 @@
|
|||
// chbPulverizadorAutomatico
|
||||
//
|
||||
this.chbPulverizadorAutomatico.AutoSize = true;
|
||||
this.chbPulverizadorAutomatico.Location = new System.Drawing.Point(10, 155);
|
||||
this.chbPulverizadorAutomatico.Location = new System.Drawing.Point(9, 178);
|
||||
this.chbPulverizadorAutomatico.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.chbPulverizadorAutomatico.Name = "chbPulverizadorAutomatico";
|
||||
this.chbPulverizadorAutomatico.Size = new System.Drawing.Size(109, 24);
|
||||
|
|
@ -503,6 +493,18 @@
|
|||
this.nudVelocidadeMP.TabIndex = 11;
|
||||
this.nudVelocidadeMP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// chbDirAuxilioSonar
|
||||
//
|
||||
this.chbDirAuxilioSonar.AutoSize = true;
|
||||
this.chbDirAuxilioSonar.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
|
||||
this.chbDirAuxilioSonar.Location = new System.Drawing.Point(9, 180);
|
||||
this.chbDirAuxilioSonar.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.chbDirAuxilioSonar.Name = "chbDirAuxilioSonar";
|
||||
this.chbDirAuxilioSonar.Size = new System.Drawing.Size(157, 22);
|
||||
this.chbDirAuxilioSonar.TabIndex = 13;
|
||||
this.chbDirAuxilioSonar.Text = "Assistido por Sonar";
|
||||
this.chbDirAuxilioSonar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lblVelocidadeMP
|
||||
//
|
||||
this.lblVelocidadeMP.AutoSize = true;
|
||||
|
|
@ -559,6 +561,18 @@
|
|||
this.gpbP_Mov.TabStop = false;
|
||||
this.gpbP_Mov.Text = "Ajustes";
|
||||
//
|
||||
// chbMovAuxilioSonar
|
||||
//
|
||||
this.chbMovAuxilioSonar.AutoSize = true;
|
||||
this.chbMovAuxilioSonar.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
|
||||
this.chbMovAuxilioSonar.Location = new System.Drawing.Point(6, 180);
|
||||
this.chbMovAuxilioSonar.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.chbMovAuxilioSonar.Name = "chbMovAuxilioSonar";
|
||||
this.chbMovAuxilioSonar.Size = new System.Drawing.Size(157, 22);
|
||||
this.chbMovAuxilioSonar.TabIndex = 16;
|
||||
this.chbMovAuxilioSonar.Text = "Assistido por Sonar";
|
||||
this.chbMovAuxilioSonar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chbMovimentacaoAutomatica
|
||||
//
|
||||
this.chbMovimentacaoAutomatica.AutoSize = true;
|
||||
|
|
@ -858,17 +872,16 @@
|
|||
this.lblCapacidadereservatorio.TabIndex = 9;
|
||||
this.lblCapacidadereservatorio.Text = "Capacidade reservatório";
|
||||
//
|
||||
// chbMovAuxilioSonar
|
||||
// cmbAgitadorModo
|
||||
//
|
||||
this.chbMovAuxilioSonar.AutoSize = true;
|
||||
this.chbMovAuxilioSonar.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
|
||||
this.chbMovAuxilioSonar.Location = new System.Drawing.Point(6, 180);
|
||||
this.chbMovAuxilioSonar.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.chbMovAuxilioSonar.Name = "chbMovAuxilioSonar";
|
||||
this.chbMovAuxilioSonar.Size = new System.Drawing.Size(157, 22);
|
||||
this.chbMovAuxilioSonar.TabIndex = 16;
|
||||
this.chbMovAuxilioSonar.Text = "Assistido por Sonar";
|
||||
this.chbMovAuxilioSonar.UseVisualStyleBackColor = true;
|
||||
this.cmbAgitadorModo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbAgitadorModo.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cmbAgitadorModo.FormattingEnabled = true;
|
||||
this.cmbAgitadorModo.Location = new System.Drawing.Point(9, 132);
|
||||
this.cmbAgitadorModo.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.cmbAgitadorModo.Name = "cmbAgitadorModo";
|
||||
this.cmbAgitadorModo.Size = new System.Drawing.Size(175, 32);
|
||||
this.cmbAgitadorModo.TabIndex = 9;
|
||||
//
|
||||
// frmParametrizacaoOperacao
|
||||
//
|
||||
|
|
@ -984,5 +997,6 @@
|
|||
private System.Windows.Forms.Label lblAnteciparManobra;
|
||||
private System.Windows.Forms.CheckBox chbFrenagem;
|
||||
private System.Windows.Forms.CheckBox chbMovAuxilioSonar;
|
||||
private System.Windows.Forms.ComboBox cmbAgitadorModo;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,10 @@ namespace AgroBase.Forms.Operacoes
|
|||
cmbOperacao.Items.AddRange(Enum.GetNames(typeof(ModoOperacao)));
|
||||
cmbOperacao.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Parametros?.Modo;
|
||||
|
||||
cmbAgitadorModo.Items.Clear();
|
||||
cmbAgitadorModo.Items.AddRange(Enum.GetNames(typeof(ModoAgitadorCalda)));
|
||||
cmbAgitadorModo.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuAgitadorModo;
|
||||
|
||||
var chbModulos = gpbModulos.Controls.OfType<CheckBox>().Where(x => x.Name.Contains("chbD_")).ToList();
|
||||
chbModulos.ForEach(chb =>
|
||||
{
|
||||
|
|
@ -82,6 +86,8 @@ namespace AgroBase.Forms.Operacoes
|
|||
chbFrenagem.Checked = _Parametros.Controle.FrenagemAutomaticaAoParar;
|
||||
|
||||
txtAnteciparManobraM.Text = _Parametros.Controle.AnteciparManobraCorredorM.ToString();
|
||||
|
||||
cmbAgitadorModo.SelectedIndex = (int)_Parametros.Controle.AtuAgitadorModo;
|
||||
}
|
||||
|
||||
private void chbD_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
@ -141,6 +147,7 @@ namespace AgroBase.Forms.Operacoes
|
|||
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirAuxilioSonar = chbDirAuxilioSonar.Checked;
|
||||
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovAuxilioSonar = chbMovAuxilioSonar.Checked;
|
||||
Variaveis.OperacaoEmAndamento.Parametros.Controle.FrenagemAutomaticaAoParar = chbFrenagem.Checked;
|
||||
Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuAgitadorModo = (ModoAgitadorCalda)cmbAgitadorModo.SelectedIndex;
|
||||
|
||||
Variaveis.OperacaoEmAndamento.Parametros.ModulosMandatorios = ModulosMandatorios.Where(x => x.Utilizar).ToList();
|
||||
Variaveis.OperacaoEmAndamento.Parametros.Controle.PulverizadorAutomatico = chbPulverizadorAutomatico.Checked;
|
||||
|
|
|
|||
|
|
@ -375,5 +375,12 @@
|
|||
Raw4 = 8,
|
||||
}
|
||||
|
||||
public enum ModoAgitadorCalda
|
||||
{
|
||||
SemAgitacao = 0,
|
||||
Continuo = 1,
|
||||
Intermitente = 2,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ namespace AgroBase
|
|||
}
|
||||
}
|
||||
|
||||
public static void EnviarComandoAtuador(S_Code Componente, string ID, bool? Status = null, double? Valor = null, bool Forcar = false)
|
||||
public static void EnviarComandoAtuador(S_Code Componente, string ID, bool? Status = null, List<double?> Valores = null, bool Forcar = false)
|
||||
{
|
||||
var DispAtu = Variaveis.OperacaoEmAndamento.DispAtu;
|
||||
if (!DispAtu.Dados.Conectado)
|
||||
|
|
@ -815,7 +815,8 @@ namespace AgroBase
|
|||
if (Bomba != null)
|
||||
{
|
||||
if (Status != null) Bomba.ComandoAtuar = (bool)Status;
|
||||
if (Valor != null) Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha = (double)Valor;
|
||||
if (Valores?.Count() > 0) Bomba.PotenciaSP = (double)Valores[0];
|
||||
if (Valores?.Count() > 1) Bomba.PressaoSP = (double)Valores[1];
|
||||
(id_num, posicao, data) = Bomba.ProtocoloComando();
|
||||
}
|
||||
break;
|
||||
|
|
@ -824,7 +825,7 @@ namespace AgroBase
|
|||
if (Bico != null)
|
||||
{
|
||||
if (Status != null) Bico.ComandoAtuar = (bool)Status;
|
||||
if (Valor != null) Bico.AnguloControle = (int)Valor;
|
||||
if (Valores?.Count() > 0) Bico.AnguloControle = (int)Valores[0];
|
||||
(id_num, posicao, data) = Bico.ProtocoloComando();
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ namespace AgroBase.Models.Modules
|
|||
|
||||
public double AnguloBarraEsquerda { get; set; }
|
||||
public double AnguloBarraDireita { get; set; }
|
||||
public double AnguloBarraAltura { get; set; }
|
||||
|
||||
public static PinoutDataModel Pinout { get; set; }
|
||||
public static List<FuncoesPinout> Funcoes { get; set; } = new List<FuncoesPinout>()
|
||||
|
|
@ -83,15 +82,7 @@ namespace AgroBase.Models.Modules
|
|||
return sMAG;
|
||||
}
|
||||
}
|
||||
private SensorModel SensorAnguloBarraAltura
|
||||
{
|
||||
get
|
||||
{
|
||||
var sMAG = Sensores?.FirstOrDefault(x => x.Componente == S_Code.sMAG && x.ID.Contains("ALT"));
|
||||
return sMAG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HerbicideCounterService ContadorCarga = new HerbicideCounterService(VariaveisEquipamento.CapacidadeReservatorio, VariaveisEquipamento.DensidadeHerbicida);
|
||||
|
||||
#region VAZAO
|
||||
|
|
@ -539,63 +530,8 @@ namespace AgroBase.Models.Modules
|
|||
},
|
||||
}
|
||||
},
|
||||
new SensorModel()
|
||||
{
|
||||
ID = "MAGALT",
|
||||
Descricao = "Angulo Barra Altura",
|
||||
ID_Num = 43,
|
||||
Componente = S_Code.sMAG,
|
||||
Aferir = true,
|
||||
Mandatorio = true,
|
||||
Funcoes = new List<FuncoesPinout>()
|
||||
{
|
||||
FuncoesPinout.I2C,
|
||||
},
|
||||
Parametros = new List<SensorParametroModel>()
|
||||
{
|
||||
new SensorParametroModel()
|
||||
{
|
||||
Descricao = "Endereço I2C",
|
||||
Valor = "0x36",
|
||||
QtdBytes = 1,
|
||||
Escalar = false,
|
||||
Enviar = true
|
||||
},
|
||||
new SensorParametroModel()
|
||||
{
|
||||
Descricao = "Canal MUX",
|
||||
Valor = "2",
|
||||
QtdBytes = 1,
|
||||
Escalar = false,
|
||||
Enviar = true
|
||||
},
|
||||
},
|
||||
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
||||
{
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Iniciado,
|
||||
posicao = CanMessagePosicaoDados.Status,
|
||||
indice = 0,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.LeituraBruta,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 0,
|
||||
unidade_medida = ""
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.LeituraAngulo,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 1,
|
||||
unidade_medida = "°"
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
// 51 ~ 51
|
||||
// 51 ~ 60
|
||||
BombasPressurizadoras = new List<AtuadorBombaModel>()
|
||||
{
|
||||
new AtuadorBombaModel()
|
||||
|
|
@ -604,6 +540,7 @@ namespace AgroBase.Models.Modules
|
|||
ID_Num = 51,
|
||||
Sensor_ID_Num = 11,
|
||||
ComandoAtuar = false,
|
||||
PressaoSP = 100,
|
||||
Componente = S_Code.sBMB,
|
||||
Comandar = true,
|
||||
Mandatorio = true,
|
||||
|
|
@ -628,21 +565,27 @@ namespace AgroBase.Models.Modules
|
|||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Potencia,
|
||||
funcao = FuncoesPinout.PotenciaSP,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 1,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.PressaoSP,
|
||||
funcao = FuncoesPinout.Potencia,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 2,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Pressao,
|
||||
funcao = FuncoesPinout.PressaoSP,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 3,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Pressao,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 4,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -653,6 +596,7 @@ namespace AgroBase.Models.Modules
|
|||
Sensor_ID_Num = -1,
|
||||
ComandoAtuar = false,
|
||||
Componente = S_Code.sBMB,
|
||||
PotenciaSP = 100,
|
||||
Comandar = true,
|
||||
Mandatorio = true,
|
||||
Funcoes = new List<FuncoesPinout>()
|
||||
|
|
@ -676,27 +620,34 @@ namespace AgroBase.Models.Modules
|
|||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Potencia,
|
||||
funcao = FuncoesPinout.PotenciaSP,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 1,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.PressaoSP,
|
||||
funcao = FuncoesPinout.Potencia,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 2,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Pressao,
|
||||
funcao = FuncoesPinout.PressaoSP,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 3,
|
||||
},
|
||||
new SensorValoresLeituraModel()
|
||||
{
|
||||
funcao = FuncoesPinout.Pressao,
|
||||
posicao = CanMessagePosicaoDados.Dados1,
|
||||
indice = 4,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
// 61 ~ 67
|
||||
// 61 ~ 70
|
||||
BicosPulverizadores = new List<AtuadorBicoModel>(),
|
||||
|
||||
};
|
||||
for (int i = 0; i < Variaveis.OperacaoEmAndamento.Parametros.QtdBicos; i++)
|
||||
{
|
||||
|
|
@ -755,7 +706,7 @@ namespace AgroBase.Models.Modules
|
|||
Dados.AtuPronto = false;
|
||||
Dados.PercentualErvasTerreno = 0;
|
||||
Dados.BombasPressurizadoras.ForEach(x => x.Funcoes = x.Funcoes.Distinct().ToList());
|
||||
|
||||
|
||||
ReiniciarLeituras(Dados);
|
||||
}
|
||||
|
||||
|
|
@ -787,6 +738,8 @@ namespace AgroBase.Models.Modules
|
|||
Dados.BombasPressurizadoras.ForEach(x =>
|
||||
{
|
||||
x.ComandoAtuar = false;
|
||||
x.PotenciaSP = 0;
|
||||
x.PressaoSP = 0;
|
||||
x.ValoresLeituras.ForEach(l =>
|
||||
{
|
||||
l.atual = new CanCommandFreqModel<dynamic>();
|
||||
|
|
@ -798,7 +751,6 @@ namespace AgroBase.Models.Modules
|
|||
Dados.VolumeVazadoML = 0;
|
||||
Dados.VazaoMediaMLs = 0;
|
||||
Dados.TempoAtuado = 0;
|
||||
Dados.AnguloBarraAltura = 0;
|
||||
Dados.AnguloBarraDireita = 0;
|
||||
Dados.AnguloBarraEsquerda = 0;
|
||||
Dados.PercentualErvasTerreno = 0;
|
||||
|
|
@ -1021,8 +973,8 @@ namespace AgroBase.Models.Modules
|
|||
if (Variaveis.Fechando) return;
|
||||
|
||||
bool operacaoConcluida = Variaveis.OperacaoEmAndamento.Sensoriamento.StatusOperacao == StatusOperacao.Concluido;
|
||||
bool pulverizadorAutomatico = Variaveis.OperacaoEmAndamento.Parametros.Controle.PulverizadorAutomatico;
|
||||
|
||||
bool pulverizadorAutomatico = Variaveis.OperacaoEmAndamento.Parametros?.Controle?.PulverizadorAutomatico ?? false;
|
||||
|
||||
foreach (var bico in BicosPulverizadores.Where(x => x.Inicializado))
|
||||
{
|
||||
bool statusDesejado = bico.Comandar && bico.ComandoAtuar;
|
||||
|
|
@ -1041,7 +993,7 @@ namespace AgroBase.Models.Modules
|
|||
bico.Componente,
|
||||
bico.ID,
|
||||
Status: statusDesejado,
|
||||
Valor: anguloDesejado
|
||||
Valores: new List<double?>() { anguloDesejado }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1053,18 +1005,20 @@ namespace AgroBase.Models.Modules
|
|||
statusDesejado &= ContadorCarga.PulverizadorLiberado && !operacaoConcluida && Variaveis.OperacaoEmAndamento.Iniciado;
|
||||
|
||||
Estado estadoDesejado = statusDesejado ? Estado.Ligado : Estado.Desligado;
|
||||
double pressaoDesejada = Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha;
|
||||
double potenciaDesejada = statusDesejado ? bomba.PotenciaSP : 0;
|
||||
double pressaoDesejada = statusDesejado ? bomba.PressaoSP : 0;
|
||||
|
||||
bool estadoDivergente = estadoDesejado != bomba._EstadoLeitura;
|
||||
bool potenciaDivergente = Math.Abs(bomba._PotenciaSP - potenciaDesejada) > 1;
|
||||
bool pressaoDivergente = bomba.Sensor_ID_Num > -1 && Math.Abs(bomba._PressaoSP - pressaoDesejada) > 0.05;
|
||||
|
||||
if (estadoDivergente || pressaoDivergente)
|
||||
if (estadoDivergente || potenciaDivergente || pressaoDivergente)
|
||||
{
|
||||
GeneralJoystick.EnviarComandoAtuador(
|
||||
bomba.Componente,
|
||||
bomba.ID,
|
||||
Status: statusDesejado,
|
||||
Valor: pressaoDesejada
|
||||
Valores: new List<double?>() { potenciaDesejada, pressaoDesejada }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1112,7 +1066,9 @@ namespace AgroBase.Models.Modules
|
|||
continue;
|
||||
}
|
||||
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: true, Forcar: true);
|
||||
Bomba.PotenciaSP = 100;
|
||||
Bomba.PressaoSP = Bomba.ID == "BMBLN" ? Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha : -1;
|
||||
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, Bomba.ID, Status: true, Valores: new List<double?>() { Bomba.PotenciaSP, Bomba.PressaoSP }, Forcar: true);
|
||||
|
||||
if (Bomba.Sensor_ID_Num == -1)
|
||||
{
|
||||
|
|
@ -1207,8 +1163,6 @@ namespace AgroBase.Models.Modules
|
|||
RequisitarDadosModulo(SensorAnguloBarraEsquerda.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
||||
if (SensorAnguloBarraDireita != null)
|
||||
RequisitarDadosModulo(SensorAnguloBarraDireita.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
||||
if (SensorAnguloBarraAltura != null)
|
||||
RequisitarDadosModulo(SensorAnguloBarraAltura.ID_Num, CanMessagePosicaoDados.Dados1, CanMessagePosicaoDados.Dados1, true);
|
||||
}
|
||||
|
||||
public void AtualizarDadosSensoresExternos(S_Code componente, int id_num)
|
||||
|
|
@ -1225,8 +1179,6 @@ namespace AgroBase.Models.Modules
|
|||
AnguloBarraEsquerda = angulo;
|
||||
else if (sensor.ID_Num == SensorAnguloBarraDireita.ID_Num)
|
||||
AnguloBarraDireita = angulo;
|
||||
else if (sensor.ID_Num == SensorAnguloBarraAltura.ID_Num)
|
||||
AnguloBarraAltura = angulo;
|
||||
}
|
||||
break;
|
||||
case S_Code.sBIC:
|
||||
|
|
@ -1355,6 +1307,8 @@ namespace AgroBase.Models.Modules
|
|||
public string ID { get; set; }
|
||||
public int ID_Num { get; set; }
|
||||
public bool ComandoAtuar { get; set; }
|
||||
public double PotenciaSP { get; set; }
|
||||
public double PressaoSP { get; set; }
|
||||
public S_Code Componente { get; set; } = S_Code.sBMB;
|
||||
public int Sensor_ID_Num { get; set; }
|
||||
public bool Comandar { get; set; }
|
||||
|
|
@ -1380,6 +1334,8 @@ namespace AgroBase.Models.Modules
|
|||
public double _Potencia => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.Potencia)?.atual?.valor ?? 0;
|
||||
public bool _BombaLigada => _Potencia > 0;
|
||||
public double _PressaoSP => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.PressaoSP)?.atual?.valor ?? 0;
|
||||
public double _PotenciaSP => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.PotenciaSP)?.atual?.valor ?? 0;
|
||||
public double _PressaoAtual => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.Pressao)?.atual?.valor ?? 0;
|
||||
|
||||
|
||||
|
||||
|
|
@ -1391,7 +1347,7 @@ namespace AgroBase.Models.Modules
|
|||
{
|
||||
(byte)Componente,
|
||||
(byte)(conectar ? 1 : 0),
|
||||
(byte)Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha,
|
||||
(byte)PressaoSP,
|
||||
(byte)Sensor_ID_Num,
|
||||
(byte)(pinout.Pinos.FirstOrDefault(x => x.ComponenteID == ID && x.Funcao == FuncoesPinout.IN1)?.Pino ?? PinoutUtils.PINO_INVALIDO),
|
||||
(byte)(pinout.Pinos.FirstOrDefault(x => x.ComponenteID == ID && x.Funcao == FuncoesPinout.IN2)?.Pino ?? PinoutUtils.PINO_INVALIDO),
|
||||
|
|
@ -1411,12 +1367,13 @@ namespace AgroBase.Models.Modules
|
|||
new byte[]
|
||||
{
|
||||
(byte)(ComandoAtuar ? Estado.Ligado : Estado.Desligado),
|
||||
(byte)(Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha)
|
||||
(byte)(PotenciaSP),
|
||||
(byte)(PressaoSP)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public bool AtingiuPressao() => Variaveis.OperacaoEmAndamento.DispAtu.Dados.PressaoLinha >= Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha;
|
||||
public bool AtingiuPressao() => _PressaoAtual >= Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPressaoLinha;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1647,7 +1604,7 @@ namespace AgroBase.Models.Modules
|
|||
var sensor = Disp.Sensores.FirstOrDefault(x => x.ID_Num == ID_Num);
|
||||
var bico = Disp.BicosPulverizadores.FirstOrDefault(x => x.ID_Num == ID_Num);
|
||||
var bomba = Disp.BombasPressurizadoras.FirstOrDefault(x => x.ID_Num == ID_Num);
|
||||
|
||||
|
||||
return sensor?.Componente ?? bico?.Componente ?? bomba?.Componente ?? S_Code.sVZO;
|
||||
}
|
||||
|
||||
|
|
@ -1784,6 +1741,7 @@ namespace AgroBase.Models.Modules
|
|||
int qtdPulsos = data[2];
|
||||
ushort periodo = Converter2BytesU16(data, 3);
|
||||
double vazao = ConverterByteParaDouble(data, 5);
|
||||
//Variaveis.MostrarLog($"[AtuadorModel] Vazao: {vazao}, pulsos: {qtdPulsos}, Periodo: {periodo}");
|
||||
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { qtdPulsos, periodo, vazao });
|
||||
break;
|
||||
}
|
||||
|
|
@ -1804,6 +1762,7 @@ namespace AgroBase.Models.Modules
|
|||
{
|
||||
double raw = ConverterByteParaDouble(data, 2);
|
||||
double massa = ConverterByteParaDouble(data, 4);
|
||||
//Variaveis.MostrarLog($"[AtuadorModel] Massa: {massa}, Raw: {raw}");
|
||||
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { raw, massa });
|
||||
break;
|
||||
}
|
||||
|
|
@ -1837,16 +1796,18 @@ namespace AgroBase.Models.Modules
|
|||
case CanMessagePosicaoDados.Status:
|
||||
{
|
||||
bool Iniciado = data[2] == 1;
|
||||
bool MalhaFechada = data[3] == 1;
|
||||
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||
break;
|
||||
}
|
||||
case CanMessagePosicaoDados.Dados1:
|
||||
{
|
||||
Estado estado = (Estado)data[2];
|
||||
int percentualPotencia = data[3];
|
||||
int pressaoSp = data[4];
|
||||
int pressaoAtual = data[5];
|
||||
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { estado, percentualPotencia, pressaoSp, pressaoAtual });
|
||||
int potenciaSp = data[3];
|
||||
int percentualPotencia = data[4];
|
||||
int pressaoSp = data[5];
|
||||
int pressaoAtual = data[6];
|
||||
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { estado, potenciaSp, percentualPotencia, pressaoSp, pressaoAtual });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -436,7 +436,8 @@ namespace AgroBase.Models.Modules
|
|||
QtdPulsos,
|
||||
Periodo,
|
||||
IN1,
|
||||
IN2
|
||||
IN2,
|
||||
PotenciaSP
|
||||
}
|
||||
|
||||
public static class PinoutUtils
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ namespace AgroBase.Models
|
|||
AtuPercentualErvasBicoOn = 1,
|
||||
AtuPercentualInicioPulverizacao = 70,
|
||||
AtuPressaoLinha = 85,
|
||||
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
|
||||
};
|
||||
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
|
||||
{
|
||||
|
|
@ -513,6 +514,7 @@ namespace AgroBase.Models
|
|||
AtuPercentualErvasBicoOn = 1,
|
||||
AtuPercentualInicioPulverizacao = 70,
|
||||
AtuPressaoLinha = 85,
|
||||
AtuAgitadorModo = ModoAgitadorCalda.Continuo,
|
||||
};
|
||||
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
|
||||
{
|
||||
|
|
@ -651,6 +653,7 @@ namespace AgroBase.Models
|
|||
AtuPercentualErvasBicoOn = 1,
|
||||
AtuPercentualInicioPulverizacao = 70,
|
||||
AtuPressaoLinha = 85,
|
||||
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
|
||||
};
|
||||
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
|
||||
{
|
||||
|
|
@ -789,6 +792,7 @@ namespace AgroBase.Models
|
|||
AtuPercentualErvasBicoOn = 1,
|
||||
AtuPercentualInicioPulverizacao = 70,
|
||||
AtuPressaoLinha = 85,
|
||||
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
|
||||
};
|
||||
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
|
||||
{
|
||||
|
|
@ -887,6 +891,7 @@ namespace AgroBase.Models
|
|||
AtuPercentualErvasBicoOn = 1,
|
||||
AtuPercentualInicioPulverizacao = 70,
|
||||
AtuPressaoLinha = 85,
|
||||
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
|
||||
};
|
||||
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
|
||||
{
|
||||
|
|
@ -1794,6 +1799,7 @@ namespace AgroBase.Models
|
|||
}
|
||||
|
||||
S_Code comp = get_comp(controleBase._comp_id);
|
||||
List<double?> valores = null;
|
||||
|
||||
switch (comp)
|
||||
{
|
||||
|
|
@ -1807,12 +1813,16 @@ namespace AgroBase.Models
|
|||
if (bico != null)
|
||||
{
|
||||
bico.AnguloAbertura = (int)controleBase._comp_value;
|
||||
valores = new List<double?>() { controleBase.Controle.AnguloSP };
|
||||
}
|
||||
}
|
||||
break;
|
||||
case S_Code.sBMB:
|
||||
valores = new List<double?>() { controleBase.Controle.Potencia, controleBase.Controle.Pressao };
|
||||
break;
|
||||
}
|
||||
|
||||
GeneralJoystick.EnviarComandoAtuador(comp, controleBase._comp_id, Status: controleBase.Controle.Estado, Valor: controleBase.Controle.AnguloSP, Forcar: true);
|
||||
GeneralJoystick.EnviarComandoAtuador(comp, controleBase._comp_id, Status: controleBase.Controle.Estado, Valores: valores, Forcar: true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2574,6 +2584,8 @@ namespace AgroBase.Models
|
|||
public bool? EmFreio { get; set; }
|
||||
public bool? Estado { get; set; }
|
||||
public double? Altura { get; set; }
|
||||
public double? Potencia { get; set; }
|
||||
public double? Pressao { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2681,6 +2693,7 @@ namespace AgroBase.Models
|
|||
_Cooler?.Atualizar(tmp_max, DateTime.Now);
|
||||
_Bateria?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0);
|
||||
_Reservatorio?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0, Variaveis.OperacaoEmAndamento.TempoDecorridoSegs);
|
||||
_Reservatorio?.AtualizarAgitadorCalda(pControle?.AtuAgitadorModo ?? ModoAgitadorCalda.SemAgitacao);
|
||||
_Trajetoria?.AtualizarDadosAutonomiaCorredor();
|
||||
|
||||
//var sIMU = LivoxManagerProcess.DadosLeitura.imu;
|
||||
|
|
@ -2728,7 +2741,6 @@ namespace AgroBase.Models
|
|||
Iniciados = _DispAtu.Dados.Sensores.Select(s => new { s.ID, s.Inicializado }).Union(_DispAtu.Dados.BicosPulverizadores.Select(b => new { b.ID, b.Inicializado })).Union(_DispAtu.Dados.BombasPressurizadoras.Select(b => new { b.ID, b.Inicializado })).ToDictionary(x => x.ID, x => x.Inicializado),
|
||||
AnguloBarraEsquerda = _DispAtu.Dados.AnguloBarraEsquerda,
|
||||
AnguloBarraDireita = _DispAtu.Dados.AnguloBarraDireita,
|
||||
AnguloBarraAltura = _DispAtu.Dados.AnguloBarraAltura,
|
||||
UltimoComandoRespondido = _DispAtu.Dados.DadosLeitura?.UltimoComandoRespondido ?? DateTime.MinValue,
|
||||
LPorMetro = _Reservatorio.LPorMetro,
|
||||
LPorMinuto = _Reservatorio.LPorMinuto,
|
||||
|
|
@ -2868,7 +2880,7 @@ namespace AgroBase.Models
|
|||
|
||||
var dadosGps = GPSService.UltimaLeitura.Clone();
|
||||
|
||||
var dadosControle = _Controle.Clone();
|
||||
var dadosControle = _Controle?.Clone();
|
||||
|
||||
var dadosPerformance = Variaveis.OperacaoEmAndamento.DadosPerformance.Clone();
|
||||
|
||||
|
|
@ -3036,7 +3048,6 @@ namespace AgroBase.Models
|
|||
public double VolumeVazaoMl { get; set; }
|
||||
public double AnguloBarraEsquerda { get; set; }
|
||||
public double AnguloBarraDireita { get; set; }
|
||||
public double AnguloBarraAltura { get; set; }
|
||||
public double LPorMetro { get; set; }
|
||||
public double LPorMinuto { get; set; }
|
||||
public double TempoEstimadoRestanteMinutos { get; set; }
|
||||
|
|
@ -3072,7 +3083,6 @@ namespace AgroBase.Models
|
|||
VolumeVazaoMl = VolumeVazaoMl,
|
||||
AnguloBarraEsquerda = AnguloBarraEsquerda,
|
||||
AnguloBarraDireita = AnguloBarraDireita,
|
||||
AnguloBarraAltura = AnguloBarraAltura,
|
||||
BombaCavitada = BombaCavitada,
|
||||
Iniciados = new Dictionary<string, bool>(Iniciados ?? new Dictionary<string, bool>()),
|
||||
UltimoComandoRespondido = UltimoComandoRespondido,
|
||||
|
|
|
|||
|
|
@ -352,6 +352,20 @@ namespace AgroBase.Models.Operacoes
|
|||
}
|
||||
}
|
||||
|
||||
private ModoAgitadorCalda _atuAgitadorModo;
|
||||
public ModoAgitadorCalda AtuAgitadorModo
|
||||
{
|
||||
get => _atuAgitadorModo;
|
||||
set
|
||||
{
|
||||
if (_atuAgitadorModo != value)
|
||||
{
|
||||
_atuAgitadorModo = value;
|
||||
OnPropertyChanged(nameof(AtuAgitadorModo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double _atuPressaoLinha;
|
||||
public double AtuPressaoLinha
|
||||
{
|
||||
|
|
@ -595,7 +609,6 @@ namespace AgroBase.Models.Operacoes
|
|||
Iniciado = dAtu?.Conectado ?? false,
|
||||
Latencia = dAtu?.DadosLeitura?.LatenciaLoop ?? 0,
|
||||
|
||||
AnguloBarraAltura = sen?.Atuador?.AnguloBarraAltura ?? 0,
|
||||
AnguloBarraDireita = sen?.Atuador?.AnguloBarraDireita ?? 0,
|
||||
AnguloBarraEsquerda = sen?.Atuador?.AnguloBarraEsquerda ?? 0,
|
||||
CapacidadeReservatorio = sen?.Atuador?.CapacidadeReservatorio ?? 0,
|
||||
|
|
@ -643,7 +656,10 @@ namespace AgroBase.Models.Operacoes
|
|||
Inicializado = x.Inicializado,
|
||||
ComandoEstado = x.ComandoAtuar,
|
||||
LeituraEstado = x._EstadoLeitura == Estado.Ligado,
|
||||
Potencia = x._Potencia,
|
||||
ComandoPressao = x.PressaoSP,
|
||||
LeituraPressao = x._PressaoAtual,
|
||||
ComandoPotencia = x.PotenciaSP,
|
||||
LeituraPotencia = x._Potencia,
|
||||
TempoAtuado = dAtu?.TempoAtuado ?? 0,
|
||||
UltimoComandoRespondido = x.UltimaLeitura,
|
||||
}).ToList(),
|
||||
|
|
@ -956,7 +972,6 @@ namespace AgroBase.Models.Operacoes
|
|||
|
||||
public double AnguloBarraEsquerda { get; set; }
|
||||
public double AnguloBarraDireita { get; set; }
|
||||
public double AnguloBarraAltura { get; set; }
|
||||
|
||||
public List<OperacaoParametrosDadosBicoModel> Bicos { get; set; }
|
||||
public List<OperacaoParametrosDadosBombaModel> Bombas { get; set; }
|
||||
|
|
@ -974,8 +989,11 @@ namespace AgroBase.Models.Operacoes
|
|||
public bool Inicializado { get; set; }
|
||||
public bool ComandoEstado { get; set; }
|
||||
public bool LeituraEstado { get; set; }
|
||||
public double ComandoPressao { get; set; }
|
||||
public double LeituraPressao { get; set; }
|
||||
public double TempoAtuado { get; set; }
|
||||
public double Potencia { get; set; }
|
||||
public double ComandoPotencia { get; set; }
|
||||
public double LeituraPotencia { get; set; }
|
||||
public DateTime UltimoComandoRespondido { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ namespace AgroBase.Models
|
|||
public static double ComprimentoBarraPulverizadoraCm { get; set; } = 103.7;
|
||||
public static double DistanciaEntreBicosCm { get; set; } = 50;
|
||||
public static double DensidadeHerbicida { get; set; } = 1.0;
|
||||
public static double CapacidadeReservatorio { get; set; } = 30;
|
||||
public static double CapacidadeReservatorio { get; set; } = 60;
|
||||
public static double PressaoMinimaCavitacao { get; set; } = 30.0;
|
||||
public static double ReducaoDirecional { get; set; } = 20.0;
|
||||
public static double PercentualVelMin
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using AgroBase.Models;
|
||||
using AgroBase.Models.Modules;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static AgroBase.Models.Enums;
|
||||
|
|
@ -147,6 +148,7 @@ namespace AgroBase.Services
|
|||
private bool _inicializado;
|
||||
|
||||
private SensorModel SensorMassaReservatorio => Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.Sensores?.FirstOrDefault(x => x.Componente == S_Code.sMAS && x.ID == "MASRS");
|
||||
public AtuadorBombaModel AgitadorCalda => Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.BombasPressurizadoras?.FirstOrDefault(x => x.ID == "AGTCLD");
|
||||
public bool PulverizadorLiberado { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -170,7 +172,7 @@ namespace AgroBase.Services
|
|||
double massaLida_Kg_bruto = SensorMassaReservatorio?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.LeituraBruta)?.atual?.valor ?? 0;
|
||||
|
||||
double.TryParse(SensorMassaReservatorio.Parametros.FirstOrDefault(x => x.Descricao == "Offset")?.Valor ?? "0", out double offset);
|
||||
double massa_calc = (massaLida_Kg_bruto * -1) + offset;
|
||||
double massa_calc = (massaLida_Kg_bruto * 1) + offset;
|
||||
|
||||
double volumeMedido_L = massa_calc / DensidadeProduto;
|
||||
int qtd_atuacoes = Variaveis.OperacaoEmAndamento.Controle?.Bicos?.Sum(x => x.Atuacoes) ?? 0;
|
||||
|
|
@ -359,6 +361,129 @@ namespace AgroBase.Services
|
|||
_somaTempoJanela_s = 0;
|
||||
_somaVolumeTempoJanela_L = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private bool _agitadorIntermitenteLigado = false;
|
||||
private DateTime _agitadorUltimaTroca = DateTime.MinValue;
|
||||
private bool _agitadorOperacaoAtivaAnterior = false;
|
||||
private DateTime _agitadorBoostAte = DateTime.MinValue;
|
||||
|
||||
private double AtuAgitadorPotenciaBoost = 100;
|
||||
private double AtuAgitadorPotenciaContinua = 60;
|
||||
private double AtuAgitadorPotenciaIntermitente = 100;
|
||||
private double AtuAgitadorPotenciaManutencao = 80;
|
||||
private int AtuAgitadorTempoLigadoMs = 30000;
|
||||
private int AtuAgitadorTempoDesligadoMs = 30000;
|
||||
private int AtuAgitadorBoostRetomadaMs = 15000;
|
||||
|
||||
|
||||
private double PotenciaLimitePorNivel(double nivelPct)
|
||||
{
|
||||
if (nivelPct <= 5) return 0;
|
||||
if (nivelPct <= 15) return 55;
|
||||
if (nivelPct <= 30) return 65;
|
||||
if (nivelPct <= 60) return 75;
|
||||
return 100;
|
||||
}
|
||||
|
||||
public void AtualizarAgitadorCalda(ModoAgitadorCalda modo)
|
||||
{
|
||||
if (!(AgitadorCalda?.Inicializado ?? false))
|
||||
return;
|
||||
|
||||
var controle = Variaveis.OperacaoEmAndamento?.Parametros?.Controle;
|
||||
if (controle == null)
|
||||
{
|
||||
AgitadorCalda.PotenciaSP = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
bool operacaoIniciada = Variaveis.OperacaoEmAndamento?.Iniciado ?? false;
|
||||
bool pausado = Variaveis.OperacaoEmAndamento?.Pausa ?? false;
|
||||
|
||||
bool operacaoAtiva = operacaoIniciada && !pausado;
|
||||
|
||||
bool bicosAtuando =
|
||||
Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.BicosPulverizadores?
|
||||
.Any(x => x.Comandar && x.ComandoAtuar) ?? false;
|
||||
|
||||
double potenciaFinal = 0;
|
||||
DateTime agora = DateTime.Now;
|
||||
|
||||
// Boost ao iniciar/retomar operação
|
||||
if (operacaoAtiva && !_agitadorOperacaoAtivaAnterior)
|
||||
{
|
||||
_agitadorBoostAte = agora.AddMilliseconds(AtuAgitadorBoostRetomadaMs);
|
||||
_agitadorUltimaTroca = agora;
|
||||
_agitadorIntermitenteLigado = true;
|
||||
}
|
||||
|
||||
bool emBoost = agora < _agitadorBoostAte;
|
||||
|
||||
switch (modo)
|
||||
{
|
||||
case ModoAgitadorCalda.SemAgitacao:
|
||||
potenciaFinal = 0;
|
||||
break;
|
||||
|
||||
case ModoAgitadorCalda.Continuo:
|
||||
if (operacaoAtiva)
|
||||
{
|
||||
if (emBoost)
|
||||
potenciaFinal = AtuAgitadorPotenciaBoost;
|
||||
else if (bicosAtuando)
|
||||
potenciaFinal = AtuAgitadorPotenciaContinua;
|
||||
else
|
||||
potenciaFinal = AtuAgitadorPotenciaManutencao;
|
||||
}
|
||||
else
|
||||
{
|
||||
potenciaFinal = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case ModoAgitadorCalda.Intermitente:
|
||||
if (!operacaoAtiva)
|
||||
{
|
||||
potenciaFinal = 0;
|
||||
_agitadorIntermitenteLigado = true;
|
||||
_agitadorUltimaTroca = agora;
|
||||
}
|
||||
else if (emBoost)
|
||||
{
|
||||
potenciaFinal = AtuAgitadorPotenciaBoost;
|
||||
}
|
||||
else
|
||||
{
|
||||
int tempoAtualMs = _agitadorIntermitenteLigado
|
||||
? AtuAgitadorTempoLigadoMs
|
||||
: AtuAgitadorTempoDesligadoMs;
|
||||
|
||||
if ((agora - _agitadorUltimaTroca).TotalMilliseconds >= tempoAtualMs)
|
||||
{
|
||||
_agitadorIntermitenteLigado = !_agitadorIntermitenteLigado;
|
||||
_agitadorUltimaTroca = agora;
|
||||
}
|
||||
|
||||
potenciaFinal = _agitadorIntermitenteLigado
|
||||
? AtuAgitadorPotenciaIntermitente
|
||||
: 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
potenciaFinal = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
potenciaFinal = Math.Min(potenciaFinal, PotenciaLimitePorNivel(PercentualAtual));
|
||||
potenciaFinal = FuncoesMatematicas.Clamp(potenciaFinal, 0, 100);
|
||||
|
||||
AgitadorCalda.PotenciaSP = potenciaFinal;
|
||||
_agitadorOperacaoAtivaAnterior = operacaoAtiva;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ namespace AgroBase.Services.Operadores
|
|||
),
|
||||
("Atuador", new
|
||||
{
|
||||
pressao_linha_regular = _Sensoriamento.Atuador?.PressaoLinha >= ((Variaveis.OperacaoEmAndamento.Parametros.Controle?.AtuPressaoLinha ?? 0) - 20),
|
||||
pressao_linha = _Sensoriamento.Atuador?.PressaoLinha ?? 0,
|
||||
potencia_bomba = _Sensoriamento.Atuador?.LeituraPotenciaBomba ?? 0,
|
||||
estado_bomba = _Sensoriamento.Atuador?.LeituraComandoBomba ?? false,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
try:
|
||||
agora = time.time()
|
||||
motivos_gerais = []
|
||||
saude_mandatorios = 0
|
||||
total_mandatorios = 0
|
||||
saude_total = 0
|
||||
total_ativos = 0
|
||||
saude_individual = []
|
||||
|
|
@ -35,6 +37,8 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
|
||||
sensor_massa_em_uso = False
|
||||
sensor_massa_conectado = False
|
||||
sensor_pressao_em_uso = False
|
||||
sensor_pressao_conectado = False
|
||||
|
||||
sensores_ativos = dados_atu.get("sensores", {}).get("ativos", [])
|
||||
for key in sensores_ativos:
|
||||
|
|
@ -43,8 +47,6 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
dados_sensor = sensores_tipo.get(sensor_id)
|
||||
if not dados_sensor:
|
||||
continue
|
||||
#for tipo, sensores in dados_atu.get("sensores", {}).items():
|
||||
# for sensor_id, dados_sensor in sensores.items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
@ -55,6 +57,9 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
if dados_sensor.get("label") == "MASRS":
|
||||
sensor_massa_em_uso = mandatorio and aferir
|
||||
sensor_massa_conectado = conectado
|
||||
elif dados_sensor.get("label") == "PRSLN":
|
||||
sensor_pressao_em_uso = mandatorio and aferir
|
||||
sensor_pressao_conectado = conectado
|
||||
if not conectado:
|
||||
saude = 0
|
||||
motivos.append(f"desconectado")
|
||||
|
|
@ -95,9 +100,12 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
"em_uso": aferir
|
||||
}
|
||||
saude_individual.append(saude_mod)
|
||||
if mandatorio:
|
||||
if aferir:
|
||||
total_ativos += 1
|
||||
saude_total += saude
|
||||
if mandatorio:
|
||||
total_mandatorios += 1
|
||||
saude_mandatorios += saude
|
||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||
dados_sensor["saude"] = saude_mod
|
||||
|
||||
|
|
@ -108,9 +116,6 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
dados_bico = bicos_tipo.get(bico_id)
|
||||
if not dados_bico:
|
||||
continue
|
||||
|
||||
#for tipo, bicos in dados_atu.get("bicos", {}).items():
|
||||
# for bico_id, dados_bico in bicos.items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
@ -158,9 +163,12 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
"em_uso": comandar
|
||||
}
|
||||
saude_individual.append(saude_mod)
|
||||
if mandatorio:
|
||||
if comandar:
|
||||
total_ativos += 1
|
||||
saude_total += saude
|
||||
if mandatorio:
|
||||
total_mandatorios += 1
|
||||
saude_mandatorios += saude
|
||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||
dados_bico["saude"] = saude_mod
|
||||
|
||||
|
|
@ -171,8 +179,6 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
dados_bomba = bombas_tipo.get(bomba_id)
|
||||
if not dados_bomba:
|
||||
continue
|
||||
#for tipo, bombas in dados_atu.get("bombas", {}).items():
|
||||
# for bomba_id, dados_bomba in bombas.items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
@ -220,72 +226,15 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
"em_uso": comandar
|
||||
}
|
||||
saude_individual.append(saude_mod)
|
||||
if mandatorio:
|
||||
if comandar:
|
||||
total_ativos += 1
|
||||
saude_total += saude
|
||||
if mandatorio:
|
||||
total_mandatorios += 1
|
||||
saude_mandatorios += saude
|
||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||
dados_bomba["saude"] = saude_mod
|
||||
|
||||
servos_ativos = dados_atu.get("servos", {}).get("ativos", [])
|
||||
for key in servos_ativos:
|
||||
tipo, servo_id = key.split(".")
|
||||
servos_tipo = dados_atu.get("servos", {}).get(tipo, {})
|
||||
dados_servo = servos_tipo.get(servo_id)
|
||||
if not dados_servo:
|
||||
continue
|
||||
#for servo_id, dados_servo in dados_atu.get("servos", {}).items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
controlar = dados_servo.get("controlar", False)
|
||||
conectado = dados_servo.get("conectado", False)
|
||||
mandatorio = dados_servo.get("mandatorio", False) if atu_mandatorio else False
|
||||
if not conectado:
|
||||
saude = 0
|
||||
motivos.append(f"desconectado")
|
||||
else:
|
||||
for dado in dados_servo.get("dados", {}):
|
||||
label = dado.get("label")
|
||||
if label is None:
|
||||
continue
|
||||
freq = dado.get("freq", 0.0)
|
||||
if freq == 0:
|
||||
saude = 0
|
||||
motivos.append(f"{label} sem resposta (freq = 0 Hz)")
|
||||
else:
|
||||
penalidade = penalizar_frequencia(freq, FREQ_BASE, FREQ_MIN, (100 - SAUDE_MIN_ALERTA))
|
||||
saude -= penalidade
|
||||
if freq <= FREQ_MIN:
|
||||
motivos.append(f"{label} frequência baixa ({freq:.2f}/{FREQ_BASE} Hz, penalidade {penalidade}%)")
|
||||
|
||||
if label == "ServoAnguloLeitura":
|
||||
angulo = dado.get("atual", 0.0)
|
||||
angulo_sp = dados_servo.get("angulo_sp", 0.0)
|
||||
erro = abs(angulo - angulo_sp)
|
||||
if erro > 0:
|
||||
condicoes_operacionais.append({
|
||||
"valor": angulo,
|
||||
"severidade": erro,
|
||||
"descricao": f"{label} fora do padrão"
|
||||
})
|
||||
saude = max(0, saude)
|
||||
chave = f"servo_{servo_id}"
|
||||
saude_mod = {
|
||||
"id": servo_id,
|
||||
"label": dados_servo.get("label"),
|
||||
"status": (StatusModulo.DESCONECTADO if not conectado else StatusModulo.OPERANTE if saude >= SAUDE_MIN_ALERTA else StatusModulo.ALERTA if saude > 0 else StatusModulo.FALHA).value,
|
||||
"saude": saude,
|
||||
"motivos": motivos,
|
||||
"condicoes_operacionais": condicoes_operacionais,
|
||||
"em_uso": controlar
|
||||
}
|
||||
saude_individual.append(saude_mod)
|
||||
if mandatorio:
|
||||
total_ativos += 1
|
||||
saude_total += saude
|
||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||
dados_servo["saude"] = saude_mod
|
||||
|
||||
|
||||
cond_op_mod = []
|
||||
penalidade_percentual_herbicida = 0
|
||||
|
|
@ -323,8 +272,30 @@ class ModuloAtuador(ModuloDiagnosticoBase):
|
|||
"descricao": f"Sensor do nível do reservatório desconectado!"
|
||||
})
|
||||
|
||||
saude_final = (saude_total // total_ativos) if total_ativos > 0 else 0
|
||||
saude_final = saude_final - penalidade_percentual_herbicida
|
||||
penalidade_pressao_baixa = 0
|
||||
if sensor_pressao_em_uso:
|
||||
if sensor_pressao_conectado:
|
||||
_contexto = ContextoGlobalRedis.get_contexto()
|
||||
pressao_linha = _contexto.get("Atuador", {}).get("pressao_linha", 0)
|
||||
pressao_linha_ok = _contexto.get("Atuador", {}).get("pressao_linha_regular", False)
|
||||
if not pressao_linha_ok:
|
||||
penalidade_percentual_herbicida = 50
|
||||
cond_op_mod.append({
|
||||
"valor": pressao_linha,
|
||||
"severidade": 50,
|
||||
"descricao": f"Pressão da linha abaixo do esperado!"
|
||||
})
|
||||
else:
|
||||
cond_op_mod.append({
|
||||
"valor": 0,
|
||||
"severidade": 100,
|
||||
"descricao": f"Sensor de pressão da linha desconectado!"
|
||||
})
|
||||
|
||||
|
||||
saude_final = (saude_mandatorios // total_mandatorios) if total_mandatorios > 0 else 100
|
||||
saude_final_ativos = (saude_total // total_ativos) if total_ativos > 0 else 0
|
||||
saude_final = saude_final_ativos - penalidade_percentual_herbicida
|
||||
|
||||
status = StatusModulo.OPERANTE
|
||||
if not mod_conectado:
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
|||
dados_sensor = sensores_tipo.get(sensor_id)
|
||||
if not dados_sensor:
|
||||
continue
|
||||
#for tipo, sensores in dados_sen.get("sensores", {}).items():
|
||||
# for sensor_id, dados_sensor in sensores.items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
@ -113,7 +111,6 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
|||
dados_servo = servos_tipo.get(servo_id)
|
||||
if not dados_servo:
|
||||
continue
|
||||
#for servo_id, dados_servo in dados_sen.get("servos", {}).items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
@ -176,7 +173,6 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
|||
dados_rele = reles_tipo.get(rele_id)
|
||||
if not dados_rele:
|
||||
continue
|
||||
#for rele_id, dados_rele in dados_sen.get("reles", {}).items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
@ -229,7 +225,6 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
|||
dados_led = leds_tipo.get(led_id)
|
||||
if not dados_led:
|
||||
continue
|
||||
#for led_id, dados_led in dados_sen.get("sinaleiros", {}).items():
|
||||
saude = 100
|
||||
motivos = []
|
||||
condicoes_operacionais = []
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ namespace OperationControl.Models
|
|||
Variaveis.ControlSenderMov.Update(msg);
|
||||
}
|
||||
|
||||
public static void EnviarComandoAtuador(string componente_id, bool? status = null, int? angulo_controle = null, double? angulo_abertura = null, double? altura = null)
|
||||
public static void EnviarComandoAtuador(string componente_id, bool? status = null, int? angulo_controle = null, double? angulo_abertura = null, double? altura = null, double? potencia = null, double? pressao = null)
|
||||
{
|
||||
EnviarDadosControle(SelectedRoverId, new OperacaoComandoBaseModel()
|
||||
{
|
||||
|
|
@ -530,6 +530,8 @@ namespace OperationControl.Models
|
|||
AnguloSP = angulo_controle,
|
||||
Estado = status,
|
||||
Altura = altura,
|
||||
Potencia = potencia,
|
||||
Pressao = pressao
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,10 +118,24 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
|
|||
BombaPressaoAlvoTexto = $"{value:0} psi";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string _bombaPressaoAlvoTexto = "0 psi";
|
||||
public string BombaPressaoAlvoTexto { get => _bombaPressaoAlvoTexto; set => SetProperty(ref _bombaPressaoAlvoTexto, value); }
|
||||
|
||||
private double _bombaPotenciaAlvo;
|
||||
public double BombaPotenciaAlvo
|
||||
{
|
||||
get => _bombaPotenciaAlvo;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _bombaPotenciaAlvo, value))
|
||||
BombaPotenciaAlvoTexto = $"{value:0} %";
|
||||
}
|
||||
}
|
||||
|
||||
private string _bombaPotenciaAlvoTexto = "0 %";
|
||||
public string BombaPotenciaAlvoTexto { get => _bombaPotenciaAlvoTexto; set => SetProperty(ref _bombaPotenciaAlvoTexto, value); }
|
||||
|
||||
private string _txtBombaComando = "—";
|
||||
public string TxtBombaComando { get => _txtBombaComando; set => SetProperty(ref _txtBombaComando, value); }
|
||||
|
||||
|
|
@ -569,11 +583,12 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
|
|||
BombaTitulo = $"Bomba {_itemAtual.LabelModulo} - Testes";
|
||||
TxtBombaComando = bomba?.ComandoEstado ?? false ? "Ligado" : "Desligado";
|
||||
TxtBombaStatusReal = bomba?.LeituraEstado ?? false ? "Ligado" : "Desligado";
|
||||
TxtBombaPressaoLinha = $"{rover?.Atuador?.PressaoLinhaPsi ?? 0:0.##} psi";
|
||||
TxtBombaPotencia = $"{bomba?.Potencia ?? 0:0.#} %";
|
||||
TxtBombaPressaoLinha = $"{bomba?.LeituraPressao ?? 0:0.##} psi";
|
||||
TxtBombaPotencia = $"{bomba?.LeituraPotencia ?? 0:0.#} %";
|
||||
if (clicado)
|
||||
{
|
||||
BombaPressaoAlvo = bomba?.Potencia ?? 0;
|
||||
BombaPotenciaAlvo = bomba?.ComandoPotencia ?? 0;
|
||||
BombaPressaoAlvo = bomba?.ComandoPressao ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -697,6 +712,7 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
|
|||
BarraAltura = 0;
|
||||
BicoAngulo = 0;
|
||||
BicoAnguloAbertura = 0;
|
||||
BombaPotenciaAlvo = 0;
|
||||
BombaPressaoAlvo = 0;
|
||||
DirAngulo = 0;
|
||||
GpsLeverArmLateral = 0;
|
||||
|
|
@ -765,7 +781,7 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
|
|||
private void BombaLigar()
|
||||
{
|
||||
if (_itemAtual?.Modulo != T_Code.Atu || _itemAtual.SCode != S_Code.sBMB) return;
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, status: true);
|
||||
VariaveisControleOperacao.EnviarComandoAtuador(_itemAtual.LabelModulo, status: true, potencia: BombaPotenciaAlvo, pressao: BombaPressaoAlvo);
|
||||
}
|
||||
|
||||
private void BombaDesligar()
|
||||
|
|
|
|||
|
|
@ -717,8 +717,8 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico
|
|||
case S_Code.sBMB:
|
||||
var bomba = rover.Atuador?.Bombas?.FirstOrDefault(x => x.ID == item.LabelModulo);
|
||||
AddOrAppendSerie("Cmd", "", bomba?.ComandoEstado ?? false ? 100 : 0);
|
||||
AddOrAppendSerie("Potência", "%", bomba?.Potencia);
|
||||
AddOrAppendSerie("Pressão", "psi", rover.Atuador?.PressaoLinhaPsi);
|
||||
AddOrAppendSerie("Potência", "%", bomba?.LeituraPotencia);
|
||||
AddOrAppendSerie("Pressão", "psi", bomba?.ComandoPressao);
|
||||
break;
|
||||
|
||||
case S_Code.sPRS:
|
||||
|
|
|
|||
|
|
@ -135,13 +135,7 @@
|
|||
</Border>
|
||||
|
||||
<!-- COLUNA DIREITA | DETALHES -->
|
||||
<Border Grid.Column="1"
|
||||
Margin="10,0,0,0"
|
||||
Padding="16"
|
||||
CornerRadius="10"
|
||||
Background="#202020"
|
||||
BorderBrush="#353535"
|
||||
BorderThickness="1">
|
||||
<Border Grid.Column="1" Margin="10,0,0,0" Padding="16" CornerRadius="10" Background="#202020" BorderBrush="#353535" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
|
@ -152,26 +146,13 @@
|
|||
|
||||
<!-- TÍTULO -->
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock Text="{Binding TituloModuloSelecionado}"
|
||||
FontSize="18"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#E6E6E6"/>
|
||||
<TextBlock Text="{Binding TituloModuloSelecionado}" FontSize="18" FontWeight="SemiBold" Foreground="#E6E6E6"/>
|
||||
|
||||
<TextBlock Text="{Binding DescricaoModuloSelecionado}"
|
||||
Margin="0,6,0,0"
|
||||
FontSize="12"
|
||||
Foreground="#A8A8A8"
|
||||
TextWrapping="Wrap"/>
|
||||
<TextBlock Text="{Binding DescricaoModuloSelecionado}" Margin="0,6,0,0" FontSize="12" Foreground="#A8A8A8" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- RESUMO -->
|
||||
<Border Grid.Row="1"
|
||||
Margin="0,14,0,12"
|
||||
Padding="12"
|
||||
Background="#181818"
|
||||
BorderBrush="#2F2F2F"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Border Grid.Row="1" Margin="0,14,0,12" Padding="12" Background="#181818" BorderBrush="#2F2F2F" BorderThickness="1" CornerRadius="8">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
|
@ -222,49 +203,24 @@
|
|||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Grid.Row="3"
|
||||
Text="{Binding ImpedimentoModuloSelecionado}"
|
||||
Foreground="#C8C8C8"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"/>
|
||||
<TextBlock Grid.Row="3" Text="{Binding ImpedimentoModuloSelecionado}" Foreground="#C8C8C8" FontSize="12" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- AÇÕES -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,0,0,12">
|
||||
<CheckBox Content="Mandatório"
|
||||
Margin="0,0,14,0"
|
||||
Foreground="#D8D8D8"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding MandatorioSelecionado, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Mandatório" Margin="0,0,14,0" Foreground="#D8D8D8" VerticalAlignment="Center" IsChecked="{Binding MandatorioSelecionado, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Content="Em uso"
|
||||
Margin="0,0,14,0"
|
||||
Foreground="#D8D8D8"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding EmUsoSelecionado, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Em uso" Margin="0,0,14,0" Foreground="#D8D8D8" VerticalAlignment="Center" IsChecked="{Binding EmUsoSelecionado, Mode=TwoWay}"/>
|
||||
|
||||
<Button Content="Salvar"
|
||||
Width="80"
|
||||
Height="28"
|
||||
Background="#2E5C8A"
|
||||
Foreground="White"
|
||||
BorderBrush="#4F7EAD"
|
||||
Command="{Binding SalvarSaudeCommand}"/>
|
||||
<Button Content="Salvar" Width="80" Height="28" Background="#2E5C8A" Foreground="White" BorderBrush="#4F7EAD" Command="{Binding SalvarSaudeCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- TABS -->
|
||||
<TabControl Grid.Row="3"
|
||||
Background="#181818"
|
||||
BorderBrush="#2F2F2F"
|
||||
Foreground="#DDDDDD">
|
||||
<TabControl Grid.Row="3" Background="#181818" BorderBrush="#2F2F2F" Foreground="#DDDDDD">
|
||||
<TabItem Header="Condições Operacionais">
|
||||
<Grid Background="#181818">
|
||||
<ListBox ItemsSource="{Binding CondicoesOperacionais}"
|
||||
Margin="8"
|
||||
Background="#121212"
|
||||
Foreground="#DDDDDD"
|
||||
BorderBrush="#2D2D2D"/>
|
||||
<ListBox ItemsSource="{Binding CondicoesOperacionais}" Margin="8" Background="#121212" Foreground="#DDDDDD" BorderBrush="#2D2D2D"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
|
@ -276,17 +232,9 @@
|
|||
|
||||
<TabItem Header="Opções">
|
||||
<Grid Background="#181818">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Padding="8">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="8">
|
||||
<Grid>
|
||||
<TextBlock Text="Nenhum teste disponível para este módulo."
|
||||
FontSize="12"
|
||||
Foreground="#A8A8A8"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding OpcoesVM.MostrarOpcoesSemDados, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
<TextBlock Text="Nenhum teste disponível para este módulo." FontSize="12" Foreground="#A8A8A8" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" Visibility="{Binding OpcoesVM.MostrarOpcoesSemDados, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
|
||||
<StackPanel Visibility="{Binding OpcoesVM.MostrarOpcoesSensoriamento, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
|
|
@ -382,6 +330,11 @@
|
|||
<Slider Width="120" Minimum="0" Maximum="150" Margin="0,0,5,0" Value="{Binding OpcoesVM.BombaPressaoAlvo, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding OpcoesVM.BombaPressaoAlvoTexto}" VerticalAlignment="Center" FontSize="10" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="172 5 0 0">
|
||||
<TextBlock Text="Potencia alvo:" VerticalAlignment="Center" Margin="0,0,5,0" FontSize="10" Foreground="#DDDDDD"/>
|
||||
<Slider Width="120" Minimum="0" Maximum="100" Margin="0,0,5,0" Value="{Binding OpcoesVM.BombaPotenciaAlvo, Mode=TwoWay}"/>
|
||||
<Label Content="{Binding OpcoesVM.BombaPotenciaAlvoTexto}" VerticalAlignment="Center" FontSize="10" Foreground="#DDDDDD"/>
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="2" Columns="2" Margin="0,10,0,0">
|
||||
<Border BorderBrush="#444" BorderThickness="1" Margin="2" Padding="4">
|
||||
|
|
|
|||
|
|
@ -3,10 +3,22 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:local="clr-namespace:OperationControl.Views.Operacao"
|
||||
xmlns:enums="clr-namespace:AgroBase.Models;assembly=AgroBase"
|
||||
mc:Ignorable="d" >
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<ObjectDataProvider x:Key="ModoOperacaoValues" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="enums:Enums+ModoOperacao"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
<ObjectDataProvider x:Key="ModoAgitadorCaldaValues" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="enums:Enums+ModoAgitadorCalda"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
|
|
@ -69,7 +81,7 @@
|
|||
<TextBlock Text="Operação" Foreground="White" FontSize="15" FontWeight="SemiBold" Margin="0,0,0,12"/>
|
||||
|
||||
<TextBlock Text="Modo" Style="{StaticResource ParamLabelStyle}"/>
|
||||
<ComboBox ItemsSource="{Binding ModosOperacaoDisponiveis}" SelectedItem="{Binding Parametros.Modo, Mode=TwoWay}" SelectionChanged="cmbModoOperacao_SelectionChanged" />
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource ModoOperacaoValues}}" SelectedItem="{Binding Parametros.Modo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectionChanged="cmbModoOperacao_SelectionChanged" />
|
||||
<TextBlock Text="Descrição" Style="{StaticResource ParamLabelStyle}"/>
|
||||
<TextBox Text="{Binding Parametros.Descricao}" Style="{StaticResource ParamTextBoxStyle}" Margin="0,0,0,0"/>
|
||||
<Button Content="Reiniciar Operação" Command="{Binding ReiniciarOperacaoCommand}" Visibility="{Binding OperacaoConcluida, Converter={StaticResource BoolToVisibilityConverter}}" Margin="0,10,0,0" Height="36"/>
|
||||
|
|
@ -136,6 +148,9 @@
|
|||
|
||||
<CheckBox Content="Automático" IsChecked="{Binding Parametros.Controle.PulverizadorAutomatico}" Style="{StaticResource ParamCheckBoxStyle}"/>
|
||||
|
||||
<TextBlock Text="Agitador Calda Modo" Style="{StaticResource ParamLabelStyle}"/>
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource ModoAgitadorCaldaValues}}" SelectedItem="{Binding Parametros.Controle.AtuAgitadorModo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<TextBlock Text="Quantidade de Bicos" Style="{StaticResource ParamLabelStyle}"/>
|
||||
<TextBox Text="{Binding Parametros.QtdBicos, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource ParamTextBoxStyle}"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ namespace OperationControl.Windows
|
|||
{
|
||||
Label = "Potência",
|
||||
Unidade = "%",
|
||||
Valor = bb?.Potencia
|
||||
Valor = bb?.LeituraPotencia
|
||||
},
|
||||
new GraficoModel.GraficoParametrosModel()
|
||||
{
|
||||
|
|
@ -1160,7 +1160,7 @@ namespace OperationControl.Windows
|
|||
var bomba = rover?.Atuador?.Bombas?.FirstOrDefault(x => x.ID == label);
|
||||
bool comando = bomba?.ComandoEstado ?? false;
|
||||
bool leitura = bomba?.LeituraEstado ?? false;
|
||||
var potencia = bomba?.Potencia ?? 0;
|
||||
var potencia = bomba?.LeituraPotencia ?? 0;
|
||||
txtBomba_Comando.Text = comando ? "Ligado" : "Desligado";
|
||||
txtBomba_StatusReal.Text = leitura ? "Ligado" : "Desligado";
|
||||
txtBomba_PressaoLinha.Text = $"{rover?.Atuador?.PressaoLinhaPsi ?? 0:2F} psi";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Dispositivo: Atuador
|
||||
// Versão Firmware: 13
|
||||
// Ultima atualização: 20/03/2026
|
||||
// Ultima atualização: 02/04/2026
|
||||
// Atualização: Firmware mock
|
||||
|
||||
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\SerialService.h"
|
||||
|
|
@ -72,13 +72,11 @@ SensorMassa_v2* ObterMassaPorId(uint8_t idNum) {
|
|||
#pragma region MAGNETICO
|
||||
SensorMagnetico_v2 sMAG_Esquerdo("MAGDIR", 41, 0x36, 1);
|
||||
SensorMagnetico_v2 sMAG_Direito("MAGESQ", 42, 0x36, 2);
|
||||
SensorMagnetico_v2 sMAG_Altura("MAGALT", 43, 0x36, 3);
|
||||
|
||||
SensorMagnetico_v2* ObterSensorMagneticoPorId(uint8_t idNum) {
|
||||
switch (idNum) {
|
||||
case 41: return &sMAG_Esquerdo;
|
||||
case 42: return &sMAG_Direito;
|
||||
case 43: return &sMAG_Altura;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -144,7 +142,6 @@ void setup() {
|
|||
sMAS_Reservatorio.Inicializar();
|
||||
sMAG_Esquerdo.Inicializar();
|
||||
sMAG_Direito.Inicializar();
|
||||
sMAG_Altura.Inicializar();
|
||||
sBIC_01.Inicializar();
|
||||
sBIC_02.Inicializar();
|
||||
sBIC_03.Inicializar();
|
||||
|
|
@ -218,7 +215,6 @@ void enviarDadosSensores(uint8_t id_num, CanMessagePosicaoDados posicao) {
|
|||
ComponenteCAN::ProcessarComponenteCAN(sMAS_Reservatorio, {CanMessagePosicaoDados::Dados1}, todosIDs, id_num, enviarStatus, todosDados, posicao, EnviarDadosCAN);
|
||||
ComponenteCAN::ProcessarComponenteCAN(sMAG_Esquerdo, {CanMessagePosicaoDados::Dados1}, todosIDs, id_num, enviarStatus, todosDados, posicao, EnviarDadosCAN);
|
||||
ComponenteCAN::ProcessarComponenteCAN(sMAG_Direito, {CanMessagePosicaoDados::Dados1}, todosIDs, id_num, enviarStatus, todosDados, posicao, EnviarDadosCAN);
|
||||
ComponenteCAN::ProcessarComponenteCAN(sMAG_Altura, {CanMessagePosicaoDados::Dados1}, todosIDs, id_num, enviarStatus, todosDados, posicao, EnviarDadosCAN);
|
||||
|
||||
ComponenteCAN::ProcessarComponenteCAN(sBIC_01, {CanMessagePosicaoDados::Dados1}, todosIDs, id_num, enviarStatus, todosDados, posicao, EnviarDadosCAN);
|
||||
ComponenteCAN::ProcessarComponenteCAN(sBIC_02, {CanMessagePosicaoDados::Dados1}, todosIDs, id_num, enviarStatus, todosDados, posicao, EnviarDadosCAN);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,209 @@
|
|||
#include "SerialService.h"
|
||||
#include "Pinout.h"
|
||||
#include "Utils.h"
|
||||
#include "IComponenteCAN.h"
|
||||
|
||||
#ifndef AgitadorCalda_h
|
||||
#define AgitadorCalda_h
|
||||
|
||||
class AgitadorCalda : public ComponenteCAN {
|
||||
public:
|
||||
AgitadorCalda(
|
||||
const String& id,
|
||||
uint8_t idNum,
|
||||
int pinoIN1,
|
||||
int canalIN1,
|
||||
int pinoIN2,
|
||||
int canalIN2,
|
||||
TiposBarramentos barramento = CONTROLADOR,
|
||||
Sentido sentido = Sentido::Horario
|
||||
)
|
||||
: _ID(id),
|
||||
ID_Num(idNum),
|
||||
_pinoIN1(pinoIN1, barramento, _PWM),
|
||||
_pinoIN2(pinoIN2, barramento, _PWM),
|
||||
_canalIN1(canalIN1),
|
||||
_canalIN2(canalIN2),
|
||||
_sentido(sentido) {
|
||||
}
|
||||
|
||||
String _ID;
|
||||
uint8_t ID_Num = 0;
|
||||
|
||||
PinoModel _pinoIN1;
|
||||
PinoModel _pinoIN2;
|
||||
|
||||
int _canalIN1 = 1;
|
||||
int _canalIN2 = 2;
|
||||
|
||||
Sentido _sentido = Sentido::Horario;
|
||||
|
||||
bool Iniciado = false;
|
||||
|
||||
Estado EstadoLeitura = Estado::Desligado;
|
||||
double PercentualPotenciaLeitura = 0;
|
||||
|
||||
Estado _EstadoControle = Estado::Desligado;
|
||||
double _PotenciaSP = 0;
|
||||
|
||||
void Inicializar() {
|
||||
if (Iniciado) {
|
||||
MostrarLog("Agitador ja inicializado");
|
||||
return;
|
||||
}
|
||||
|
||||
_pinoIN1.Conectar(0);
|
||||
if (_pinoIN1.Definido()) {
|
||||
ledcSetup(_canalIN1, 1000, 10);
|
||||
ledcAttachPin(_pinoIN1.num, _canalIN1);
|
||||
ledcWrite(_canalIN1, 0);
|
||||
}
|
||||
_pinoIN2.Conectar(0);
|
||||
if (_pinoIN2.Definido()) {
|
||||
ledcSetup(_canalIN2, 1000, 10);
|
||||
ledcAttachPin(_pinoIN2.num, _canalIN2);
|
||||
ledcWrite(_canalIN2, 0);
|
||||
}
|
||||
|
||||
Iniciado = _pinoIN1.Definido() && _pinoIN2.Definido();
|
||||
|
||||
if (Iniciado) {
|
||||
_EstadoControle = Estado::Desligado;
|
||||
PercentualPotenciaLeitura = 0;
|
||||
EstadoLeitura = Estado::Desligado;
|
||||
MostrarLog("Agitador de calda iniciado");
|
||||
} else {
|
||||
MostrarLog("Falha ao iniciar agitador");
|
||||
}
|
||||
}
|
||||
|
||||
void Desligar() {
|
||||
if (!Iniciado) {
|
||||
MostrarLog("Agitador nao esta inicializado");
|
||||
return;
|
||||
}
|
||||
|
||||
_EstadoControle = Estado::Desligado;
|
||||
ledcWrite(_canalIN1, 0);
|
||||
ledcWrite(_canalIN2, 0);
|
||||
|
||||
_pinoIN1.Desconectar();
|
||||
_pinoIN2.Desconectar();
|
||||
|
||||
PercentualPotenciaLeitura = 0;
|
||||
EstadoLeitura = Estado::Desligado;
|
||||
Iniciado = false;
|
||||
|
||||
MostrarLog("Agitador desligado");
|
||||
}
|
||||
|
||||
void AtualizarControle(Estado novoEstado, double potenciaSP) {
|
||||
if (!Iniciado) {
|
||||
MostrarLog("Ignorando comando: agitador nao iniciado");
|
||||
return;
|
||||
}
|
||||
|
||||
_EstadoControle = novoEstado;
|
||||
_PotenciaSP = potenciaSP;
|
||||
|
||||
if (_EstadoControle == Estado::Desligado) {
|
||||
AplicarSaida(false, 0);
|
||||
} else {
|
||||
int pwm = int((_PotenciaSP / 100.0) * RampaMax);
|
||||
AplicarSaida(true, pwm);
|
||||
}
|
||||
|
||||
AtualizarLeitura();
|
||||
}
|
||||
|
||||
void RequisitarDados() {
|
||||
AtualizarLeitura();
|
||||
}
|
||||
|
||||
bool ProcessarComando(const std::vector<uint8_t>& data) {
|
||||
if (data.size() < 4) {
|
||||
MostrarLog("Comando invalido");
|
||||
return false;
|
||||
}
|
||||
|
||||
CanMessagePosicaoDados posicao = (CanMessagePosicaoDados)data[0];
|
||||
uint8_t idNum = data[1];
|
||||
|
||||
if (idNum != ID_Num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (posicao) {
|
||||
case CanMessagePosicaoDados::Command1: {
|
||||
Estado novoEstado = (Estado)data[2];
|
||||
double potencia = (double)data[3];
|
||||
AtualizarControle(novoEstado, potencia);
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> MontarMensagemCAN(CanMessagePosicaoDados posicao) {
|
||||
std::vector<uint8_t> data;
|
||||
data.push_back(static_cast<uint8_t>(posicao));
|
||||
data.push_back(ID_Num);
|
||||
|
||||
switch (posicao) {
|
||||
case CanMessagePosicaoDados::Status: {
|
||||
data.push_back(Iniciado ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case CanMessagePosicaoDados::Dados1: {
|
||||
AtualizarLeitura();
|
||||
data.push_back(static_cast<uint8_t>(EstadoLeitura));
|
||||
data.push_back(static_cast<uint8_t>((int)PercentualPotenciaLeitura));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private:
|
||||
bool DebugMode = false;
|
||||
int ZeroRampa = 0;
|
||||
int RampaMax = 1023;
|
||||
|
||||
void AplicarSaida(bool ligado, int pwm) {
|
||||
if (!Iniciado && pwm != 0) return;
|
||||
|
||||
if (!ligado) {
|
||||
pwm = 0;
|
||||
}
|
||||
|
||||
pwm = LimitarPWM(pwm);
|
||||
ledcWrite(_canalIN1, _sentido == Sentido::Horario ? pwm : 0);
|
||||
ledcWrite(_canalIN2, _sentido == Sentido::Horario ? 0 : pwm);
|
||||
}
|
||||
|
||||
int LimitarPWM(int valor) {
|
||||
if (valor < ZeroRampa) return ZeroRampa;
|
||||
if (valor > RampaMax) return RampaMax;
|
||||
return valor;
|
||||
}
|
||||
|
||||
void AtualizarLeitura() {
|
||||
if (!Iniciado) return;
|
||||
|
||||
uint32_t duty = ledcRead(_sentido == Sentido::Horario ? _pinoIN1.num : _pinoIN2.num);
|
||||
PercentualPotenciaLeitura = (duty / (double)RampaMax) * 100.0;
|
||||
EstadoLeitura = (duty > 5) ? Estado::Ligado : Estado::Desligado;
|
||||
}
|
||||
|
||||
void MostrarLog(String mensagem) {
|
||||
if (DebugMode) {
|
||||
PrintTela("[AGT " + _ID + "] " + mensagem);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -18,8 +18,7 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
int canalIN2,
|
||||
TiposBarramentos barramento = CONTROLADOR,
|
||||
Sentido sentido = Sentido::Horario,
|
||||
SensorPressao_v2* sensor = nullptr,
|
||||
int pressaoInicial = 0
|
||||
SensorPressao_v2* sensor = nullptr
|
||||
)
|
||||
: _ID(id),
|
||||
ID_Num(idNum),
|
||||
|
|
@ -28,8 +27,7 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
_canalIN1(canalIN1),
|
||||
_canalIN2(canalIN2),
|
||||
_sentido(sentido),
|
||||
sensorPressao(sensor),
|
||||
_PressaoSP(pressaoInicial) {
|
||||
sensorPressao(sensor) {
|
||||
}
|
||||
|
||||
String _ID;
|
||||
|
|
@ -43,14 +41,6 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
|
||||
Sentido _sentido = Sentido::Horario;
|
||||
|
||||
float _Kp = 3.0;
|
||||
float _Ki = 2.2;
|
||||
float _Kd = 0.5;
|
||||
int histerese = 3;
|
||||
|
||||
int ZeroRampa = 0;
|
||||
int RampaMax = 1023;
|
||||
|
||||
bool Iniciado = false;
|
||||
bool MalhaFechada = false;
|
||||
bool bombaDesligadaPorPressao = false;
|
||||
|
|
@ -58,11 +48,13 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
SensorPressao_v2* sensorPressao = nullptr;
|
||||
|
||||
Estado EstadoLeitura = Estado::Desligado;
|
||||
double PotenciaLeitura = 0;
|
||||
double PWM_SP = 0;
|
||||
double PWM_Set = 0;
|
||||
double PercentualPotenciaLeitura = 0;
|
||||
|
||||
Estado _EstadoControle = Estado::Desligado;
|
||||
double _PressaoSP = 0;
|
||||
double _PotenciaSP = 0;
|
||||
|
||||
void VincularSensorPressao(SensorPressao_v2* sensor) {
|
||||
sensorPressao = sensor;
|
||||
|
|
@ -94,7 +86,8 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
|
||||
if (Iniciado) {
|
||||
_EstadoControle = Estado::Desligado;
|
||||
PotenciaLeitura = 0;
|
||||
PWM_Set = RampaMax;
|
||||
PWM_SP = ZeroRampa;
|
||||
PercentualPotenciaLeitura = 0;
|
||||
EstadoLeitura = Estado::Desligado;
|
||||
bombaDesligadaPorPressao = false;
|
||||
|
|
@ -117,7 +110,8 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
_pinoIN1.Desconectar();
|
||||
_pinoIN2.Desconectar();
|
||||
|
||||
PotenciaLeitura = 0;
|
||||
PWM_Set = ZeroRampa;
|
||||
PWM_SP = ZeroRampa;
|
||||
PercentualPotenciaLeitura = 0;
|
||||
EstadoLeitura = Estado::Desligado;
|
||||
bombaDesligadaPorPressao = false;
|
||||
|
|
@ -126,7 +120,7 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
MostrarLog("Bomba desligada");
|
||||
}
|
||||
|
||||
void AtualizarControle(Estado novoEstado, double pressaoSP = -1) {
|
||||
void AtualizarControle(Estado novoEstado, double potenciaSP = -1, double pressaoSP = -1) {
|
||||
if (!Iniciado) {
|
||||
MostrarLog("Ignorando comando: bomba nao iniciada");
|
||||
return;
|
||||
|
|
@ -134,18 +128,14 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
|
||||
_EstadoControle = novoEstado;
|
||||
|
||||
if (pressaoSP >= 0) {
|
||||
if (potenciaSP >= 0) {
|
||||
_PotenciaSP = constrain(potenciaSP, 0, 100);
|
||||
PWM_Set = int((_PotenciaSP / 100.0) * RampaMax);
|
||||
}
|
||||
|
||||
if (pressaoSP >= 0 && MalhaFechada) {
|
||||
_PressaoSP = pressaoSP;
|
||||
}
|
||||
|
||||
if (_EstadoControle == Estado::Desligado) {
|
||||
bombaDesligadaPorPressao = false;
|
||||
AplicarSaida(false, 0);
|
||||
} else {
|
||||
AplicarSaida(true, PotenciaLeitura);
|
||||
}
|
||||
|
||||
AtualizarLeitura();
|
||||
}
|
||||
|
||||
void Loop() {
|
||||
|
|
@ -153,7 +143,9 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
|
||||
double pressaoAtual = 0;
|
||||
|
||||
if (MalhaFechada && sensorPressao != nullptr) {
|
||||
bool ligado = _EstadoControle == Estado::Ligado;
|
||||
|
||||
if (ligado && MalhaFechada && sensorPressao != nullptr) {
|
||||
sensorPressao->RequisitarDados();
|
||||
pressaoAtual = sensorPressao->Pressao;
|
||||
|
||||
|
|
@ -164,17 +156,17 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
}
|
||||
}
|
||||
|
||||
if (_EstadoControle == Estado::Desligado) {
|
||||
PotenciaLeitura = ZeroRampa;
|
||||
if (!ligado) {
|
||||
PWM_SP = ZeroRampa;
|
||||
} else {
|
||||
if (MalhaFechada) {
|
||||
PotenciaLeitura = bombaDesligadaPorPressao ? ZeroRampa : RampaMax;
|
||||
PWM_SP = bombaDesligadaPorPressao ? ZeroRampa : PWM_Set;
|
||||
} else {
|
||||
PotenciaLeitura = RampaMax;
|
||||
PWM_SP = PWM_Set;
|
||||
}
|
||||
}
|
||||
|
||||
AplicarSaida(_EstadoControle == Estado::Ligado, PotenciaLeitura);
|
||||
AplicarSaida(ligado, PWM_SP);
|
||||
AtualizarLeitura();
|
||||
}
|
||||
|
||||
|
|
@ -198,8 +190,9 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
switch (posicao) {
|
||||
case CanMessagePosicaoDados::Command1: {
|
||||
Estado novoEstado = (Estado)data[2];
|
||||
double pressao = (data.size() > 3) ? (double)data[3] : _PressaoSP;
|
||||
AtualizarControle(novoEstado, pressao);
|
||||
double potencia = (data.size() > 3) ? (double)data[3] : -1;
|
||||
double pressao = (data.size() > 4) ? (double)data[4] : -1;
|
||||
AtualizarControle(novoEstado, potencia, pressao);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -223,6 +216,7 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
case CanMessagePosicaoDados::Dados1: {
|
||||
AtualizarLeitura();
|
||||
data.push_back(static_cast<uint8_t>(EstadoLeitura));
|
||||
data.push_back(static_cast<uint8_t>((int)_PotenciaSP));
|
||||
data.push_back(static_cast<uint8_t>((int)PercentualPotenciaLeitura));
|
||||
data.push_back(static_cast<uint8_t>((int)_PressaoSP));
|
||||
|
||||
|
|
@ -240,6 +234,9 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
|
||||
private:
|
||||
bool DebugMode = false;
|
||||
int histerese = 3;
|
||||
int ZeroRampa = 0;
|
||||
int RampaMax = 1023;
|
||||
|
||||
void AplicarSaida(bool ligado, int pwm) {
|
||||
if (!Iniciado && pwm != 0) return;
|
||||
|
|
@ -262,10 +259,9 @@ class BombaPressurizadora_v2 : public ComponenteCAN {
|
|||
void AtualizarLeitura() {
|
||||
if (!Iniciado) return;
|
||||
|
||||
EstadoLeitura = (PotenciaLeitura > 0 && _EstadoControle == Estado::Ligado) ? Estado::Ligado : Estado::Desligado;
|
||||
PercentualPotenciaLeitura = (RampaMax > 0)
|
||||
? (PotenciaLeitura / (double)RampaMax) * 100.0
|
||||
: 0.0;
|
||||
uint32_t duty = ledcRead(_sentido == Sentido::Horario ? _canalIN1 : _canalIN2);
|
||||
PercentualPotenciaLeitura = (duty / (double)RampaMax) * 100.0;
|
||||
EstadoLeitura = (duty > 5) ? Estado::Ligado : Estado::Desligado;
|
||||
}
|
||||
|
||||
void MostrarLog(String mensagem) {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ class SensorFluxo_v2 : public ComponenteCAN {
|
|||
bool leituraAtual = (_pino.get() == 1);
|
||||
|
||||
if (leituraAtual != ultimaLeitura) {
|
||||
//MostrarLog("Mudou: ultima=" + String(ultimaLeitura) + " atual=" + String(leituraAtual));
|
||||
|
||||
if (leituraAtual && !ultimaLeitura) {
|
||||
unsigned long tempoAtual = millis();
|
||||
unsigned long intervalo = tempoAtual - tempoAnterior;
|
||||
|
|
@ -80,6 +82,8 @@ class SensorFluxo_v2 : public ComponenteCAN {
|
|||
|
||||
_Pulsos++;
|
||||
_PeriodoTotal += intervalo;
|
||||
|
||||
//MostrarLog("SUBIDA! Pulsos=" + String(_Pulsos) + " Periodo=" + String(_PeriodoTotal) + " Intervalo=" + String(intervalo));
|
||||
}
|
||||
|
||||
ultimaLeitura = leituraAtual;
|
||||
|
|
@ -102,8 +106,6 @@ class SensorFluxo_v2 : public ComponenteCAN {
|
|||
}
|
||||
|
||||
case CanMessagePosicaoDados::Dados1: {
|
||||
AtualizarLeitura();
|
||||
|
||||
uint16_t vazaoEscalada = (uint16_t)(_Vazao * 100.0f);
|
||||
|
||||
data.push_back((uint8_t)_PulsosLeitura);
|
||||
|
|
|
|||
Loading…
Reference in New Issue