*** This script works with a DB like this: ![[Pasted image 20240924113131.png]] Use the XML file Exported from : ![[Pasted image 20240924113222.png]] ![[Pasted image 20240924113305.png]] Then drag an drop in offline the DB to export on the Workspace area ![[Pasted image 20250401210005.png|800]] Export the DB5100 to XML file ![[Pasted image 20250401210056.png]] On the Excel Import the XML ==if needed==. ![[Pasted image 20250401210147.png|800]] ![[Pasted image 20250401210230.png|800]] Next, use Excel to categorize each Alarm into Sections and hide any unused Alarms. After editing the DB in Excel, export it back to the DB using the same XML file you used for importing. Always use the XML file generated by Tia Portal for exporting, as the Excel script requires its header to create the final file. ![[Pasted image 20250401210439.png|800]] After this go to Tia Portal and Import the xml file ![[Pasted image 20250401210828.png]] After this, the DB will only contain visible Alarms and will have every section configured. * Set X on Hidden: will add X to every hidden row in the Excel sheet. * Restore Hidden: will hide all rows with an X in the Hidden column. * Unhide All: Will unhide all rows. * Import: will decode the XML file into the Excel sheet. * Export: The latest XML file exported from Tia Portal will be used to recreate the DB based on the current Excel sheet configuration. *** # Tia Portal Alarm Management Tool Documentation - DB5100 ## Overview This Excel-based tool facilitates the management of alarms in Siemens TIA Portal projects by allowing users to: - Import alarm configurations from TIA Portal XML exports - Modify alarm properties, comments, and section assignments - Export modified configurations back to TIA Portal - Generate alarm mapping files for SIPA supervision systems The tool simplifies alarm management through a user-friendly Excel interface rather than working directly within TIA Portal. ## Main Workflow 1. Export the DB5100 (Alarm Database) from TIA Portal as XML 2. Import the XML into this Excel tool 3. Modify alarm properties, comments, and section assignments 4. Hide unwanted alarms (rather than deleting them) 5. Export the modified configuration back to XML 6. Import the XML back into TIA Portal 7. Optionally generate a SIPA supervision system export file ## Button Functions ### Import ![[Pasted image 20250401212140.png]] **Function**: `ImportSiemensXML()` This button imports alarm data from a Siemens TIA Portal XML file into the Excel sheet: 1. Prompts user to select an XML file 2. Validates the file (checks for expiration date) 3. Reads alarm configurations from the XML structure 4. Populates the Excel sheet with: - Alarm numbers - DB addresses (DB, Byte, Bit) - Priority settings - Section assignments - Alarm descriptions 5. Preserves existing row states (hidden/visible) **Notes**: - The import preserves existing configuration where possible - Alarms with value "0" are automatically hidden - Alarm sections are displayed as "X" marks in the appropriate columns ### Export ![[Pasted image 20250401212212.png]] **Function**: `ExportSiemensXML()` This button exports the current Excel sheet data back to a Siemens XML file: 1. Prompts user to select the target XML file (typically the original import file) 2. Validates input data (checks for duplicate alarm numbers) 3. Updates XML structures with modified values from Excel: - Reads only visible rows (hidden rows are excluded from export) - Updates alarm sections, priorities, and other properties - Preserves alarm descriptions 4. Saves the modified XML file for import into TIA Portal **Notes**: - Only visible rows are included in the export - The tool maintains the XML structure required by TIA Portal - The export correctly handles special data types (Bool, Byte, Int) ### Set X on Hidden ![[Pasted image 20250401212236.png]] **Function**: `MarcarFilasOcultas()` This button marks all currently hidden rows with an "X" in the Hidden column (column 17): 1. Scans all rows in the sheet 2. If a row is hidden, places an "X" in column 17 3. If a row is visible, clears column 17 **Purpose**: This function allows you to "remember" which rows are hidden so you can restore this state later. ### Restore Hidden ![[Pasted image 20250401212251.png]] **Function**: `OcultarFilasSegunMarca()` This button hides all rows that have an "X" in the Hidden column (column 17): 1. Makes all rows visible first 2. Scans column 17 for all rows 3. If an "X" is found, hides that row 4. Displays a progress bar during processing 5. Reports the number of rows hidden when complete **Purpose**: Restores a previously saved hidden/visible state. ### Unhide All ![[Pasted image 20250401212305.png]] **Function**: `MostrarTodasLasFilas()` This button makes all rows in the worksheet visible: 1. Simply removes the hidden state from all rows 2. No other changes are made to the data **Purpose**: Shows all alarms, including those previously hidden. ### Export to SIPA ![[Pasted image 20250401212322.png]] **Function**: `Exportar_A_SIPA()` This button exports alarm data to a format compatible with SIPA supervision systems: 1. Validates input data (checks for duplicate alarm numbers) 2. Transfers data to the "Per Supervisore SIPA" worksheet: - Reformats alarm/warning indicators - Creates appropriate tag names from DB/Byte/Bit values - Combines section assignments into a comma-separated list - Transfers priorities and descriptions - Indicates used/unused alarms 3. Offers to save the SIPA worksheet as a separate Excel file 4. Provides confirmation when complete **Notes**: - Only visible rows are included in the SIPA export - The "Per Supervisore SIPA" worksheet must exist - The export uses color-coding: blue for warnings, red for alarms This button will generate a file based on the current state of the Excel Sheet definition. ![[Pasted image 20250401211017.png|800]] ## Data Structure ### Excel Sheet Layout The main Excel sheet has the following column structure: |Column|Content|Description| |---|---|---| |B|Alarm Number|Unique identifier for each alarm| |C|DB|Data Block number| |D|Byte|Byte address within DB| |E|Bit|Bit address within Byte| |F|Priority|Alarm priority level| |G-K|Section.1-5|"X" indicates alarm belongs to this section| |L|Value|Value status| |M|Disable|"X" indicates alarm is disabled| |N|Is Warning|"X" indicates this is a warning (not alarm)| |O|Ons|On/off status| |P|Description|Alarm text description| |Q|Hidden|Used by the tool to track hidden rows| ### SIPA Export Format The "Per Supervisore SIPA" sheet has the following structure: |Column|Content|Description| |---|---|---| |A|Alarm/Warning|Indicator with color coding| |B|Number|Alarm number| |C|Tag|DB address in format DBx.DBXy.z| |D|Sections|Comma-separated list of section numbers| |E|Priority|Priority level| |F|Description|Alarm text description| |G|Used|Symbol if alarm is active, "-" if disabled|