Commit 5ffec91d authored by Bernardo Quaresma Dias's avatar Bernardo Quaresma Dias
Browse files

Ajuste de identificação de modo 9002 e verficiação limites MV

MPA-1169
parent cb88b8de
......@@ -2,9 +2,9 @@
-- Copyright (C) 2003-2021 Tecgraf/PUC-Rio, PETROBRAS S/A
-- Instituto Tecgraf <mpa@tecgraf.puc-rio.br>
-- Arquivo gerado pelo programa MPA
-- Verso: 6.7
-- Verso: 6.8
-- Arquivo: lib-wellbot.mpad
-- Data: 19/11/2021 10:15:15
-- Data: 13/12/2021 10:07:37
-- =============================================================================
MPA_5_0 = true
......@@ -199,7 +199,7 @@ Diagrams = {
beforemsg = nil,
aftermsg = nil,
expressions = {
"ret_mon_topo\n== \"ok\"",
"ret_mon_topo\n== \"alta\"",
},
variables = {},
types = {
......@@ -3173,7 +3173,7 @@ Diagrams = {
},
{
type = "Link",
description = "V",
description = "F",
from = 9,
to = 11,
x = {
......@@ -3285,7 +3285,7 @@ Diagrams = {
},
{
type = "Link",
description = "F",
description = "V",
from = 9,
to = 56,
x = {
......@@ -6745,9 +6745,9 @@ Diagrams = {
operation = "call",
},
xmin = 3480,
ymin = 8860,
ymin = 8460,
xmax = 3680,
ymax = 8980,
ymax = 8580,
},
{
type = "Choice",
......@@ -6763,9 +6763,9 @@ Diagrams = {
member = "informar_aberta",
operation = "call",
},
xmin = 3200,
xmin = 3480,
ymin = 8860,
xmax = 3400,
xmax = 3680,
ymax = 8980,
},
{
......@@ -7204,7 +7204,7 @@ Diagrams = {
beforemsg = nil,
aftermsg = nil,
expressions = {
"ret_mon_topo\n== \"ok\"",
"ret_mon_topo\n== \"alta\"",
},
variables = {},
types = {
......@@ -7296,7 +7296,7 @@ Diagrams = {
type = "Jump",
description = "wait",
x = 3580,
y = 8520,
y = 8120,
r = 40,
},
{
......@@ -7438,9 +7438,9 @@ Diagrams = {
operation = "call",
},
xmin = 3480,
ymin = 8660,
ymin = 8260,
xmax = 3680,
ymax = 8780,
ymax = 8380,
},
{
type = "Jump",
......@@ -7453,7 +7453,7 @@ Diagrams = {
type = "Jump",
description = "check",
x = 3860,
y = 9200,
y = 9140,
r = 40,
},
{
......@@ -7664,13 +7664,6 @@ Diagrams = {
xmax = 1440,
ymax = 8980,
},
{
type = "Jump",
description = "check",
x = 3300,
y = 8720,
r = 40,
},
{
type = "Command",
description = "executa\nmalha aberta\n[$object]",
......@@ -7736,7 +7729,7 @@ Diagrams = {
},
{
type = "Link",
description = "F",
description = "V",
from = 77,
to = 37,
x = {
......@@ -8032,7 +8025,7 @@ Diagrams = {
type = "Link",
description = "V",
from = 16,
to = 105,
to = 104,
x = {
4980,
5260,
......@@ -8044,7 +8037,7 @@ Diagrams = {
},
{
type = "Link",
description = "V",
description = "F",
from = 77,
to = 41,
x = {
......@@ -8458,26 +8451,26 @@ Diagrams = {
from = 56,
to = 55,
x = {
3320,
3540,
3580,
3580,
},
y = {
8920,
8920,
8520,
},
},
{
type = "Link",
description = "V",
from = 56,
to = 104,
to = 26,
x = {
3300,
3300,
3580,
3860,
},
y = {
8900,
8720,
8920,
8920,
},
},
{
......@@ -8901,7 +8894,7 @@ Diagrams = {
to = 56,
x = {
3020,
3300,
3580,
},
y = {
8520,
......@@ -9002,8 +8995,8 @@ Diagrams = {
3580,
},
y = {
8720,
8520,
8320,
8120,
},
},
{
......@@ -9016,8 +9009,8 @@ Diagrams = {
3580,
},
y = {
8920,
8720,
8520,
8320,
},
},
{
......@@ -9030,7 +9023,7 @@ Diagrams = {
3860,
},
y = {
9200,
9140,
8920,
},
},
......@@ -9307,7 +9300,7 @@ Diagrams = {
{
type = "Link",
description = nil,
from = 105,
from = 104,
to = 54,
x = {
5260,
......
......@@ -566,47 +566,51 @@ class{ id = "aux_wellbot_PID", name = "WellBot: PID", group = "WellBot",
results = {
},
code = [====[ function(self)
local mv_calc, delta_mv_calc
local tipo = self.tipo
local mv, mv_max, mv_min, mv_dif = self:informar_mv_engenharia()
if mv_dif == 0 then
self.variacao_mv = 0
return
end
local tipo = self.tipo
local mv_calc, delta_mv_calc
if tipo == 'pos' then
mv_calc = self:calcular_mv()
if mv_max and mv_min then
mv_calc = math.max(mv_min, math.min(mv_max, mv_calc))
local mv_normal = ((mv-mv_min)/mv_dif)*100
self.atualizacao_mv = mv_calc
--self:ajustar_mv(mv_calc)
if tipo == 'pos' then
mv_calc = mv
else
mv_calc = math.max(0, math.min(100, mv_calc))
self.atualizacao_mv = mv_calc
--self:ajustar_mv(mv_calc)
end
else
delta_mv_calc = self:calcular_delta_mv()
local delta_max = self.delta_max
if delta_max then
delta_mv_calc = limitar(delta_mv_calc,-delta_max,delta_max)
self.variacao_mv = 0
delta_mv_calc = 0
end
local nova_mv = mv + delta_mv_calc
if mv_max and mv_min then
nova_mv = math.max(0, math.min(100, nova_mv))
local mv_normal = ((mv-mv_min)/mv_dif)*100
delta_mv_calc = nova_mv - mv
self.variacao_mv = delta_mv_calc
--self:ajustar_mv(mv_normal)
else
if tipo == 'pos' then
mv_calc = self:calcular_mv()
if mv_max and mv_min then
mv_calc = math.max(mv_min, math.min(mv_max, mv_calc))
local mv_normal = ((mv-mv_min)/mv_dif)*100
self.atualizacao_mv = mv_calc
--self:ajustar_mv(mv_calc)
else
mv_calc = math.max(0, math.min(100, mv_calc))
self.atualizacao_mv = mv_calc
--self:ajustar_mv(mv_calc)
end
else
--self:ajustar_mv(nova_mv)
self.variacao_mv = delta_mv_calc
delta_mv_calc = self:calcular_delta_mv()
local delta_max = self.delta_max
if delta_max then
delta_mv_calc = limitar(delta_mv_calc,-delta_max,delta_max)
end
local nova_mv = mv + delta_mv_calc
if mv_max and mv_min then
nova_mv = math.max(0, math.min(100, nova_mv))
local mv_normal = ((mv-mv_min)/mv_dif)*100
delta_mv_calc = nova_mv - mv
self.variacao_mv = delta_mv_calc
--self:ajustar_mv(mv_normal)
else
--self:ajustar_mv(nova_mv)
self.variacao_mv = delta_mv_calc
end
end
end
......@@ -712,13 +716,12 @@ class{ id = "aux_wellbot_PID", name = "WellBot: PID", group = "WellBot",
local ti = self:informar_ti()
local td = self:informar_td()
if not self.t_1 then -- na primeira execução não tem como calcular
return self:informar_mv()
end
local dt = self.t_0 - self.t_1
if dt == 0 then -- tempo muito curto para a execução
return self:informar_mv()
end
......@@ -726,7 +729,7 @@ class{ id = "aux_wellbot_PID", name = "WellBot: PID", group = "WellBot",
if not kp then -- sem constante proporcional, nao tem como calcular
return self:informar_mv()
end
local ac
if (acao == 0) then -- direta
ac = 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment