Jump to content

Structured Text and Efficiency


Recommended Posts

Currently looking to implement c or structured text code into my Unilogic programs for more storage optimized / memory efficient programming. I am curious to see if anyone has noticed an increase in performance after implementing the Structured Text feature implemented in 1.34, or if anyone who uses the C editor regularly has found gains in doing so. Let me know how it's worked for you!

Link to comment
Share on other sites

Really depends on the rest of the code & how complicated it is.  
 

For my applications these PLCs can handle a lot more than I can throw at them.  
 

We typically do 2 systems per PLC.  I had a request to drop 12 systems into a single PLC and it handles it well.  But then again it’s not real intensive as I only need 5-second resolution/updates.  
 

Your mileage may vary.  

Link to comment
Share on other sites

  • MVP 2023

Generally people use Structured Text or C code because they have something math intensive or they're just plain more comfortable with it because of their background.  You don't really gain a lot with it because its just another form of compiled code.

What is your application?
 

Joe T.

 

Link to comment
Share on other sites

On 5/17/2024 at 6:56 PM, Joe Tauser said:

What is your application?

Data collection / mapping. At a user set time interval, the values from dozens of tags are read into one big data table. I noticed the store instructions were very cluttered in ladder logic and didn't know if it would save space to have them mapped in structured text over doing it with the "store" element

Link to comment
Share on other sites

  • MVP 2023

When people first start using UniStream they create a lot of single tags for use in their program.  The real power of data manipulation in UniStream starts when you start using arrays and structs.

Indexed Data tables in UniStream are by design based on a Struct.  If you have control of the application, you can create one struct that has members representing the tags you need to log.

A struct is nothing more than a template.  You can have multiple tags based on the same struct.  If you create a tag based on the struct and populate its sub-members throughout your program then writing all the data to a data table is on function block - "Insert Row to DTI".

If you can post your program we can have a look and see how it can be optimized.

 

Joe T.

Link to comment
Share on other sites

On 5/22/2024 at 10:51 AM, Joe Tauser said:

When people first start using UniStream they create a lot of single tags for use in their program.  The real power of data manipulation in UniStream starts when you start using arrays and structs.

Indexed Data tables in UniStream are by design based on a Struct.  If you have control of the application, you can create one struct that has members representing the tags you need to log.

A struct is nothing more than a template.  You can have multiple tags based on the same struct.  If you create a tag based on the struct and populate its sub-members throughout your program then writing all the data to a data table is on function block - "Insert Row to DTI".

If you can post your program we can have a look and see how it can be optimized.

 

Joe T.

Part of my problem is that I have created structs that stores / processes individual sensor data, which forces me to transfer that data over to a different struct that handles data collection. I definitely appreciate the feedback, and will incorporate it into future projects!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...