ajustes pontuais de conectividade
This commit is contained in:
parent
8ea61c158e
commit
8f29571cff
|
|
@ -447,7 +447,7 @@ namespace AgroBase.Forms.IHM
|
||||||
var interfaces = EthernetService.ObterNomesInterfaces().Where(x => x.Contains("Ativa")).ToList();
|
var interfaces = EthernetService.ObterNomesInterfaces().Where(x => x.Contains("Ativa")).ToList();
|
||||||
cmbInterface.Items.Clear();
|
cmbInterface.Items.Clear();
|
||||||
cmbInterface.Items.AddRange(interfaces.ToArray());
|
cmbInterface.Items.AddRange(interfaces.ToArray());
|
||||||
cmbInterface.SelectedIndex = interfaces.IndexOf(interfaces.FirstOrDefault(x => x.Contains(p.rover_interface)));
|
cmbInterface.SelectedIndex = interfaces.IndexOf(interfaces.FirstOrDefault(x => x.Contains(p.rover_interface ?? "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void SalvarParametrosConfiguracao()
|
private async void SalvarParametrosConfiguracao()
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace AgroBase.Forms
|
||||||
if (DalyBMSService.Iniciado)
|
if (DalyBMSService.Iniciado)
|
||||||
{
|
{
|
||||||
var Bat = DalyBMSService.DadosLeitura;
|
var Bat = DalyBMSService.DadosLeitura;
|
||||||
lblVBat.Text = $"Bateria: {Bat.Pack.TensaoTotal_V:F2}V {Bat.Pack.Corrente_A:F2}A {Bat.Pack.SOC_percent:F2}% {Bat.TemperaturaMax:Fw}ºC";
|
lblVBat.Text = $"Bateria: {Bat.Pack.TensaoTotal_V:F2}V {Bat.Pack.Corrente_A:F2}A {Bat.Pack.SOC_percent:F2}% {Bat.TemperaturaMax:F2}ºC";
|
||||||
}
|
}
|
||||||
lblVBat.ForeColor = DalyBMSService.Iniciado ? Color.Green : Color.Red;
|
lblVBat.ForeColor = DalyBMSService.Iniciado ? Color.Green : Color.Red;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -166,4 +166,16 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class OAKImuModel
|
||||||
|
{
|
||||||
|
public double timestamp { get; set; }
|
||||||
|
public double roll { get; set; }
|
||||||
|
public double pitch { get; set; }
|
||||||
|
public double yaw { get; set; }
|
||||||
|
public double yaw_fixed { get; set; }
|
||||||
|
public double vel_mps { get; set; }
|
||||||
|
public double latencia { get; set; }
|
||||||
|
public double frequencia { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2338,7 +2338,8 @@ namespace AgroBase.Models
|
||||||
_Reservatorio?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0, Variaveis.OperacaoEmAndamento.TempoDecorridoSegs);
|
_Reservatorio?.AtualizarConsumo(_DispMvd?.Dados?.DistanciaPercorridaTotal ?? 0, Variaveis.OperacaoEmAndamento.TempoDecorridoSegs);
|
||||||
_Trajetoria?.AtualizarDadosAutonomiaCorredor();
|
_Trajetoria?.AtualizarDadosAutonomiaCorredor();
|
||||||
|
|
||||||
var sIMU = LivoxManagerProcess.DadosLeitura.imu;
|
var sIMU = JsonConvert.DeserializeObject<OAKImuModel>(RedisService.Get(RedisService.ModKey(T_Code.Imu)));
|
||||||
|
//var sIMU = LivoxManagerProcess.DadosLeitura.imu;
|
||||||
var dadosIMU = sIMU != null ? new OperacaoSensoriamentoLogImuModel()
|
var dadosIMU = sIMU != null ? new OperacaoSensoriamentoLogImuModel()
|
||||||
{
|
{
|
||||||
Iniciado = sIMU.timestamp > 0 && HealthWorkerService.ModulosSaude.FirstOrDefault(x => x.modulo == T_Code.Imu)?.status != StatusModulo.Desconectado,
|
Iniciado = sIMU.timestamp > 0 && HealthWorkerService.ModulosSaude.FirstOrDefault(x => x.modulo == T_Code.Imu)?.status != StatusModulo.Desconectado,
|
||||||
|
|
@ -2451,6 +2452,7 @@ namespace AgroBase.Models
|
||||||
var dadosBateria = _Bateria != null ? new OperacaoSensoriamentoLogBateriaModel()
|
var dadosBateria = _Bateria != null ? new OperacaoSensoriamentoLogBateriaModel()
|
||||||
{
|
{
|
||||||
Iniciado = _Bateria.Iniciado,
|
Iniciado = _Bateria.Iniciado,
|
||||||
|
BmsLigado = _Bateria.BmsLigado,
|
||||||
_dt = _Bateria._dt,
|
_dt = _Bateria._dt,
|
||||||
PercentualBateria = _Bateria.PercentualBateria,
|
PercentualBateria = _Bateria.PercentualBateria,
|
||||||
PercentualBateriaConsumida = _Bateria.PercentualConsumido,
|
PercentualBateriaConsumida = _Bateria.PercentualConsumido,
|
||||||
|
|
@ -2796,6 +2798,7 @@ namespace AgroBase.Models
|
||||||
public class OperacaoSensoriamentoLogBateriaModel
|
public class OperacaoSensoriamentoLogBateriaModel
|
||||||
{
|
{
|
||||||
public bool Iniciado { get; set; }
|
public bool Iniciado { get; set; }
|
||||||
|
public bool BmsLigado { get; set; }
|
||||||
public double _dt { get; set; }
|
public double _dt { get; set; }
|
||||||
public double PercentualBateria { get; set; }
|
public double PercentualBateria { get; set; }
|
||||||
public double PercentualBateriaConsumida { get; set; }
|
public double PercentualBateriaConsumida { get; set; }
|
||||||
|
|
@ -2813,6 +2816,7 @@ namespace AgroBase.Models
|
||||||
return new OperacaoSensoriamentoLogBateriaModel()
|
return new OperacaoSensoriamentoLogBateriaModel()
|
||||||
{
|
{
|
||||||
Iniciado = Iniciado,
|
Iniciado = Iniciado,
|
||||||
|
BmsLigado = BmsLigado,
|
||||||
_dt = _dt,
|
_dt = _dt,
|
||||||
PercentualBateriaConsumida = PercentualBateriaConsumida,
|
PercentualBateriaConsumida = PercentualBateriaConsumida,
|
||||||
PercentualBateria = PercentualBateria,
|
PercentualBateria = PercentualBateria,
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ namespace AgroBase.Services
|
||||||
private readonly Queue<double> _historicoCorrente = new Queue<double>();
|
private readonly Queue<double> _historicoCorrente = new Queue<double>();
|
||||||
|
|
||||||
public bool Iniciado { get; private set; }
|
public bool Iniciado { get; private set; }
|
||||||
|
public bool BmsLigado { get; set; }
|
||||||
private double CargaMaxima { get; set; }
|
private double CargaMaxima { get; set; }
|
||||||
private double CargaAtual { get; set; }
|
private double CargaAtual { get; set; }
|
||||||
public double CargaAtualAmp
|
public double CargaAtualAmp
|
||||||
|
|
@ -133,16 +134,17 @@ namespace AgroBase.Services
|
||||||
double sen_soc = Math.Round(FuncoesMatematicas.Map(sen_tensao, VariaveisEquipamento.TensaoMinimaBateria, VariaveisEquipamento.TensaoMaximaBateria, 0.0, 100.0), 2);
|
double sen_soc = Math.Round(FuncoesMatematicas.Map(sen_tensao, VariaveisEquipamento.TensaoMinimaBateria, VariaveisEquipamento.TensaoMaximaBateria, 0.0, 100.0), 2);
|
||||||
|
|
||||||
Iniciado = bms_iniciado || sen_iniciado;
|
Iniciado = bms_iniciado || sen_iniciado;
|
||||||
|
BmsLigado = bms_iniciado;
|
||||||
|
|
||||||
if (!Iniciado)
|
if (!Iniciado)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//_dt = Sensor.ValoresLeituras.FirstOrDefault(x => x.funcao == FuncoesPinout.Corrente)?.atual?.dt ?? 0;
|
//_dt = Sensor.ValoresLeituras.FirstOrDefault(x => x.funcao == FuncoesPinout.Corrente)?.atual?.dt ?? 0;
|
||||||
_dt = (DateTime.Now - ((bms_iniciado ? bms_ultima_leitura : sen_ultima_leitura) ?? DateTime.Now)).TotalSeconds;
|
_dt = (DateTime.Now - ((BmsLigado ? bms_ultima_leitura : sen_ultima_leitura) ?? DateTime.Now)).TotalSeconds;
|
||||||
TensaoInstantanea = bms_iniciado ? bms_tensao : sen_tensao;
|
TensaoInstantanea = BmsLigado ? bms_tensao : sen_tensao;
|
||||||
CorrenteInstantanea = bms_iniciado ? bms_corrente : sen_corrente;
|
CorrenteInstantanea = BmsLigado ? bms_corrente : sen_corrente;
|
||||||
PotenciaInstantanea = bms_iniciado ? bms_potencia : sen_potencia;
|
PotenciaInstantanea = BmsLigado ? bms_potencia : sen_potencia;
|
||||||
PercentualBateria = bms_iniciado ? bms_soc : sen_soc;
|
PercentualBateria = BmsLigado ? bms_soc : sen_soc;
|
||||||
PercentualBateria = FuncoesMatematicas.Clamp(PercentualBateria, 0, 100);
|
PercentualBateria = FuncoesMatematicas.Clamp(PercentualBateria, 0, 100);
|
||||||
|
|
||||||
// Verifique se as datas são válidas (não MinValue, MaxValue ou valores anômalos)
|
// Verifique se as datas são válidas (não MinValue, MaxValue ou valores anômalos)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
DadosLeitura.Pack.TensaoTotal_V = totalV;
|
DadosLeitura.Pack.TensaoTotal_V = totalV;
|
||||||
DadosLeitura.Pack.TensaoMedida_V = measV;
|
DadosLeitura.Pack.TensaoMedida_V = measV;
|
||||||
DadosLeitura.Pack.Corrente_A = current;
|
DadosLeitura.Pack.Corrente_A = -current;
|
||||||
DadosLeitura.Pack.SOC_percent = soc;
|
DadosLeitura.Pack.SOC_percent = soc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1012,9 +1012,9 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var bico in Variaveis.OperacaoEmAndamento.Controle?.Bicos?.Where(x => x.Inicializado && x.Comandar))
|
foreach (var bico in Variaveis.OperacaoEmAndamento.Controle?.Bicos ?? new List<Models.Modules.AtuadorBicoModel>())
|
||||||
{
|
{
|
||||||
if (bico._EstadoLeitura == Estado.Ligado)
|
if (bico.Inicializado && bico.Comandar && bico._EstadoLeitura == Estado.Ligado)
|
||||||
{
|
{
|
||||||
bico.TrechosAtuado[bico.TrechosAtuado.Count - 1].Add(new double[] { UltimaLeitura.Latitude, UltimaLeitura.Longitude });
|
bico.TrechosAtuado[bico.TrechosAtuado.Count - 1].Add(new double[] { UltimaLeitura.Latitude, UltimaLeitura.Longitude });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,8 @@ namespace AgroBase.Services.Operadores
|
||||||
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen),
|
RedisService.AtualizarCampos(RedisService.ModKey(Enums.T_Code.Sen),
|
||||||
("timestamp", agora),
|
("timestamp", agora),
|
||||||
("conectado", DadosSen.Conectado),
|
("conectado", DadosSen.Conectado),
|
||||||
("freq_base", DadosSen.FrequenciaBase)
|
("freq_base", DadosSen.FrequenciaBase),
|
||||||
|
("bms_ligado", _Sensoriamento.Bateria?.BmsLigado ?? false)
|
||||||
);
|
);
|
||||||
var senSensoresAtualizados = new List<(string caminho, object valor)>();
|
var senSensoresAtualizados = new List<(string caminho, object valor)>();
|
||||||
var senSensoresAtivos = new List<string>();
|
var senSensoresAtivos = new List<string>();
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ class CameraOak:
|
||||||
_camera["modelo"] = self.modelo
|
_camera["modelo"] = self.modelo
|
||||||
_camera["dispositivo"] = self.dispositivo.value
|
_camera["dispositivo"] = self.dispositivo.value
|
||||||
_camera["tem_depht"] = self.tem_depth
|
_camera["tem_depht"] = self.tem_depth
|
||||||
_camera["tem_imu"] = iniciar_imu and self.tem_imu
|
_camera["tem_imu"] = self.tem_imu
|
||||||
|
|
||||||
# Criar processo para transmissao de video
|
# Criar processo para transmissao de video
|
||||||
try:
|
try:
|
||||||
|
|
@ -130,7 +130,7 @@ class CameraOak:
|
||||||
if self.tem_depth:
|
if self.tem_depth:
|
||||||
self.q_depth = self.device.getOutputQueue(name="depth", maxSize=1, blocking=False)
|
self.q_depth = self.device.getOutputQueue(name="depth", maxSize=1, blocking=False)
|
||||||
|
|
||||||
if self.tem_imu:
|
if self.tem_imu and iniciar_imu:
|
||||||
self.q_imu = self.device.getOutputQueue(name="imu", maxSize=50, blocking=False)
|
self.q_imu = self.device.getOutputQueue(name="imu", maxSize=50, blocking=False)
|
||||||
self.imu = IMUCamera(self.q_imu, freq=100, angulo_inicial=26.3)
|
self.imu = IMUCamera(self.q_imu, freq=100, angulo_inicial=26.3)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class IMUCamera(ModuloDiagnosticoBase):
|
||||||
pitch=round(-pitch, 2), # frontal
|
pitch=round(-pitch, 2), # frontal
|
||||||
yaw=round(yaw, 2),
|
yaw=round(yaw, 2),
|
||||||
vel_mps=round(velocidade_mps, 3),
|
vel_mps=round(velocidade_mps, 3),
|
||||||
timestamp=t1,
|
timestamp=(t1 * 1000),
|
||||||
latencia=latencia,
|
latencia=latencia,
|
||||||
frequencia=f_tick
|
frequencia=f_tick
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
try:
|
try:
|
||||||
agora = time.time()
|
agora = time.time()
|
||||||
motivos_gerais = []
|
motivos_gerais = []
|
||||||
|
saude_mandatorios = 0
|
||||||
|
total_mandatorios = 0
|
||||||
saude_total = 0
|
saude_total = 0
|
||||||
total_ativos = 0
|
total_ativos = 0
|
||||||
saude_individual = []
|
saude_individual = []
|
||||||
|
|
@ -29,6 +31,7 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
FREQ_MIN = FREQ_BASE * 0.5
|
FREQ_MIN = FREQ_BASE * 0.5
|
||||||
SAUDE_MIN_ALERTA = 80
|
SAUDE_MIN_ALERTA = 80
|
||||||
|
|
||||||
|
bms_ligado = dados_sen.get("bms_ligado", False)
|
||||||
sensor_bateria_ativado = False
|
sensor_bateria_ativado = False
|
||||||
|
|
||||||
sensores_ativos = dados_sen.get("sensores", {}).get("ativos", [])
|
sensores_ativos = dados_sen.get("sensores", {}).get("ativos", [])
|
||||||
|
|
@ -88,9 +91,11 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
"em_uso": aferir
|
"em_uso": aferir
|
||||||
}
|
}
|
||||||
saude_individual.append(saude_mod)
|
saude_individual.append(saude_mod)
|
||||||
if mandatorio:
|
|
||||||
total_ativos += 1
|
total_ativos += 1
|
||||||
saude_total += saude
|
saude_total += saude
|
||||||
|
if mandatorio:
|
||||||
|
total_mandatorios += 1
|
||||||
|
saude_mandatorios += saude
|
||||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||||
dados_sensor["saude"] = saude_mod
|
dados_sensor["saude"] = saude_mod
|
||||||
|
|
||||||
|
|
@ -148,9 +153,11 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
"em_uso": controlar
|
"em_uso": controlar
|
||||||
}
|
}
|
||||||
saude_individual.append(saude_mod)
|
saude_individual.append(saude_mod)
|
||||||
if mandatorio:
|
|
||||||
total_ativos += 1
|
total_ativos += 1
|
||||||
saude_total += saude
|
saude_total += saude
|
||||||
|
if mandatorio:
|
||||||
|
total_mandatorios += 1
|
||||||
|
saude_mandatorios += saude
|
||||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||||
dados_servo["saude"] = saude_mod
|
dados_servo["saude"] = saude_mod
|
||||||
|
|
||||||
|
|
@ -198,9 +205,11 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
"em_uso": controlar
|
"em_uso": controlar
|
||||||
}
|
}
|
||||||
saude_individual.append(saude_mod)
|
saude_individual.append(saude_mod)
|
||||||
if mandatorio:
|
|
||||||
total_ativos += 1
|
total_ativos += 1
|
||||||
saude_total += saude
|
saude_total += saude
|
||||||
|
if mandatorio:
|
||||||
|
total_mandatorios += 1
|
||||||
|
saude_mandatorios += saude
|
||||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||||
dados_rele["saude"] = saude_mod
|
dados_rele["saude"] = saude_mod
|
||||||
|
|
||||||
|
|
@ -248,15 +257,18 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
"em_uso": controlar
|
"em_uso": controlar
|
||||||
}
|
}
|
||||||
saude_individual.append(saude_mod)
|
saude_individual.append(saude_mod)
|
||||||
if mandatorio:
|
|
||||||
total_ativos += 1
|
total_ativos += 1
|
||||||
saude_total += saude
|
saude_total += saude
|
||||||
|
if mandatorio:
|
||||||
|
total_mandatorios += 1
|
||||||
|
saude_mandatorios += saude
|
||||||
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
motivos_gerais.extend([f"{chave}: {m}" for m in motivos])
|
||||||
dados_led["saude"] = saude_mod
|
dados_led["saude"] = saude_mod
|
||||||
|
|
||||||
|
|
||||||
cond_op_mod = []
|
cond_op_mod = []
|
||||||
penalidade_percentual_bateria = 0
|
penalidade_percentual_bateria = 0
|
||||||
|
if not bms_ligado:
|
||||||
if sensor_bateria_ativado:
|
if sensor_bateria_ativado:
|
||||||
_contexto = ContextoGlobalRedis.get_contexto()
|
_contexto = ContextoGlobalRedis.get_contexto()
|
||||||
bateria_suficiente_corredor = _contexto.get("Trajetoria", {}).get("CorredorAtual", {}).get("bateria_ok", True)
|
bateria_suficiente_corredor = _contexto.get("Trajetoria", {}).get("CorredorAtual", {}).get("bateria_ok", True)
|
||||||
|
|
@ -291,7 +303,8 @@ class ModuloSensoriamento(ModuloDiagnosticoBase):
|
||||||
"descricao": f"Sensor de nível da bateria desconectado!"
|
"descricao": f"Sensor de nível da bateria desconectado!"
|
||||||
})
|
})
|
||||||
|
|
||||||
saude_final = (saude_total // total_ativos) if total_ativos > 0 else 0
|
saude_final = (saude_mandatorios // total_mandatorios) if total_mandatorios > 0 else 100
|
||||||
|
#saude_final = (saude_total // total_ativos) if total_ativos > 0 else 0
|
||||||
saude_final = saude_final - penalidade_percentual_bateria
|
saude_final = saude_final - penalidade_percentual_bateria
|
||||||
|
|
||||||
status = StatusModulo.OPERANTE
|
status = StatusModulo.OPERANTE
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class CameraManager:
|
||||||
det_config = load_det_config()
|
det_config = load_det_config()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
nova = CameraOak(self.mostrar_log, mx_id, modelo_ia_seg=None, modelo_ia_det=det_config)
|
nova = CameraOak(self.mostrar_log, mx_id, modelo_ia_seg=None, modelo_ia_det=det_config, iniciar_imu=True)
|
||||||
if nova.iniciado:
|
if nova.iniciado:
|
||||||
self.camera = nova
|
self.camera = nova
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue