Buscando el problema de los Offsets Fuera de Orden

This commit is contained in:
Miguel 2024-04-21 19:55:11 +02:00
parent fa6b7573c7
commit ee112f5e77
9 changed files with 659 additions and 257 deletions

160
.gitignore vendored Normal file
View File

@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

View File

@ -1,28 +1,24 @@
def calculate_offsets(db_struct, current_offset=0): def handle_array_types(db_struct):
""" """
Recursively calculate byte offsets for each field in the DB structure, Handle array types once all UDTs are expanded.
applying general alignment rules except inside arrays. This function modifies the structure in place.
""" """
if isinstance(db_struct, dict): if isinstance(db_struct, dict):
for key, value in db_struct.items(): for key, value in list(db_struct.items()):
if isinstance(value, dict) and 'type' in value:
is_array_element = value.get('is_array_element', False)
type_name = value['type']
size = type_sizes.get(type_name, 1)
if 'String' in type_name:
match = re.match(r'String\[(\d+)\]', type_name)
if match:
size = int(match.group(1)) + 2 # String length + 2 for the null terminator and length prefix
if not is_array_element and current_offset % 2 != 0:
current_offset += 1 # Align to the next even offset if it's not an array element
value['offset'] = current_offset
current_offset += size
# Recursively handle nested structures
if isinstance(value, dict): if isinstance(value, dict):
current_offset = calculate_offsets(value, current_offset) handle_array_types(value)
elif isinstance(value, str):
return current_offset # Parsing array definitions, e.g., "Array[1..3] of Real"
match = re.match(r"Array\[(\d+)\.\.(\d+)\] of (\w+)", value)
if match:
lower_bound, upper_bound, base_type = (
int(match.group(1)),
int(match.group(2)),
match.group(3),
)
# Expand this field into multiple fields
db_struct.pop(key) # Remove the original field
for i in range(lower_bound, upper_bound + 1):
db_struct[f"{key}_{i}"] = {"type": base_type, 'is_array_element': True}
print(
f"Expanded field '{key}' into array fields: {key}_{lower_bound} to {key}_{upper_bound} of type {base_type}

View File

@ -1,176 +1,178 @@
Nombre,Tipo,Offset,Comentario Nombre,Tipo,Offset,Dirección PLC,Comentario
MAIN,"""UDT SIPA SV Main""",0, MAIN,"""UDT SIPA SV Main""",0,DBX0.0,
MAIN.N1,DInt,0,.DB_IOT.USERLEVEL MAIN.N1,DInt,0,DBD0,.DB_IOT.USERLEVEL
MAIN.N2,String[81],4,.DB_IOT.USERNAME MAIN.N2,String[81],4,DBX4.0,.DB_IOT.USERNAME
MAIN.N3,String[81],88,.DB_IOT.NOME_RICETTA MAIN.N3,String[81],88,DBX88.0,.DB_IOT.NOME_RICETTA
MAIN.N4,Int,172,.DB_IOT.NEXT_MAINT_CYCLES MAIN.N4,Int,172,DBW172,.DB_IOT.NEXT_MAINT_CYCLES
MAIN.N5.V1,String[254],174, MAIN.N5.V1,String[254],174,DBX174.0,
MAIN.N5.V2,String[254],430, MAIN.N5.V2,String[254],430,DBX430.0,
MAIN.N5.V3,String[254],686, MAIN.N5.V3,String[254],686,DBX686.0,
MAIN.N5.V4,String[254],942, MAIN.N5.V4,String[254],942,DBX942.0,
MAIN.N5.V5,String[8],1198, MAIN.N5.V5,String[8],1198,DBX1198.0,
MAIN.N6.type_1,Real,1208,N/A MAIN.N6,Array[1..3] of Real,1208,DBX1208.0,.DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
MAIN.N6.type_2,Real,1212,N/A MAIN.N6[1],Real,1208,DBD1208,.DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
MAIN.N6.type_3,Real,1216,N/A MAIN.N6[2],Real,1212,DBD1212,.DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
MAIN.N7.type_1,Real,1220,N/A MAIN.N6[3],Real,1216,DBD1216,.DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
MAIN.N7.type_2,Real,1224,N/A MAIN.N7,Array[1..3] of Real,1220,DBX1220.0,.DB_IOT.ELECTRIC_CURRENT_PHASE_D
MAIN.N7.type_3,Real,1228,N/A MAIN.N7[1],Real,1220,DBD1220,.DB_IOT.ELECTRIC_CURRENT_PHASE_D
MAIN.N8,Real,1232,.DB_IOT.ELECTRIC_POWER_D MAIN.N7[2],Real,1224,DBD1224,.DB_IOT.ELECTRIC_CURRENT_PHASE_D
MAIN.N9,Real,1236,.DB_IOT.ELECTRIC_POWER_FACTOR_D MAIN.N7[3],Real,1228,DBD1228,.DB_IOT.ELECTRIC_CURRENT_PHASE_D
MAIN.N10,Real,1240,.DB_IOT.ELECTRIC_POWER_HOUR_D MAIN.N8,Real,1232,DBD1232,.DB_IOT.ELECTRIC_POWER_D
MAIN.N11,Real,1244,.DB_IOT.ELECTRIC_POWER_WH MAIN.N9,Real,1236,DBD1236,.DB_IOT.ELECTRIC_POWER_FACTOR_D
SECT1,"""UDT SIPA SV Section""",1248, MAIN.N10,Real,1240,DBD1240,.DB_IOT.ELECTRIC_POWER_HOUR_D
SECT1.N1,DInt,1664,.DB_IOT.STATO_MACCHINA MAIN.N11,Real,1244,DBD1244,.DB_IOT.ELECTRIC_POWER_WH
SECT1.N2,DInt,1668,.DB_IOT.ALLARME_FERMO SECT1,"""UDT SIPA SV Section""",1248,DBX1248.0,
SECT1.N3,DInt,1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione) SECT1.N1,DInt,1664,DBD1664,.DB_IOT.STATO_MACCHINA
SECT1.N4,Int,1676,.DB_IOT.STATO_OPERATIVO (Semaforo) SECT1.N2,DInt,1668,DBD1668,.DB_IOT.ALLARME_FERMO
SECT1.N5,Int,1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)" SECT1.N3,DInt,1672,DBD1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione)
SECT1.N6,DInt,1680,.DB_IOT.ALARM_STOP_NO SECT1.N4,Int,1676,DBW1676,.DB_IOT.STATO_OPERATIVO (Semaforo)
SECT1.N7.V1,DInt,1684,PIECES_TOT SECT1.N5,Int,1678,DBW1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)"
SECT1.N7.V2,DInt,1688,PIECES_OK SECT1.N6,DInt,1680,DBD1680,.DB_IOT.ALARM_STOP_NO
SECT1.N7.V3,DInt,1692,PIECES_KO_1 SECT1.N7.V1,DInt,1684,DBD1684,PIECES_TOT
SECT1.N7.V4,DInt,1696,PIECES_KO_2 SECT1.N7.V2,DInt,1688,DBD1688,PIECES_OK
SECT1.N7.V5,DInt,1700,PIECES_KO_3 SECT1.N7.V3,DInt,1692,DBD1692,PIECES_KO_1
SECT1.N7.V6,DInt,1704,PIECES_KO_4 SECT1.N7.V4,DInt,1696,DBD1696,PIECES_KO_2
SECT1.N7.V7,DInt,1708,PIECES_KO_5 SECT1.N7.V5,DInt,1700,DBD1700,PIECES_KO_3
SECT1.N7.V8,DInt,1712,PIECES_KO_6 SECT1.N7.V6,DInt,1704,DBD1704,PIECES_KO_4
SECT1.N7.V9,DInt,1716,PIECES_KO_7 SECT1.N7.V7,DInt,1708,DBD1708,PIECES_KO_5
SECT1.N7.V10,DInt,1720,PIECES_KO_8 SECT1.N7.V8,DInt,1712,DBD1712,PIECES_KO_6
SECT1.N7.V11,DInt,1724,PIECES_KO_9 SECT1.N7.V9,DInt,1716,DBD1716,PIECES_KO_7
SECT1.N7.V12,DInt,1728,PIECES_KO_10 SECT1.N7.V10,DInt,1720,DBD1720,PIECES_KO_8
SECT1.N7.V13,DInt,1732,T_ALARM_HOURS SECT1.N7.V11,DInt,1724,DBD1724,PIECES_KO_9
SECT1.N7.V14,DInt,1736,T_DRY_CYCLE_HOURS SECT1.N7.V12,DInt,1728,DBD1728,PIECES_KO_10
SECT1.N7.V15,DInt,1740,T_POWERED_HOURS SECT1.N7.V13,DInt,1732,DBD1732,T_ALARM_HOURS
SECT1.N7.V16,DInt,1744,T_PRODUCT_100_HOURS SECT1.N7.V14,DInt,1736,DBD1736,T_DRY_CYCLE_HOURS
SECT1.N7.V17,DInt,1748,T_PRODUCT_0_HOURS SECT1.N7.V15,DInt,1740,DBD1740,T_POWERED_HOURS
SECT1.N7.V18,DInt,1752,T_STOP_HOURS SECT1.N7.V16,DInt,1744,DBD1744,T_PRODUCT_100_HOURS
SECT1.N7.V19,Int,1756,T_ALARM_MINUTES SECT1.N7.V17,DInt,1748,DBD1748,T_PRODUCT_0_HOURS
SECT1.N7.V20,Int,1758,T_DRY_CYCLE_MINUTES SECT1.N7.V18,DInt,1752,DBD1752,T_STOP_HOURS
SECT1.N7.V21,Int,1760,T_POWERED_MINUTES SECT1.N7.V19,Int,1756,DBW1756,T_ALARM_MINUTES
SECT1.N7.V22,Int,1762,T_PRODUCT_100_MINUTES SECT1.N7.V20,Int,1758,DBW1758,T_DRY_CYCLE_MINUTES
SECT1.N7.V23,Int,1764,T_PRODUCT_0_MINUTES SECT1.N7.V21,Int,1760,DBW1760,T_POWERED_MINUTES
SECT1.N7.V24,Int,1766,T_STOP_MINUTES SECT1.N7.V22,Int,1762,DBW1762,T_PRODUCT_100_MINUTES
SECT2,"""UDT SIPA SV Section""",1352, SECT1.N7.V23,Int,1764,DBW1764,T_PRODUCT_0_MINUTES
SECT2.N1,DInt,1664,.DB_IOT.STATO_MACCHINA SECT1.N7.V24,Int,1766,DBW1766,T_STOP_MINUTES
SECT2.N2,DInt,1668,.DB_IOT.ALLARME_FERMO SECT2,"""UDT SIPA SV Section""",1352,DBX1352.0,
SECT2.N3,DInt,1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione) SECT2.N1,DInt,1664,DBD1664,.DB_IOT.STATO_MACCHINA
SECT2.N4,Int,1676,.DB_IOT.STATO_OPERATIVO (Semaforo) SECT2.N2,DInt,1668,DBD1668,.DB_IOT.ALLARME_FERMO
SECT2.N5,Int,1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)" SECT2.N3,DInt,1672,DBD1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione)
SECT2.N6,DInt,1680,.DB_IOT.ALARM_STOP_NO SECT2.N4,Int,1676,DBW1676,.DB_IOT.STATO_OPERATIVO (Semaforo)
SECT2.N7.V1,DInt,1684,PIECES_TOT SECT2.N5,Int,1678,DBW1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)"
SECT2.N7.V2,DInt,1688,PIECES_OK SECT2.N6,DInt,1680,DBD1680,.DB_IOT.ALARM_STOP_NO
SECT2.N7.V3,DInt,1692,PIECES_KO_1 SECT2.N7.V1,DInt,1684,DBD1684,PIECES_TOT
SECT2.N7.V4,DInt,1696,PIECES_KO_2 SECT2.N7.V2,DInt,1688,DBD1688,PIECES_OK
SECT2.N7.V5,DInt,1700,PIECES_KO_3 SECT2.N7.V3,DInt,1692,DBD1692,PIECES_KO_1
SECT2.N7.V6,DInt,1704,PIECES_KO_4 SECT2.N7.V4,DInt,1696,DBD1696,PIECES_KO_2
SECT2.N7.V7,DInt,1708,PIECES_KO_5 SECT2.N7.V5,DInt,1700,DBD1700,PIECES_KO_3
SECT2.N7.V8,DInt,1712,PIECES_KO_6 SECT2.N7.V6,DInt,1704,DBD1704,PIECES_KO_4
SECT2.N7.V9,DInt,1716,PIECES_KO_7 SECT2.N7.V7,DInt,1708,DBD1708,PIECES_KO_5
SECT2.N7.V10,DInt,1720,PIECES_KO_8 SECT2.N7.V8,DInt,1712,DBD1712,PIECES_KO_6
SECT2.N7.V11,DInt,1724,PIECES_KO_9 SECT2.N7.V9,DInt,1716,DBD1716,PIECES_KO_7
SECT2.N7.V12,DInt,1728,PIECES_KO_10 SECT2.N7.V10,DInt,1720,DBD1720,PIECES_KO_8
SECT2.N7.V13,DInt,1732,T_ALARM_HOURS SECT2.N7.V11,DInt,1724,DBD1724,PIECES_KO_9
SECT2.N7.V14,DInt,1736,T_DRY_CYCLE_HOURS SECT2.N7.V12,DInt,1728,DBD1728,PIECES_KO_10
SECT2.N7.V15,DInt,1740,T_POWERED_HOURS SECT2.N7.V13,DInt,1732,DBD1732,T_ALARM_HOURS
SECT2.N7.V16,DInt,1744,T_PRODUCT_100_HOURS SECT2.N7.V14,DInt,1736,DBD1736,T_DRY_CYCLE_HOURS
SECT2.N7.V17,DInt,1748,T_PRODUCT_0_HOURS SECT2.N7.V15,DInt,1740,DBD1740,T_POWERED_HOURS
SECT2.N7.V18,DInt,1752,T_STOP_HOURS SECT2.N7.V16,DInt,1744,DBD1744,T_PRODUCT_100_HOURS
SECT2.N7.V19,Int,1756,T_ALARM_MINUTES SECT2.N7.V17,DInt,1748,DBD1748,T_PRODUCT_0_HOURS
SECT2.N7.V20,Int,1758,T_DRY_CYCLE_MINUTES SECT2.N7.V18,DInt,1752,DBD1752,T_STOP_HOURS
SECT2.N7.V21,Int,1760,T_POWERED_MINUTES SECT2.N7.V19,Int,1756,DBW1756,T_ALARM_MINUTES
SECT2.N7.V22,Int,1762,T_PRODUCT_100_MINUTES SECT2.N7.V20,Int,1758,DBW1758,T_DRY_CYCLE_MINUTES
SECT2.N7.V23,Int,1764,T_PRODUCT_0_MINUTES SECT2.N7.V21,Int,1760,DBW1760,T_POWERED_MINUTES
SECT2.N7.V24,Int,1766,T_STOP_MINUTES SECT2.N7.V22,Int,1762,DBW1762,T_PRODUCT_100_MINUTES
SECT3,"""UDT SIPA SV Section""",1456, SECT2.N7.V23,Int,1764,DBW1764,T_PRODUCT_0_MINUTES
SECT3.N1,DInt,1664,.DB_IOT.STATO_MACCHINA SECT2.N7.V24,Int,1766,DBW1766,T_STOP_MINUTES
SECT3.N2,DInt,1668,.DB_IOT.ALLARME_FERMO SECT3,"""UDT SIPA SV Section""",1456,DBX1456.0,
SECT3.N3,DInt,1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione) SECT3.N1,DInt,1664,DBD1664,.DB_IOT.STATO_MACCHINA
SECT3.N4,Int,1676,.DB_IOT.STATO_OPERATIVO (Semaforo) SECT3.N2,DInt,1668,DBD1668,.DB_IOT.ALLARME_FERMO
SECT3.N5,Int,1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)" SECT3.N3,DInt,1672,DBD1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione)
SECT3.N6,DInt,1680,.DB_IOT.ALARM_STOP_NO SECT3.N4,Int,1676,DBW1676,.DB_IOT.STATO_OPERATIVO (Semaforo)
SECT3.N7.V1,DInt,1684,PIECES_TOT SECT3.N5,Int,1678,DBW1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)"
SECT3.N7.V2,DInt,1688,PIECES_OK SECT3.N6,DInt,1680,DBD1680,.DB_IOT.ALARM_STOP_NO
SECT3.N7.V3,DInt,1692,PIECES_KO_1 SECT3.N7.V1,DInt,1684,DBD1684,PIECES_TOT
SECT3.N7.V4,DInt,1696,PIECES_KO_2 SECT3.N7.V2,DInt,1688,DBD1688,PIECES_OK
SECT3.N7.V5,DInt,1700,PIECES_KO_3 SECT3.N7.V3,DInt,1692,DBD1692,PIECES_KO_1
SECT3.N7.V6,DInt,1704,PIECES_KO_4 SECT3.N7.V4,DInt,1696,DBD1696,PIECES_KO_2
SECT3.N7.V7,DInt,1708,PIECES_KO_5 SECT3.N7.V5,DInt,1700,DBD1700,PIECES_KO_3
SECT3.N7.V8,DInt,1712,PIECES_KO_6 SECT3.N7.V6,DInt,1704,DBD1704,PIECES_KO_4
SECT3.N7.V9,DInt,1716,PIECES_KO_7 SECT3.N7.V7,DInt,1708,DBD1708,PIECES_KO_5
SECT3.N7.V10,DInt,1720,PIECES_KO_8 SECT3.N7.V8,DInt,1712,DBD1712,PIECES_KO_6
SECT3.N7.V11,DInt,1724,PIECES_KO_9 SECT3.N7.V9,DInt,1716,DBD1716,PIECES_KO_7
SECT3.N7.V12,DInt,1728,PIECES_KO_10 SECT3.N7.V10,DInt,1720,DBD1720,PIECES_KO_8
SECT3.N7.V13,DInt,1732,T_ALARM_HOURS SECT3.N7.V11,DInt,1724,DBD1724,PIECES_KO_9
SECT3.N7.V14,DInt,1736,T_DRY_CYCLE_HOURS SECT3.N7.V12,DInt,1728,DBD1728,PIECES_KO_10
SECT3.N7.V15,DInt,1740,T_POWERED_HOURS SECT3.N7.V13,DInt,1732,DBD1732,T_ALARM_HOURS
SECT3.N7.V16,DInt,1744,T_PRODUCT_100_HOURS SECT3.N7.V14,DInt,1736,DBD1736,T_DRY_CYCLE_HOURS
SECT3.N7.V17,DInt,1748,T_PRODUCT_0_HOURS SECT3.N7.V15,DInt,1740,DBD1740,T_POWERED_HOURS
SECT3.N7.V18,DInt,1752,T_STOP_HOURS SECT3.N7.V16,DInt,1744,DBD1744,T_PRODUCT_100_HOURS
SECT3.N7.V19,Int,1756,T_ALARM_MINUTES SECT3.N7.V17,DInt,1748,DBD1748,T_PRODUCT_0_HOURS
SECT3.N7.V20,Int,1758,T_DRY_CYCLE_MINUTES SECT3.N7.V18,DInt,1752,DBD1752,T_STOP_HOURS
SECT3.N7.V21,Int,1760,T_POWERED_MINUTES SECT3.N7.V19,Int,1756,DBW1756,T_ALARM_MINUTES
SECT3.N7.V22,Int,1762,T_PRODUCT_100_MINUTES SECT3.N7.V20,Int,1758,DBW1758,T_DRY_CYCLE_MINUTES
SECT3.N7.V23,Int,1764,T_PRODUCT_0_MINUTES SECT3.N7.V21,Int,1760,DBW1760,T_POWERED_MINUTES
SECT3.N7.V24,Int,1766,T_STOP_MINUTES SECT3.N7.V22,Int,1762,DBW1762,T_PRODUCT_100_MINUTES
SECT4,"""UDT SIPA SV Section""",1560, SECT3.N7.V23,Int,1764,DBW1764,T_PRODUCT_0_MINUTES
SECT4.N1,DInt,1664,.DB_IOT.STATO_MACCHINA SECT3.N7.V24,Int,1766,DBW1766,T_STOP_MINUTES
SECT4.N2,DInt,1668,.DB_IOT.ALLARME_FERMO SECT4,"""UDT SIPA SV Section""",1560,DBX1560.0,
SECT4.N3,DInt,1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione) SECT4.N1,DInt,1664,DBD1664,.DB_IOT.STATO_MACCHINA
SECT4.N4,Int,1676,.DB_IOT.STATO_OPERATIVO (Semaforo) SECT4.N2,DInt,1668,DBD1668,.DB_IOT.ALLARME_FERMO
SECT4.N5,Int,1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)" SECT4.N3,DInt,1672,DBD1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione)
SECT4.N6,DInt,1680,.DB_IOT.ALARM_STOP_NO SECT4.N4,Int,1676,DBW1676,.DB_IOT.STATO_OPERATIVO (Semaforo)
SECT4.N7.V1,DInt,1684,PIECES_TOT SECT4.N5,Int,1678,DBW1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)"
SECT4.N7.V2,DInt,1688,PIECES_OK SECT4.N6,DInt,1680,DBD1680,.DB_IOT.ALARM_STOP_NO
SECT4.N7.V3,DInt,1692,PIECES_KO_1 SECT4.N7.V1,DInt,1684,DBD1684,PIECES_TOT
SECT4.N7.V4,DInt,1696,PIECES_KO_2 SECT4.N7.V2,DInt,1688,DBD1688,PIECES_OK
SECT4.N7.V5,DInt,1700,PIECES_KO_3 SECT4.N7.V3,DInt,1692,DBD1692,PIECES_KO_1
SECT4.N7.V6,DInt,1704,PIECES_KO_4 SECT4.N7.V4,DInt,1696,DBD1696,PIECES_KO_2
SECT4.N7.V7,DInt,1708,PIECES_KO_5 SECT4.N7.V5,DInt,1700,DBD1700,PIECES_KO_3
SECT4.N7.V8,DInt,1712,PIECES_KO_6 SECT4.N7.V6,DInt,1704,DBD1704,PIECES_KO_4
SECT4.N7.V9,DInt,1716,PIECES_KO_7 SECT4.N7.V7,DInt,1708,DBD1708,PIECES_KO_5
SECT4.N7.V10,DInt,1720,PIECES_KO_8 SECT4.N7.V8,DInt,1712,DBD1712,PIECES_KO_6
SECT4.N7.V11,DInt,1724,PIECES_KO_9 SECT4.N7.V9,DInt,1716,DBD1716,PIECES_KO_7
SECT4.N7.V12,DInt,1728,PIECES_KO_10 SECT4.N7.V10,DInt,1720,DBD1720,PIECES_KO_8
SECT4.N7.V13,DInt,1732,T_ALARM_HOURS SECT4.N7.V11,DInt,1724,DBD1724,PIECES_KO_9
SECT4.N7.V14,DInt,1736,T_DRY_CYCLE_HOURS SECT4.N7.V12,DInt,1728,DBD1728,PIECES_KO_10
SECT4.N7.V15,DInt,1740,T_POWERED_HOURS SECT4.N7.V13,DInt,1732,DBD1732,T_ALARM_HOURS
SECT4.N7.V16,DInt,1744,T_PRODUCT_100_HOURS SECT4.N7.V14,DInt,1736,DBD1736,T_DRY_CYCLE_HOURS
SECT4.N7.V17,DInt,1748,T_PRODUCT_0_HOURS SECT4.N7.V15,DInt,1740,DBD1740,T_POWERED_HOURS
SECT4.N7.V18,DInt,1752,T_STOP_HOURS SECT4.N7.V16,DInt,1744,DBD1744,T_PRODUCT_100_HOURS
SECT4.N7.V19,Int,1756,T_ALARM_MINUTES SECT4.N7.V17,DInt,1748,DBD1748,T_PRODUCT_0_HOURS
SECT4.N7.V20,Int,1758,T_DRY_CYCLE_MINUTES SECT4.N7.V18,DInt,1752,DBD1752,T_STOP_HOURS
SECT4.N7.V21,Int,1760,T_POWERED_MINUTES SECT4.N7.V19,Int,1756,DBW1756,T_ALARM_MINUTES
SECT4.N7.V22,Int,1762,T_PRODUCT_100_MINUTES SECT4.N7.V20,Int,1758,DBW1758,T_DRY_CYCLE_MINUTES
SECT4.N7.V23,Int,1764,T_PRODUCT_0_MINUTES SECT4.N7.V21,Int,1760,DBW1760,T_POWERED_MINUTES
SECT4.N7.V24,Int,1766,T_STOP_MINUTES SECT4.N7.V22,Int,1762,DBW1762,T_PRODUCT_100_MINUTES
SECT5,"""UDT SIPA SV Section""",1664, SECT4.N7.V23,Int,1764,DBW1764,T_PRODUCT_0_MINUTES
SECT5.N1,DInt,1664,.DB_IOT.STATO_MACCHINA SECT4.N7.V24,Int,1766,DBW1766,T_STOP_MINUTES
SECT5.N2,DInt,1668,.DB_IOT.ALLARME_FERMO SECT5,"""UDT SIPA SV Section""",1664,DBX1664.0,
SECT5.N3,DInt,1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione) SECT5.N1,DInt,1664,DBD1664,.DB_IOT.STATO_MACCHINA
SECT5.N4,Int,1676,.DB_IOT.STATO_OPERATIVO (Semaforo) SECT5.N2,DInt,1668,DBD1668,.DB_IOT.ALLARME_FERMO
SECT5.N5,Int,1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)" SECT5.N3,DInt,1672,DBD1672,.DB_IOT.WARNING_ATTIVO (che compromette produzione)
SECT5.N6,DInt,1680,.DB_IOT.ALARM_STOP_NO SECT5.N4,Int,1676,DBW1676,.DB_IOT.STATO_OPERATIVO (Semaforo)
SECT5.N7.V1,DInt,1684,PIECES_TOT SECT5.N5,Int,1678,DBW1678,".DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)"
SECT5.N7.V2,DInt,1688,PIECES_OK SECT5.N6,DInt,1680,DBD1680,.DB_IOT.ALARM_STOP_NO
SECT5.N7.V3,DInt,1692,PIECES_KO_1 SECT5.N7.V1,DInt,1684,DBD1684,PIECES_TOT
SECT5.N7.V4,DInt,1696,PIECES_KO_2 SECT5.N7.V2,DInt,1688,DBD1688,PIECES_OK
SECT5.N7.V5,DInt,1700,PIECES_KO_3 SECT5.N7.V3,DInt,1692,DBD1692,PIECES_KO_1
SECT5.N7.V6,DInt,1704,PIECES_KO_4 SECT5.N7.V4,DInt,1696,DBD1696,PIECES_KO_2
SECT5.N7.V7,DInt,1708,PIECES_KO_5 SECT5.N7.V5,DInt,1700,DBD1700,PIECES_KO_3
SECT5.N7.V8,DInt,1712,PIECES_KO_6 SECT5.N7.V6,DInt,1704,DBD1704,PIECES_KO_4
SECT5.N7.V9,DInt,1716,PIECES_KO_7 SECT5.N7.V7,DInt,1708,DBD1708,PIECES_KO_5
SECT5.N7.V10,DInt,1720,PIECES_KO_8 SECT5.N7.V8,DInt,1712,DBD1712,PIECES_KO_6
SECT5.N7.V11,DInt,1724,PIECES_KO_9 SECT5.N7.V9,DInt,1716,DBD1716,PIECES_KO_7
SECT5.N7.V12,DInt,1728,PIECES_KO_10 SECT5.N7.V10,DInt,1720,DBD1720,PIECES_KO_8
SECT5.N7.V13,DInt,1732,T_ALARM_HOURS SECT5.N7.V11,DInt,1724,DBD1724,PIECES_KO_9
SECT5.N7.V14,DInt,1736,T_DRY_CYCLE_HOURS SECT5.N7.V12,DInt,1728,DBD1728,PIECES_KO_10
SECT5.N7.V15,DInt,1740,T_POWERED_HOURS SECT5.N7.V13,DInt,1732,DBD1732,T_ALARM_HOURS
SECT5.N7.V16,DInt,1744,T_PRODUCT_100_HOURS SECT5.N7.V14,DInt,1736,DBD1736,T_DRY_CYCLE_HOURS
SECT5.N7.V17,DInt,1748,T_PRODUCT_0_HOURS SECT5.N7.V15,DInt,1740,DBD1740,T_POWERED_HOURS
SECT5.N7.V18,DInt,1752,T_STOP_HOURS SECT5.N7.V16,DInt,1744,DBD1744,T_PRODUCT_100_HOURS
SECT5.N7.V19,Int,1756,T_ALARM_MINUTES SECT5.N7.V17,DInt,1748,DBD1748,T_PRODUCT_0_HOURS
SECT5.N7.V20,Int,1758,T_DRY_CYCLE_MINUTES SECT5.N7.V18,DInt,1752,DBD1752,T_STOP_HOURS
SECT5.N7.V21,Int,1760,T_POWERED_MINUTES SECT5.N7.V19,Int,1756,DBW1756,T_ALARM_MINUTES
SECT5.N7.V22,Int,1762,T_PRODUCT_100_MINUTES SECT5.N7.V20,Int,1758,DBW1758,T_DRY_CYCLE_MINUTES
SECT5.N7.V23,Int,1764,T_PRODUCT_0_MINUTES SECT5.N7.V21,Int,1760,DBW1760,T_POWERED_MINUTES
SECT5.N7.V24,Int,1766,T_STOP_MINUTES SECT5.N7.V22,Int,1762,DBW1762,T_PRODUCT_100_MINUTES
SECT5.N7.V23,Int,1764,DBW1764,T_PRODUCT_0_MINUTES
SECT5.N7.V24,Int,1766,DBW1766,T_STOP_MINUTES

1 Nombre Tipo Offset Dirección PLC Comentario
2 MAIN "UDT SIPA SV Main" 0 DBX0.0
3 MAIN.N1 DInt 0 DBD0 .DB_IOT.USERLEVEL
4 MAIN.N2 String[81] 4 DBX4.0 .DB_IOT.USERNAME
5 MAIN.N3 String[81] 88 DBX88.0 .DB_IOT.NOME_RICETTA
6 MAIN.N4 Int 172 DBW172 .DB_IOT.NEXT_MAINT_CYCLES
7 MAIN.N5.V1 String[254] 174 DBX174.0
8 MAIN.N5.V2 String[254] 430 DBX430.0
9 MAIN.N5.V3 String[254] 686 DBX686.0
10 MAIN.N5.V4 String[254] 942 DBX942.0
11 MAIN.N5.V5 String[8] 1198 DBX1198.0
12 MAIN.N6.type_1 MAIN.N6 Real Array[1..3] of Real 1208 DBX1208.0 N/A .DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
13 MAIN.N6.type_2 MAIN.N6[1] Real 1212 1208 DBD1208 N/A .DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
14 MAIN.N6.type_3 MAIN.N6[2] Real 1216 1212 DBD1212 N/A .DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
15 MAIN.N7.type_1 MAIN.N6[3] Real 1220 1216 DBD1216 N/A .DB_IOT.ELECTRIC_VOLTAGE_PHASE_D
16 MAIN.N7.type_2 MAIN.N7 Real Array[1..3] of Real 1224 1220 DBX1220.0 N/A .DB_IOT.ELECTRIC_CURRENT_PHASE_D
17 MAIN.N7.type_3 MAIN.N7[1] Real 1228 1220 DBD1220 N/A .DB_IOT.ELECTRIC_CURRENT_PHASE_D
18 MAIN.N8 MAIN.N7[2] Real 1232 1224 DBD1224 .DB_IOT.ELECTRIC_POWER_D .DB_IOT.ELECTRIC_CURRENT_PHASE_D
19 MAIN.N9 MAIN.N7[3] Real 1236 1228 DBD1228 .DB_IOT.ELECTRIC_POWER_FACTOR_D .DB_IOT.ELECTRIC_CURRENT_PHASE_D
20 MAIN.N10 MAIN.N8 Real 1240 1232 DBD1232 .DB_IOT.ELECTRIC_POWER_HOUR_D .DB_IOT.ELECTRIC_POWER_D
21 MAIN.N11 MAIN.N9 Real 1244 1236 DBD1236 .DB_IOT.ELECTRIC_POWER_WH .DB_IOT.ELECTRIC_POWER_FACTOR_D
22 SECT1 MAIN.N10 "UDT SIPA SV Section" Real 1248 1240 DBD1240 .DB_IOT.ELECTRIC_POWER_HOUR_D
23 SECT1.N1 MAIN.N11 DInt Real 1664 1244 DBD1244 .DB_IOT.STATO_MACCHINA .DB_IOT.ELECTRIC_POWER_WH
24 SECT1.N2 SECT1 DInt "UDT SIPA SV Section" 1668 1248 DBX1248.0 .DB_IOT.ALLARME_FERMO
25 SECT1.N3 SECT1.N1 DInt 1672 1664 DBD1664 .DB_IOT.WARNING_ATTIVO (che compromette produzione) .DB_IOT.STATO_MACCHINA
26 SECT1.N4 SECT1.N2 Int DInt 1676 1668 DBD1668 .DB_IOT.STATO_OPERATIVO (Semaforo) .DB_IOT.ALLARME_FERMO
27 SECT1.N5 SECT1.N3 Int DInt 1678 1672 DBD1672 .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc) .DB_IOT.WARNING_ATTIVO (che compromette produzione)
28 SECT1.N6 SECT1.N4 DInt Int 1680 1676 DBW1676 .DB_IOT.ALARM_STOP_NO .DB_IOT.STATO_OPERATIVO (Semaforo)
29 SECT1.N7.V1 SECT1.N5 DInt Int 1684 1678 DBW1678 PIECES_TOT .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)
30 SECT1.N7.V2 SECT1.N6 DInt 1688 1680 DBD1680 PIECES_OK .DB_IOT.ALARM_STOP_NO
31 SECT1.N7.V3 SECT1.N7.V1 DInt 1692 1684 DBD1684 PIECES_KO_1 PIECES_TOT
32 SECT1.N7.V4 SECT1.N7.V2 DInt 1696 1688 DBD1688 PIECES_KO_2 PIECES_OK
33 SECT1.N7.V5 SECT1.N7.V3 DInt 1700 1692 DBD1692 PIECES_KO_3 PIECES_KO_1
34 SECT1.N7.V6 SECT1.N7.V4 DInt 1704 1696 DBD1696 PIECES_KO_4 PIECES_KO_2
35 SECT1.N7.V7 SECT1.N7.V5 DInt 1708 1700 DBD1700 PIECES_KO_5 PIECES_KO_3
36 SECT1.N7.V8 SECT1.N7.V6 DInt 1712 1704 DBD1704 PIECES_KO_6 PIECES_KO_4
37 SECT1.N7.V9 SECT1.N7.V7 DInt 1716 1708 DBD1708 PIECES_KO_7 PIECES_KO_5
38 SECT1.N7.V10 SECT1.N7.V8 DInt 1720 1712 DBD1712 PIECES_KO_8 PIECES_KO_6
39 SECT1.N7.V11 SECT1.N7.V9 DInt 1724 1716 DBD1716 PIECES_KO_9 PIECES_KO_7
40 SECT1.N7.V12 SECT1.N7.V10 DInt 1728 1720 DBD1720 PIECES_KO_10 PIECES_KO_8
41 SECT1.N7.V13 SECT1.N7.V11 DInt 1732 1724 DBD1724 T_ALARM_HOURS PIECES_KO_9
42 SECT1.N7.V14 SECT1.N7.V12 DInt 1736 1728 DBD1728 T_DRY_CYCLE_HOURS PIECES_KO_10
43 SECT1.N7.V15 SECT1.N7.V13 DInt 1740 1732 DBD1732 T_POWERED_HOURS T_ALARM_HOURS
44 SECT1.N7.V16 SECT1.N7.V14 DInt 1744 1736 DBD1736 T_PRODUCT_100_HOURS T_DRY_CYCLE_HOURS
45 SECT1.N7.V17 SECT1.N7.V15 DInt 1748 1740 DBD1740 T_PRODUCT_0_HOURS T_POWERED_HOURS
46 SECT1.N7.V18 SECT1.N7.V16 DInt 1752 1744 DBD1744 T_STOP_HOURS T_PRODUCT_100_HOURS
47 SECT1.N7.V19 SECT1.N7.V17 Int DInt 1756 1748 DBD1748 T_ALARM_MINUTES T_PRODUCT_0_HOURS
48 SECT1.N7.V20 SECT1.N7.V18 Int DInt 1758 1752 DBD1752 T_DRY_CYCLE_MINUTES T_STOP_HOURS
49 SECT1.N7.V21 SECT1.N7.V19 Int 1760 1756 DBW1756 T_POWERED_MINUTES T_ALARM_MINUTES
50 SECT1.N7.V22 SECT1.N7.V20 Int 1762 1758 DBW1758 T_PRODUCT_100_MINUTES T_DRY_CYCLE_MINUTES
51 SECT1.N7.V23 SECT1.N7.V21 Int 1764 1760 DBW1760 T_PRODUCT_0_MINUTES T_POWERED_MINUTES
52 SECT1.N7.V24 SECT1.N7.V22 Int 1766 1762 DBW1762 T_STOP_MINUTES T_PRODUCT_100_MINUTES
53 SECT2 SECT1.N7.V23 "UDT SIPA SV Section" Int 1352 1764 DBW1764 T_PRODUCT_0_MINUTES
54 SECT2.N1 SECT1.N7.V24 DInt Int 1664 1766 DBW1766 .DB_IOT.STATO_MACCHINA T_STOP_MINUTES
55 SECT2.N2 SECT2 DInt "UDT SIPA SV Section" 1668 1352 DBX1352.0 .DB_IOT.ALLARME_FERMO
56 SECT2.N3 SECT2.N1 DInt 1672 1664 DBD1664 .DB_IOT.WARNING_ATTIVO (che compromette produzione) .DB_IOT.STATO_MACCHINA
57 SECT2.N4 SECT2.N2 Int DInt 1676 1668 DBD1668 .DB_IOT.STATO_OPERATIVO (Semaforo) .DB_IOT.ALLARME_FERMO
58 SECT2.N5 SECT2.N3 Int DInt 1678 1672 DBD1672 .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc) .DB_IOT.WARNING_ATTIVO (che compromette produzione)
59 SECT2.N6 SECT2.N4 DInt Int 1680 1676 DBW1676 .DB_IOT.ALARM_STOP_NO .DB_IOT.STATO_OPERATIVO (Semaforo)
60 SECT2.N7.V1 SECT2.N5 DInt Int 1684 1678 DBW1678 PIECES_TOT .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)
61 SECT2.N7.V2 SECT2.N6 DInt 1688 1680 DBD1680 PIECES_OK .DB_IOT.ALARM_STOP_NO
62 SECT2.N7.V3 SECT2.N7.V1 DInt 1692 1684 DBD1684 PIECES_KO_1 PIECES_TOT
63 SECT2.N7.V4 SECT2.N7.V2 DInt 1696 1688 DBD1688 PIECES_KO_2 PIECES_OK
64 SECT2.N7.V5 SECT2.N7.V3 DInt 1700 1692 DBD1692 PIECES_KO_3 PIECES_KO_1
65 SECT2.N7.V6 SECT2.N7.V4 DInt 1704 1696 DBD1696 PIECES_KO_4 PIECES_KO_2
66 SECT2.N7.V7 SECT2.N7.V5 DInt 1708 1700 DBD1700 PIECES_KO_5 PIECES_KO_3
67 SECT2.N7.V8 SECT2.N7.V6 DInt 1712 1704 DBD1704 PIECES_KO_6 PIECES_KO_4
68 SECT2.N7.V9 SECT2.N7.V7 DInt 1716 1708 DBD1708 PIECES_KO_7 PIECES_KO_5
69 SECT2.N7.V10 SECT2.N7.V8 DInt 1720 1712 DBD1712 PIECES_KO_8 PIECES_KO_6
70 SECT2.N7.V11 SECT2.N7.V9 DInt 1724 1716 DBD1716 PIECES_KO_9 PIECES_KO_7
71 SECT2.N7.V12 SECT2.N7.V10 DInt 1728 1720 DBD1720 PIECES_KO_10 PIECES_KO_8
72 SECT2.N7.V13 SECT2.N7.V11 DInt 1732 1724 DBD1724 T_ALARM_HOURS PIECES_KO_9
73 SECT2.N7.V14 SECT2.N7.V12 DInt 1736 1728 DBD1728 T_DRY_CYCLE_HOURS PIECES_KO_10
74 SECT2.N7.V15 SECT2.N7.V13 DInt 1740 1732 DBD1732 T_POWERED_HOURS T_ALARM_HOURS
75 SECT2.N7.V16 SECT2.N7.V14 DInt 1744 1736 DBD1736 T_PRODUCT_100_HOURS T_DRY_CYCLE_HOURS
76 SECT2.N7.V17 SECT2.N7.V15 DInt 1748 1740 DBD1740 T_PRODUCT_0_HOURS T_POWERED_HOURS
77 SECT2.N7.V18 SECT2.N7.V16 DInt 1752 1744 DBD1744 T_STOP_HOURS T_PRODUCT_100_HOURS
78 SECT2.N7.V19 SECT2.N7.V17 Int DInt 1756 1748 DBD1748 T_ALARM_MINUTES T_PRODUCT_0_HOURS
79 SECT2.N7.V20 SECT2.N7.V18 Int DInt 1758 1752 DBD1752 T_DRY_CYCLE_MINUTES T_STOP_HOURS
80 SECT2.N7.V21 SECT2.N7.V19 Int 1760 1756 DBW1756 T_POWERED_MINUTES T_ALARM_MINUTES
81 SECT2.N7.V22 SECT2.N7.V20 Int 1762 1758 DBW1758 T_PRODUCT_100_MINUTES T_DRY_CYCLE_MINUTES
82 SECT2.N7.V23 SECT2.N7.V21 Int 1764 1760 DBW1760 T_PRODUCT_0_MINUTES T_POWERED_MINUTES
83 SECT2.N7.V24 SECT2.N7.V22 Int 1766 1762 DBW1762 T_STOP_MINUTES T_PRODUCT_100_MINUTES
84 SECT3 SECT2.N7.V23 "UDT SIPA SV Section" Int 1456 1764 DBW1764 T_PRODUCT_0_MINUTES
85 SECT3.N1 SECT2.N7.V24 DInt Int 1664 1766 DBW1766 .DB_IOT.STATO_MACCHINA T_STOP_MINUTES
86 SECT3.N2 SECT3 DInt "UDT SIPA SV Section" 1668 1456 DBX1456.0 .DB_IOT.ALLARME_FERMO
87 SECT3.N3 SECT3.N1 DInt 1672 1664 DBD1664 .DB_IOT.WARNING_ATTIVO (che compromette produzione) .DB_IOT.STATO_MACCHINA
88 SECT3.N4 SECT3.N2 Int DInt 1676 1668 DBD1668 .DB_IOT.STATO_OPERATIVO (Semaforo) .DB_IOT.ALLARME_FERMO
89 SECT3.N5 SECT3.N3 Int DInt 1678 1672 DBD1672 .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc) .DB_IOT.WARNING_ATTIVO (che compromette produzione)
90 SECT3.N6 SECT3.N4 DInt Int 1680 1676 DBW1676 .DB_IOT.ALARM_STOP_NO .DB_IOT.STATO_OPERATIVO (Semaforo)
91 SECT3.N7.V1 SECT3.N5 DInt Int 1684 1678 DBW1678 PIECES_TOT .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)
92 SECT3.N7.V2 SECT3.N6 DInt 1688 1680 DBD1680 PIECES_OK .DB_IOT.ALARM_STOP_NO
93 SECT3.N7.V3 SECT3.N7.V1 DInt 1692 1684 DBD1684 PIECES_KO_1 PIECES_TOT
94 SECT3.N7.V4 SECT3.N7.V2 DInt 1696 1688 DBD1688 PIECES_KO_2 PIECES_OK
95 SECT3.N7.V5 SECT3.N7.V3 DInt 1700 1692 DBD1692 PIECES_KO_3 PIECES_KO_1
96 SECT3.N7.V6 SECT3.N7.V4 DInt 1704 1696 DBD1696 PIECES_KO_4 PIECES_KO_2
97 SECT3.N7.V7 SECT3.N7.V5 DInt 1708 1700 DBD1700 PIECES_KO_5 PIECES_KO_3
98 SECT3.N7.V8 SECT3.N7.V6 DInt 1712 1704 DBD1704 PIECES_KO_6 PIECES_KO_4
99 SECT3.N7.V9 SECT3.N7.V7 DInt 1716 1708 DBD1708 PIECES_KO_7 PIECES_KO_5
100 SECT3.N7.V10 SECT3.N7.V8 DInt 1720 1712 DBD1712 PIECES_KO_8 PIECES_KO_6
101 SECT3.N7.V11 SECT3.N7.V9 DInt 1724 1716 DBD1716 PIECES_KO_9 PIECES_KO_7
102 SECT3.N7.V12 SECT3.N7.V10 DInt 1728 1720 DBD1720 PIECES_KO_10 PIECES_KO_8
103 SECT3.N7.V13 SECT3.N7.V11 DInt 1732 1724 DBD1724 T_ALARM_HOURS PIECES_KO_9
104 SECT3.N7.V14 SECT3.N7.V12 DInt 1736 1728 DBD1728 T_DRY_CYCLE_HOURS PIECES_KO_10
105 SECT3.N7.V15 SECT3.N7.V13 DInt 1740 1732 DBD1732 T_POWERED_HOURS T_ALARM_HOURS
106 SECT3.N7.V16 SECT3.N7.V14 DInt 1744 1736 DBD1736 T_PRODUCT_100_HOURS T_DRY_CYCLE_HOURS
107 SECT3.N7.V17 SECT3.N7.V15 DInt 1748 1740 DBD1740 T_PRODUCT_0_HOURS T_POWERED_HOURS
108 SECT3.N7.V18 SECT3.N7.V16 DInt 1752 1744 DBD1744 T_STOP_HOURS T_PRODUCT_100_HOURS
109 SECT3.N7.V19 SECT3.N7.V17 Int DInt 1756 1748 DBD1748 T_ALARM_MINUTES T_PRODUCT_0_HOURS
110 SECT3.N7.V20 SECT3.N7.V18 Int DInt 1758 1752 DBD1752 T_DRY_CYCLE_MINUTES T_STOP_HOURS
111 SECT3.N7.V21 SECT3.N7.V19 Int 1760 1756 DBW1756 T_POWERED_MINUTES T_ALARM_MINUTES
112 SECT3.N7.V22 SECT3.N7.V20 Int 1762 1758 DBW1758 T_PRODUCT_100_MINUTES T_DRY_CYCLE_MINUTES
113 SECT3.N7.V23 SECT3.N7.V21 Int 1764 1760 DBW1760 T_PRODUCT_0_MINUTES T_POWERED_MINUTES
114 SECT3.N7.V24 SECT3.N7.V22 Int 1766 1762 DBW1762 T_STOP_MINUTES T_PRODUCT_100_MINUTES
115 SECT4 SECT3.N7.V23 "UDT SIPA SV Section" Int 1560 1764 DBW1764 T_PRODUCT_0_MINUTES
116 SECT4.N1 SECT3.N7.V24 DInt Int 1664 1766 DBW1766 .DB_IOT.STATO_MACCHINA T_STOP_MINUTES
117 SECT4.N2 SECT4 DInt "UDT SIPA SV Section" 1668 1560 DBX1560.0 .DB_IOT.ALLARME_FERMO
118 SECT4.N3 SECT4.N1 DInt 1672 1664 DBD1664 .DB_IOT.WARNING_ATTIVO (che compromette produzione) .DB_IOT.STATO_MACCHINA
119 SECT4.N4 SECT4.N2 Int DInt 1676 1668 DBD1668 .DB_IOT.STATO_OPERATIVO (Semaforo) .DB_IOT.ALLARME_FERMO
120 SECT4.N5 SECT4.N3 Int DInt 1678 1672 DBD1672 .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc) .DB_IOT.WARNING_ATTIVO (che compromette produzione)
121 SECT4.N6 SECT4.N4 DInt Int 1680 1676 DBW1676 .DB_IOT.ALARM_STOP_NO .DB_IOT.STATO_OPERATIVO (Semaforo)
122 SECT4.N7.V1 SECT4.N5 DInt Int 1684 1678 DBW1678 PIECES_TOT .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)
123 SECT4.N7.V2 SECT4.N6 DInt 1688 1680 DBD1680 PIECES_OK .DB_IOT.ALARM_STOP_NO
124 SECT4.N7.V3 SECT4.N7.V1 DInt 1692 1684 DBD1684 PIECES_KO_1 PIECES_TOT
125 SECT4.N7.V4 SECT4.N7.V2 DInt 1696 1688 DBD1688 PIECES_KO_2 PIECES_OK
126 SECT4.N7.V5 SECT4.N7.V3 DInt 1700 1692 DBD1692 PIECES_KO_3 PIECES_KO_1
127 SECT4.N7.V6 SECT4.N7.V4 DInt 1704 1696 DBD1696 PIECES_KO_4 PIECES_KO_2
128 SECT4.N7.V7 SECT4.N7.V5 DInt 1708 1700 DBD1700 PIECES_KO_5 PIECES_KO_3
129 SECT4.N7.V8 SECT4.N7.V6 DInt 1712 1704 DBD1704 PIECES_KO_6 PIECES_KO_4
130 SECT4.N7.V9 SECT4.N7.V7 DInt 1716 1708 DBD1708 PIECES_KO_7 PIECES_KO_5
131 SECT4.N7.V10 SECT4.N7.V8 DInt 1720 1712 DBD1712 PIECES_KO_8 PIECES_KO_6
132 SECT4.N7.V11 SECT4.N7.V9 DInt 1724 1716 DBD1716 PIECES_KO_9 PIECES_KO_7
133 SECT4.N7.V12 SECT4.N7.V10 DInt 1728 1720 DBD1720 PIECES_KO_10 PIECES_KO_8
134 SECT4.N7.V13 SECT4.N7.V11 DInt 1732 1724 DBD1724 T_ALARM_HOURS PIECES_KO_9
135 SECT4.N7.V14 SECT4.N7.V12 DInt 1736 1728 DBD1728 T_DRY_CYCLE_HOURS PIECES_KO_10
136 SECT4.N7.V15 SECT4.N7.V13 DInt 1740 1732 DBD1732 T_POWERED_HOURS T_ALARM_HOURS
137 SECT4.N7.V16 SECT4.N7.V14 DInt 1744 1736 DBD1736 T_PRODUCT_100_HOURS T_DRY_CYCLE_HOURS
138 SECT4.N7.V17 SECT4.N7.V15 DInt 1748 1740 DBD1740 T_PRODUCT_0_HOURS T_POWERED_HOURS
139 SECT4.N7.V18 SECT4.N7.V16 DInt 1752 1744 DBD1744 T_STOP_HOURS T_PRODUCT_100_HOURS
140 SECT4.N7.V19 SECT4.N7.V17 Int DInt 1756 1748 DBD1748 T_ALARM_MINUTES T_PRODUCT_0_HOURS
141 SECT4.N7.V20 SECT4.N7.V18 Int DInt 1758 1752 DBD1752 T_DRY_CYCLE_MINUTES T_STOP_HOURS
142 SECT4.N7.V21 SECT4.N7.V19 Int 1760 1756 DBW1756 T_POWERED_MINUTES T_ALARM_MINUTES
143 SECT4.N7.V22 SECT4.N7.V20 Int 1762 1758 DBW1758 T_PRODUCT_100_MINUTES T_DRY_CYCLE_MINUTES
144 SECT4.N7.V23 SECT4.N7.V21 Int 1764 1760 DBW1760 T_PRODUCT_0_MINUTES T_POWERED_MINUTES
145 SECT4.N7.V24 SECT4.N7.V22 Int 1766 1762 DBW1762 T_STOP_MINUTES T_PRODUCT_100_MINUTES
146 SECT5 SECT4.N7.V23 "UDT SIPA SV Section" Int 1664 1764 DBW1764 T_PRODUCT_0_MINUTES
147 SECT5.N1 SECT4.N7.V24 DInt Int 1664 1766 DBW1766 .DB_IOT.STATO_MACCHINA T_STOP_MINUTES
148 SECT5.N2 SECT5 DInt "UDT SIPA SV Section" 1668 1664 DBX1664.0 .DB_IOT.ALLARME_FERMO
149 SECT5.N3 SECT5.N1 DInt 1672 1664 DBD1664 .DB_IOT.WARNING_ATTIVO (che compromette produzione) .DB_IOT.STATO_MACCHINA
150 SECT5.N4 SECT5.N2 Int DInt 1676 1668 DBD1668 .DB_IOT.STATO_OPERATIVO (Semaforo) .DB_IOT.ALLARME_FERMO
151 SECT5.N5 SECT5.N3 Int DInt 1678 1672 DBD1672 .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc) .DB_IOT.WARNING_ATTIVO (che compromette produzione)
152 SECT5.N6 SECT5.N4 DInt Int 1680 1676 DBW1676 .DB_IOT.ALARM_STOP_NO .DB_IOT.STATO_OPERATIVO (Semaforo)
153 SECT5.N7.V1 SECT5.N5 DInt Int 1684 1678 DBW1678 PIECES_TOT .DB_IOT.MODO_OPERATIVO (Prod,Simula,Man, ecc)
154 SECT5.N7.V2 SECT5.N6 DInt 1688 1680 DBD1680 PIECES_OK .DB_IOT.ALARM_STOP_NO
155 SECT5.N7.V3 SECT5.N7.V1 DInt 1692 1684 DBD1684 PIECES_KO_1 PIECES_TOT
156 SECT5.N7.V4 SECT5.N7.V2 DInt 1696 1688 DBD1688 PIECES_KO_2 PIECES_OK
157 SECT5.N7.V5 SECT5.N7.V3 DInt 1700 1692 DBD1692 PIECES_KO_3 PIECES_KO_1
158 SECT5.N7.V6 SECT5.N7.V4 DInt 1704 1696 DBD1696 PIECES_KO_4 PIECES_KO_2
159 SECT5.N7.V7 SECT5.N7.V5 DInt 1708 1700 DBD1700 PIECES_KO_5 PIECES_KO_3
160 SECT5.N7.V8 SECT5.N7.V6 DInt 1712 1704 DBD1704 PIECES_KO_6 PIECES_KO_4
161 SECT5.N7.V9 SECT5.N7.V7 DInt 1716 1708 DBD1708 PIECES_KO_7 PIECES_KO_5
162 SECT5.N7.V10 SECT5.N7.V8 DInt 1720 1712 DBD1712 PIECES_KO_8 PIECES_KO_6
163 SECT5.N7.V11 SECT5.N7.V9 DInt 1724 1716 DBD1716 PIECES_KO_9 PIECES_KO_7
164 SECT5.N7.V12 SECT5.N7.V10 DInt 1728 1720 DBD1720 PIECES_KO_10 PIECES_KO_8
165 SECT5.N7.V13 SECT5.N7.V11 DInt 1732 1724 DBD1724 T_ALARM_HOURS PIECES_KO_9
166 SECT5.N7.V14 SECT5.N7.V12 DInt 1736 1728 DBD1728 T_DRY_CYCLE_HOURS PIECES_KO_10
167 SECT5.N7.V15 SECT5.N7.V13 DInt 1740 1732 DBD1732 T_POWERED_HOURS T_ALARM_HOURS
168 SECT5.N7.V16 SECT5.N7.V14 DInt 1744 1736 DBD1736 T_PRODUCT_100_HOURS T_DRY_CYCLE_HOURS
169 SECT5.N7.V17 SECT5.N7.V15 DInt 1748 1740 DBD1740 T_PRODUCT_0_HOURS T_POWERED_HOURS
170 SECT5.N7.V18 SECT5.N7.V16 DInt 1752 1744 DBD1744 T_STOP_HOURS T_PRODUCT_100_HOURS
171 SECT5.N7.V19 SECT5.N7.V17 Int DInt 1756 1748 DBD1748 T_ALARM_MINUTES T_PRODUCT_0_HOURS
172 SECT5.N7.V20 SECT5.N7.V18 Int DInt 1758 1752 DBD1752 T_DRY_CYCLE_MINUTES T_STOP_HOURS
173 SECT5.N7.V21 SECT5.N7.V19 Int 1760 1756 DBW1756 T_POWERED_MINUTES T_ALARM_MINUTES
174 SECT5.N7.V22 SECT5.N7.V20 Int 1762 1758 DBW1758 T_PRODUCT_100_MINUTES T_DRY_CYCLE_MINUTES
175 SECT5.N7.V23 SECT5.N7.V21 Int 1764 1760 DBW1760 T_PRODUCT_0_MINUTES T_POWERED_MINUTES
176 SECT5.N7.V24 SECT5.N7.V22 Int 1766 1762 DBW1762 T_STOP_MINUTES T_PRODUCT_100_MINUTES
177 SECT5.N7.V23 Int 1764 DBW1764 T_PRODUCT_0_MINUTES
178 SECT5.N7.V24 Int 1766 DBW1766 T_STOP_MINUTES

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -29,29 +29,41 @@ def expand_udt_references(db_struct, udts):
def handle_array_types(db_struct): def handle_array_types(db_struct):
""" """
Handle array types once all UDTs are expanded. Handle array types to expand them into multiple fields as sub-elements while preserving comments.
This function modifies the structure in place. Modifies the structure in place by expanding array definitions within their original field.
""" """
if isinstance(db_struct, dict): if isinstance(db_struct, dict):
for key, value in list(db_struct.items()): for key, value in list(db_struct.items()):
if isinstance(value, dict): if isinstance(value, dict):
# Recursively process nested dictionaries
handle_array_types(value) handle_array_types(value)
elif isinstance(value, str):
# Parsing array definitions, e.g., "Array[1..3] of Real" if isinstance(value, dict) and 'type' in value:
match = re.match(r"Array\[(\d+)\.\.(\d+)\] of (\w+)", value) match = re.match(r"Array\[(\d+)\.\.(\d+)\] of (\w+)", value['type'])
if match: if match:
lower_bound, upper_bound, base_type = ( lower_bound, upper_bound, base_type = int(match.group(1)), int(match.group(2)), match.group(3)
int(match.group(1)), comment = value.get('comment', '')
int(match.group(2)),
match.group(3), # Instead of popping the original key, initialize a sub-dictionary
) value['Array'] = {} # Initialize a sub-dictionary for array elements
# Expand this field into multiple fields
db_struct.pop(key) # Remove the original field
for i in range(lower_bound, upper_bound + 1): for i in range(lower_bound, upper_bound + 1):
db_struct[f"{key}_{i}"] = {"type": base_type, 'is_array_element': True} element_key = f"[{i}]"
print( value['Array'][element_key] = {
f"Expanded field '{key}' into array fields: {key}_{lower_bound} to {key}_{upper_bound} of type {base_type}" 'type': base_type,
) 'comment': comment,
'is_array_element': True
}
# Optionally, modify or remove the original type designation if necessary
# value.pop('type', None) # Uncomment this if you want to remove the 'type' from the original
# Continue the recursive handling if it's not an array definition
elif isinstance(value, dict):
handle_array_types(value)
type_sizes = { type_sizes = {
@ -64,11 +76,31 @@ type_sizes = {
} }
def calculate_plc_address(type_name, byte_offset, bit_offset=None):
"""
Calculate the PLC address notation based on byte size, byte offset and bit offset.
"""
byte_size = type_sizes.get(
type_name, 0
)
if type_name == "Bool":
if bit_offset is not None:
return f"DBX{byte_offset}.{bit_offset}" # Address for single bits
return f"DBB{byte_offset}" # Address for single bytes
elif byte_size == 2:
return f"DBW{byte_offset}" # Address for two-byte words
elif byte_size == 4:
return f"DBD{byte_offset}" # Address for four-byte double words
else:
return f"DBX{byte_offset}.0" # Default to bit address for types longer than 4 bytes (e.g., strings)
def calculate_offsets(db_struct, current_offset=0, parent=None): def calculate_offsets(db_struct, current_offset=0, parent=None):
""" """
Recursively calculate byte offsets for each field in the DB structure considering special types. Recursively calculate byte offsets for each field in the DB structure considering special types.
""" """
last_key_was_bool = False last_key_was_bool = False
last_bit_offset = 0 # To track bit offsets within a byte
if isinstance(db_struct, dict): if isinstance(db_struct, dict):
for key, value in list(db_struct.items()): for key, value in list(db_struct.items()):
if isinstance(value, dict): if isinstance(value, dict):
@ -81,10 +113,18 @@ def calculate_offsets(db_struct, current_offset=0, parent=None):
if not is_array_element and current_offset % 2 != 0: if not is_array_element and current_offset % 2 != 0:
current_offset += 1 # Align to the next even offset if it's not an array element current_offset += 1 # Align to the next even offset if it's not an array element
last_bit_offset = 0
plc_address = value.get('plc_address', False)
if plc_address is not False:
print("Address Already Calcolated!")
plc_address = calculate_plc_address(type_name, current_offset, last_bit_offset)
# Special handling for String types # Special handling for String types
if "String" in type_name: if "String" in type_name:
match = re.match(r"String\[(\d+)\]", type_name) match = re.match(r"String\[(\d+)\]", type_name)
last_bit_offset = 0
if match: if match:
length = int(match.group(1)) length = int(match.group(1))
size = length + 2 # Account for null-termination and string length prefix size = length + 2 # Account for null-termination and string length prefix
@ -94,14 +134,16 @@ def calculate_offsets(db_struct, current_offset=0, parent=None):
# Adjusting Bool sizes based on grouping # Adjusting Bool sizes based on grouping
if type_name == "Bool": if type_name == "Bool":
if last_key_was_bool: # This is a grouped bool if last_key_was_bool: # This is a grouped bool
size = 0.125 # One bit per Bool if grouped last_bit_offset += 1 # One bit per Bool if grouped
else: else:
size = 2 # Bools use a full byte if not grouped size = 2 # Bools use a full byte if not grouped
last_bit_offset = 0
last_key_was_bool = True last_key_was_bool = True
else: else:
last_key_was_bool = False last_key_was_bool = False
value["offset"] = current_offset value["offset"] = current_offset
value['plc_address'] = plc_address # Store the calculated PLC address
current_offset += size current_offset += size
current_offset = calculate_offsets( current_offset = calculate_offsets(

View File

@ -1,6 +1,7 @@
import xmltodict import xmltodict
import pandas as pd import pandas as pd
def save_json_to_xml(json_data, filename="DB_Structure.xml"): def save_json_to_xml(json_data, filename="DB_Structure.xml"):
""" """
Convert JSON data to XML and save it to a file. Convert JSON data to XML and save it to a file.
@ -32,20 +33,30 @@ def collect_data_for_table(db_struct, parent_prefix="", collected_data=[]):
Recursively collect data from the DB structure to display in a tabular format, Recursively collect data from the DB structure to display in a tabular format,
omitting 'fields' and 'Struct' in the names. omitting 'fields' and 'Struct' in the names.
""" """
is_array_element = False
if isinstance(db_struct, dict): if isinstance(db_struct, dict):
for key, value in db_struct.items(): for key, value in db_struct.items():
# Skip 'fields' and 'Struct' keys in the name path # Skip 'fields' and 'Struct' keys in the name path
if key == 'fields' or key == 'Struct': #
if key == "fields" or key == "Struct" or key == "Array":
next_prefix = parent_prefix # Continue with the current prefix next_prefix = parent_prefix # Continue with the current prefix
else: else:
next_prefix = f"{parent_prefix}.{key}" if parent_prefix else key if isinstance(value, dict):
is_array_element = value.get('is_array_element', False)
if not is_array_element:
next_prefix = f"{parent_prefix}.{key}" if parent_prefix else key
else:
next_prefix = f"{parent_prefix}{key}" if parent_prefix else key
if isinstance(value, dict) and 'type' in value: # Directly a field with 'type' if (
isinstance(value, dict) and "type" in value
): # Directly a field with 'type'
field_data = { field_data = {
"Nombre": next_prefix, "Nombre": next_prefix,
"Tipo": value.get('type', 'N/A'), "Tipo": value.get("type", "N/A"),
"Offset": value.get('offset', 'N/A'), "Offset": value.get("offset", "N/A"),
"Comentario": value.get('comment', 'N/A') "Dirección PLC": value.get("plc_address", "N/A"),
"Comentario": value.get("comment", "N/A"),
} }
collected_data.append(field_data) collected_data.append(field_data)

Binary file not shown.