jydepower

Structures text and user memory.

6 posts in this topic

Hallo. 

Can someone shed some light on how much memory st takes ?

does it use more that traditional ladder?

i find that a routine with a couple of thousands of lines uses over 500kB

is there any tricks to lower the usage? Or is it just what it is, and buy bigger cpu’s

Share this post


Link to post
Share on other sites

The following is not a useful comment but it will subscribe me to the thread so I can see the comments- A couple of thousand lines is a big structured text file. That said, I'm curious to know what requires the most memory, ladder or ST. It's a great question.

1 person likes this

Share this post


Link to post
Share on other sites

Been searching for some info on this.

I have not been able to find something that i think i really trustworthy yet...

Only this sheet documenting execution times and memory usage for instructions up until Studio5000 V21.

https://rockwellautomation.custhelp.com/app/answers/detail/a_id/55244

 

I am not sure that this is the truth, but to me it looks like the instructions take up the same amount of memory. (still there is a difference in excecution time... and looks like ST is slower than ladder) :-0

There are no memory usage in the structured text tab, for the instructions except the IF..THEN..ELSE statements in the bottom. (This is why i think the instructions take up the same amount of memory)

 

From what i read, the place where you will gain most memory, is by optimizing your tags... Etc. dont declare boolians, but instead declare either a DINT or an array of boolians.

Rockwell 5K processors work in 32bit, so all tags you declare will minimum use 4 bytes.... 32 single bool's will use 32 * 4 bytes, where a single dint with 32 accesable bits will only use the 4 bytes.

Now theese numbers above is only "theoretical", because apparently when using the newer versions of Studio5000, memory is also reserved for the tagname and tag description.. I did not know this untill i read it the other day, and i was really surprised with the tradeoff in memory you have to make, to be able to upload a full program with tagnames and comments.

 

Would be cool if anyone actually know the details, because it is kind of hard to find info on this.

1 person likes this

Share this post


Link to post
Share on other sites

Hallo jobbe9000

Thanks for the great info you found. It does answer some questions. 

I see that the FOR construct does use a lot of memory. I have many of those. I’ll look into converting as many as possible to traditional pointing increment. 

Share this post


Link to post
Share on other sites

Jobbe9000 gives great advice on using DINTs instead of individual BOOLs. Every time you create a tag as a BOOL in CLX, you still consume the volume of a DINT. Probably not a big deal if you're running a small process that's just turning things on and off. But this is extremely important when running large, high speed processes, particularly in closed loop systems where you may be evaluating data and bandwidth hogs, like PIDs. Even if the "space" available in the controller is not an issue, it just makes better sense to allocate memory in the controller's default data type, DINT, because it makes for a more efficient running controller.

Starting in Version 21 (when they changed from RS5000 to Studio-5000) the tag names, descriptions, rungs comments (virtually all of the internal documentation) was now downloadable to the controller. That means anyone could walk up to any controller and have that info available on the rungs, without having a pre-existing, off-line copy of the project on their laptop. You still have to have a matching copy on your laptop, but Studio will create it for you when it sees one doesn't exist. (It's not automatic; you have to follow the prompts and click on some things). The tradeoff is that the documentation eats up space in the controller, hence tag names consume space, as described above by Jobbe9000. You can disable this feature by unchecking a couple of boxes in the project properties dialogue box, under the Project tab. I've attached a .pdf showing where to look if you're not familiar with it.

Also, from personal experience, I can tell you for a fact that structured text executes significantly slower than ladder. When looking at the task monitors while similar codes in ST or ladder are executing in separate, identical controllers, ST is about 5X slower. Therefore, I only use it for instructions that don't exist in the other CLX programming languages. That said, Rockwell brags that the new 5580 controllers can execute ST just as fast as ladder, but I haven't been able to lay hands on one of those $6,000+ cards to check it out.

Hope you find this useful.

S5K.pdf

Share this post


Link to post
Share on other sites

I use boolean arrays all the time. I can think of quite a few programs that 20 different Bool[32] arrays and haven't noticed memory problem. The same programs use 8-ish Bools in a UDT that is often used 100's of times. I need to check the programs and see how much memory they are using up. I originally use (and prefer) DINT but in the aforementioned programs I was accommodating the guy that was doing the HMI work (well after we completed 50+ sites he told me I could have used DINT's ;-))

I use structured text to map IO to tags, GSV's, and for computations in AOI's. One is a couple of hundred lines and it executes fast enough for what I'm doing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now