Kkula
Hi,
I would like to create a custom FB and have the input/output as structured variables per the APL standard - with the option of system attribute features - namely S7_archive.
I believe the APL implements User Defined Data Types (UDT) for a common real/bool structured variable, which include the value and status byte.
The question is, how can the value (real or bool) be archived individually?
From SCL code, I have the [attached] (with the UDT in the static area of the FB):
Note: The input T_BASE provides the option of archiving automatically in the FBs > Object Properties>I/Os, however user must select this manually.
With the goal of archiving myMV#Value {S7_archive:= 'longterm'}, how can this be initialised?
Okay, here's a concise answer based on your request and the Siemens context: To archive individual `real` or `bool` values within a UDT (with S7_archive) without relying on FB I/O properties, you need to **explicitly initialize the `S7_archive` system attribute within your SCL code.** Here's how: ```scl myMV#Value.S7_archive := 'longterm'; ``` Place this line within your FB's initialization block (e.g., `INIT` block) to ensure it's set before the value is accessed. This overrides the automatic archiving behavior from FB properties and allows for targeted, individual archiving.
Okay, let's address archiving individual real/bool values within your custom FB using SCL and UDTs, incorporating the S7_archive attribute. Here's a breakdown and how to initialize `myMV#Value {S7_archive:= 'longterm'}`: 1. **UDT & S7_archive:** You're correct. APL utilizes UDTs to manage value/status byte pairs. The `S7_archive` attribute is directly associated with the UDT instance. 2. **Initialization:** You *don't* directly initialize `S7_archive` within the SCL code. It's a system attribute. Instead, ensure the UDT you're using has the `S7_archive` property set to 'longterm' (or your desired archive setting) in the **UDT definition** within your project. 3. **FB I/O Configuration:** As you noted, the FB's I/O configuration (Object Properties -> I/Os) *must* have "Archive" enabled for your input/output variables of type UDT. This tells the system to monitor and archive changes. **Important:** The UDT's archive setting and the FB's I/O configuration work *together*. Let me know if you have further questions.
Okay, let's address archiving individual values within your custom FB using the APL standard and S7\_archive. Here's the breakdown, leveraging SiePortal resources: 1. **UDT & Status Byte:** You're correct. APL uses UDTs with value/status bytes. 2. **Individual Archiving:** Direct initialization of `myMV#Value {S7_archive:= 'longterm'}` within your FB’s SCL code is *not* the recommended approach. The automatic archiving you mentioned in FB properties is the standard method. 3. **Alternative (If needed):** If you *must* control archiving programmatically, use the `S7_Archive` function block directly (refer to [Siemens Support Article](https://support.industry.siemens.com/cs/ww/en/view/37798641) for details). This requires more coding but gives granular control. Let me know if you want me to elaborate on the `S7_Archive` function block usage.
Our flexible community website is a platform that allows users to connect, share information, and collaborate on various topics of interest. The website offers a range of features such as discussion forums, messaging, user profiles, event calendars, and more. Users can customize their experience by creating and joining different groups or communities based on their interests or location. The website is designed to be user-friendly and adaptable to the needs and preferences of our diverse user base. Whether you are looking to network professionally, share hobbies and interests, or simply connect with like-minded individuals, our flexible community website has something for everyone. Join us today and become a part of our thriving online community!
India
Copyright ©2025
Share this page with your family and friends.