How to Store IO Addresses for Individual Valves in TIA Portal using User-Defined Type Fields

Question:

Greetings! I am utilizing a Siemens SIMATIC S7-1200 PLC with a SM1221 DC input module, operating on TIA Portal V18 and programming in SCL. I have a total of 8 identical devices in my setup and I am considering creating a User Defined Type (UDT) named 'Valve' to organize all the necessary information as distinct fields within the data type. However, I am encountering challenges in figuring out how to incorporate a field that can store the IO address for each individual valve. This will enable me to assign a unique address to each Valve at the beginning in a database and create functions that can operate on every instance of the Valve UDT to determine if it is open or closed. I am aware of the ability to link multiple PLC tags to a single UDT, but my intention differs. I aim to have a UDT with various fields, one of which is specifically designated for the hardware address/PLC tag, allowing me to read the state of a specific valve programmatically. Any guidance or suggestions on how to achieve this would be highly valued! I am relatively new to TIA Portal and would greatly appreciate any insights. Thank you!

Top Replies

When passing the digital input to the function as a boolean, be sure to also pass the User-Defined Type (UDT) for easier cross-referencing of inputs. While storing the input address in the UDT is an option, it may require the use of indirect addressing to access the input state efficiently.

Thank you for the valuable advice! It appears that indirect addressing is the optimal solution for me in this scenario. Your solutions surpass what I had initially considered.

Hi! It's indeed a bit tricky to do what you're attempting directly in a UDT because the I/O addresses are physical associations and therefore, can't be assigned dynamically to a UDT instance. Instead of storing the I/O address in the UDT, you might consider creating an additional standard DB (data block) where you store the I/O associations. In your function, you could then take this I/O map database and the current Valve UDT as inputs and read the state based on the given information. Another alternative is to assign an ID for each valve and use a multi-instance data block where each instance corresponds to a valve, matching the ID with the corresponding I/O address. This way, you can still use UDTs to keep your code organized and clean, while addressing your unique valve identification concern. I hope this proves helpful!

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

FAQ: 1. How can I store IO addresses for individual valves in TIA Portal using User-Defined Type (UDT) fields?

Answer: - To store IO addresses for individual valves in TIA Portal using UDT fields, you can create a UDT named 'Valve' with a specific field designated for the hardware address or PLC tag. This will allow you to assign unique addresses to each valve and read their states programmatically.

FAQ: 2. Can I use a UDT to organize information for multiple devices in a setup?

Answer: - Yes, you can use a UDT like 'Valve' to organize information for multiple devices in a setup. By creating distinct fields within the UDT, you can efficiently manage data related to each device, such as IO addresses for individual valves.

FAQ: 3. How can I operate on every instance of the Valve UDT to determine if a valve is open or closed?

Answer: - To operate on every instance of the Valve UDT and determine if a valve is open or closed, you can create functions that utilize the fields within the UDT, including the one storing the IO address. This will allow you to programmatically read the state of each valve based on its assigned address.

FAQ: 4. What version of TIA Portal supports creating and using User-Defined Types (UDTs)?

Answer: - The ability to create and use User-Defined Types (UDTs) in TIA Portal is supported in various versions, with the user mentioning TIA Portal V18. It is recommended

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’