Commit ea4f0ed8 authored by Bernardo Quaresma Dias's avatar Bernardo Quaresma Dias
Browse files

Inclusão de versão 2_0 de lib-getset

INSTMPA-1270
parent 4cd6ca48
-- =============================================================================
-- Copyright (C) 2003-2021 Tecgraf/PUC-Rio, PETROBRAS S/A
-- Instituto Tecgraf <mpa@tecgraf.puc-rio.br>
-- Arquivo gerado pelo programa MPA
-- Verso: 6.5
-- Arquivo: lib-getset.mpad
-- Data: 01/07/2021 13:52:21
-- =============================================================================
MPA_5_0 = true
EXPANDED = {
true,
}
DisabledDiagrams = {
}
Diagrams = {
{
id = "GetSet/trackVal: Rastreio de Valor",
name = "GetSet/trackVal: Rastreio de Valor",
kind = "Flow",
description = nil,
isApplication = false,
globals = {
{
name = "getset",
type = "GET_SET_base",
list = false,
value = nil,
comment = nil,
is_arg = true,
is_ret = false,
},
},
errorFunction = nil,
haltDiagram = nil,
Nodes = {
{
type = "Command",
description = nil,
action = {
_switch = "OBJECTCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {},
variables = {
"track_val",
},
classid = "GET_SET_base",
objname = "getset",
member = "track_val",
operation = "call",
},
xmin = 4580,
ymin = 5080,
xmax = 4780,
ymax = 5200,
},
{
type = "Command",
description = nil,
action = {
_switch = "FUNCTIONCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {
"t_intervalo_s or 15",
},
variables = {},
functionid = "esperar",
},
xmin = 4580,
ymin = 4680,
xmax = 4780,
ymax = 4800,
},
{
type = "Command",
description = nil,
action = {
_switch = "OBJECTCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {},
variables = {
"t_intervalo_s",
},
classid = "GET_SET_base",
objname = "getset",
member = "t_intervalo_s",
operation = "get",
},
xmin = 4580,
ymin = 5280,
xmax = 4780,
ymax = 5400,
},
{
type = "Choice",
description = nil,
action = {
_switch = "EXPRESSION",
beforemsg = nil,
aftermsg = nil,
expressions = {
"track_val\n~= nil",
},
variables = {},
types = {
"BOOLEAN",
},
islist = {
false,
},
},
xmin = 4580,
ymin = 4880,
xmax = 4780,
ymax = 5000,
},
{
type = "Command",
description = nil,
action = {
_switch = "OBJECTCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {},
variables = {
"reg_track",
},
classid = "GET_SET_base",
objname = "getset",
member = "reg_track",
operation = "get",
},
xmin = 4580,
ymin = 5480,
xmax = 4780,
ymax = 5600,
},
{
type = "Command",
description = "$Name\n$results",
action = {
_switch = "FUNCTIONCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {
"{getset;'getset-track';track_val}",
"';'",
},
variables = {
"reg_txt",
},
functionid = "list_concat",
},
xmin = 4860,
ymin = 4880,
xmax = 5060,
ymax = 5000,
},
{
type = "Command",
description = nil,
action = {
_switch = "OBJECTCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {
"reg_txt",
},
variables = {},
classid = "registro",
objname = "reg_track",
member = "registrar",
operation = "call",
},
xmin = 4860,
ymin = 4680,
xmax = 5060,
ymax = 4800,
},
},
Links = {
{
type = "Link",
description = nil,
from = 3,
to = 1,
x = {
4680,
4680,
},
y = {
5340,
5140,
},
},
{
type = "Link",
description = nil,
from = 1,
to = 4,
x = {
4680,
4680,
},
y = {
5140,
4940,
},
},
{
type = "Link",
description = nil,
from = 2,
to = 3,
x = {
4680,
4540,
4540,
4680,
},
y = {
4740,
4740,
5340,
5340,
},
},
{
type = "Link",
description = nil,
from = 5,
to = 3,
x = {
4680,
4680,
},
y = {
5540,
5340,
},
},
{
type = "Link",
description = "V",
from = 4,
to = 6,
x = {
4680,
4960,
},
y = {
4940,
4940,
},
},
{
type = "Link",
description = nil,
from = nil,
to = 5,
x = {
4680,
4680,
},
y = {
5680,
5540,
},
},
{
type = "Link",
description = nil,
from = 6,
to = 7,
x = {
4960,
4960,
},
y = {
4940,
4740,
},
},
{
type = "Link",
description = nil,
from = 7,
to = 2,
x = {
4960,
4680,
},
y = {
4740,
4740,
},
},
{
type = "Link",
description = "F",
from = 4,
to = 2,
x = {
4680,
4680,
},
y = {
4940,
4740,
},
},
},
Areas = {
},
Hidden = {
},
},
{
id = "[GetSet: Gerencia trackVal]",
name = "[GetSet: Gerencia trackVal]",
kind = "Flow",
description = nil,
isApplication = true,
globals = {
},
errorFunction = nil,
haltDiagram = nil,
Nodes = {
{
type = "Foreach",
description = nil,
action = {
_switch = "LISTITERATION",
variable = "getset_inst",
index = nil,
list = "getset_insts",
listtype = "GET_SET_base",
},
xmin = 4420,
ymin = 5200,
xmax = 4620,
ymax = 5320,
},
{
type = "Command",
description = nil,
action = {
_switch = "FUNCTIONCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {
"\"[GetSet: Gerencia trackVal]\"",
"30",
},
variables = {},
functionid = "app_updt_diagram_timeout",
},
xmin = 4700,
ymin = 5200,
xmax = 5180,
ymax = 5320,
},
{
type = "Command",
description = nil,
action = {
_switch = "FUNCTIONCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {
"180",
},
variables = {},
functionid = "esperar",
},
xmin = 5260,
ymin = 5200,
xmax = 5460,
ymax = 5320,
},
{
type = "Fork",
description = nil,
x = 4520,
y = 5060,
r = 40,
},
{
type = "Command",
description = nil,
action = {
_switch = "DIAGRAMCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {
"getset_inst",
},
variables = {},
diagramid = "GetSet/trackVal: Rastreio de Valor",
operation = "call",
},
xmin = 4700,
ymin = 5000,
xmax = 5460,
ymax = 5120,
},
{
type = "Command",
description = nil,
action = {
_switch = "FUNCTIONCALL",
beforemsg = nil,
aftermsg = nil,
expressions = {},
variables = {
"getset_insts",
},
functionid = "GET_SET_getall_inst",
},
xmin = 4140,
ymin = 5200,
xmax = 4340,
ymax = 5320,
},
},
Links = {
{
type = "Link",
description = nil,
from = 6,
to = 1,
x = {
4240,
4520,
},
y = {
5260,
5260,
},
},
{
type = "Link",
description = nil,
from = nil,
to = 6,
x = {
4040,
4240,
},
y = {
5260,
5260,
},
},
{
type = "Link",
description = "I",
from = 1,
to = 4,
x = {
4520,
4520,
},
y = {
5260,
5060,
},
},
{
type = "Link",
description = nil,
from = 4,
to = 5,
x = {
4520,
5080,
},
y = {
5060,
5060,
},
},
{
type = "Link",
description = "F",
from = 1,
to = 2,
x = {
4520,
4940,
},
y = {
5260,
5260,
},
},
{
type = "Link",
description = nil,
from = 2,
to = 3,
x = {
4940,
5360,
},
y = {
5260,
5260,
},
},
{
type = "Link",
description = nil,
from = 3,
to = 2,
x = {
5360,
5360,
4940,
4940,
},
y = {
5260,
5160,
5160,
5260,
},
},
},
Areas = {
},
Hidden = {
},
},
}
Dependencies = {
"lib-app-1_0.mpam",
"lib-list-1_8.mpam",
"lib-time-1_2.mpam",
}
include 'lib-access-1_0.mpam'
include 'lib-condicao-1_2.mpam'
include 'lib-log-2_3.mpam'
local getset_code = [[
function _CLASS:read()
return self.valor:read()
end
function _CLASS:write(value)
return self.comando:write(value)
end
]]
func{ id = "GET_SET_getall_inst", name = "Obter Todas Instâncias Get/Set", group = "Pontos Get/Set",
description = [[
Função que itera sobre as classes de Pontos Get/Set e
retorna lista com todas as instâncias dessas classes.
]],
parameters = {
},
results = {
{name = "Todas as Simulações Reativas", type = "GET_SET_base[]"},
},
code = [=[ function ()
local _insts = {}
for classid, _ in allclasses() do
if classid:match("^GET_SET_") then
for instid, instance in instancesof(classid) do
_insts[#_insts+1] = instance
end
end
end
return _insts
end]=],
}
class{ id = "GET_SET_base", name = "Ponto Get/Set Base", group = "Pontos Get/Set",
isPoint = true, abstract = true,
bases = { },
description = "Classe base para pontos get/set.",
attributes = {
{
id = "cond_track",
name = "Condição de Rastreio",
type = "condicao",
access = "g",
description = [[Indica que o ponto configurado para comando deve rastrear o valor atual.]],
},
{
id = "t_intervalo_s",
name = "Intervalo de Rastreio",
type = "REAL",
access = "g",
description = [[Intervalo entre duas avaliações e realizações de rastreio.]],
},
{
id = "reg_track",
name = "Registro de Rastreio",
type = "registro",
access = "g",
description = [[Intervalo entre duas avaliações e realizações de rastreio.]],
},
},
methods = {
{ id = "track_val", name = "Rastrear Valor",
description = [[
Método que rastreia valor em comando de acordo com a condição e comparação entre os valores.
]],
parameters = {
},
results = {
{ name = "Valor Rastreado", type = "STRING" },
},
code = [===[ function(self)
local cond = self.cond_track
local val
if cond == nil or cond:avaliar_atendida() then
if self:eval_diff() then
val = self:read()
self:write(val)
end
end
if val ~= nil then
return tostring(val)
else
return val
end
end ]===],
},
},
}
class{ id = "GET_SET_BOOLEAN_POINT", name = "Ponto Get/Set Lógico", group = "Pontos Get/Set",
isPoint = true,
bases = { "BOOLEAN_POINT", "GET_SET_base" },
simulationValue = false,
description = "Classe de ponto boleano que tem um tag para comando e um tag para indicação de estado.",
code = getset_code,
attributes = {
{
id = "valor",
name = "Valor",
type = "BOOLEAN_POINT",
access = "r",
description = [[Indica o valor atual da variável de processo.]],
},
{
id = "comando",
name = "Comando",
type = "BOOLEAN_POINT",
access = "w",
description = [[Envia um comando para variável de processo.]],
},
},