Jump to content
GonzaloRoldan_

Dynamic Table or Array

Recommended Posts

Hi!
I'm programming an UniStream Modular USP-070-B08 + CPU USC-P-B10 with UniLogic v1.25.61.
I want to create an array of INT16, which its length, will be set by the user through the HMI. Is it possible? Because when I create the array in Ladder, I can only set a constant value for the array's length.

I want to try something similar with the number of rows for a table.
Thanks in advance!

Share this post


Link to post
Share on other sites

Hi Gonzalo,

that I know is not possible, at run time or in late binding,   decide the length of an array or of a DT...you have to do this at compile time.

What you can do is store (append) in a SD file, or in a SQL table, the DT and recall these.

Share this post


Link to post
Share on other sites
13 minutes ago, ORSO2001 said:

that I know is not possible

I'm pretty sure memory must be allocated during compile. @GonzaloRoldan_, why do you need to do this? You have only a finite amount of memory available. Just define your array or table to the maximum size you think you might need and work with that.

Share this post


Link to post
Share on other sites

Hi Orso and Flex. First of all, thanks for your answers!
Considering what both are saying, I understand that it's not possible to do it.

The reason why I wanted to do it @Flex727 was that the vector size depends on the result of a mathematical equation, which most of the time is under 100 combinations, but sometimes is over 10000 combination. And I did not want to create a vector which length is 10000 when around 90% of the time, it won't be needed to be more than 100 of length.

But no worries, I'll do what you recommend.

Thanks again!

 

Share this post


Link to post
Share on other sites
2 minutes ago, GonzaloRoldan_ said:

And I did not want to create a vector which length is 10000 when around 90% of the time, it won't be needed to be more than 100 of length.

The PLC doesn't care.

Share this post


Link to post
Share on other sites

I tryed to create an array with length 1000000, max that I could get was 512  (0-511)

This goes for all types.

the way i did it was: 

- click global in bottom line, 

- add tag

- fillin name, type, array length

length over 512 colored red, not accepted

what do i do wrong?

 

Share this post


Link to post
Share on other sites

You haven't done anything wrong.  I fired up UniLogic and played with arrays myself - you've just discovered out the undocumented maximum array size.

There is 1M of total memory of which 256K can be retained.  

Joe T.

Share this post


Link to post
Share on other sites

Thank you both for your swift answer.

The reason I tried such large arrays is that I do not understand the way datatables work.

The whole subject of storing and retrieving data is unclear to me, just is importing and exporting data to PC.

I suppose that happens with beginners.

I tryed to follow the video about datatables (and some others) on utube. There I have a problem.

Since my hearing is somewhat impaired, I cannot fully understand what is said.

I followed a number of seminars, there I lost the thread very swiftly also. 

The speed is very high, wich makes it worse. Repeated stop, wind back and replay made things not better, neither did half speed.

There was one video where there was subtitling during a short time. That cleared up things enormously.

I wonder if I am the only half deaf person using utube.

I will contact my contact at Unitronics. They are very helpfull, but I do not want to bother them more than I need to.

 

Share this post


Link to post
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...