8/31/2018 7:38 PM | |
Joined: 5/14/2013 Last visit: 8/16/2025 Posts: 13 Rating:
|
Hi, I dont need exactly an a dynamic array, i just want to create an array with fixed length in run time. im using step 7 v15, my main idea is something like this. create a db with create_db function, and declare an array with fixed length in it, if i need to change the length of the array, just create an other db with a new array, and copy the values of the old array, then delete the old DB. Is this Possible? Thanks!!. ------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 9/3/2018 10:15:32 AMNew subject after splitting |
|
9/4/2018 10:30 PM | |
Joined: 7/7/2010 Last visit: 9/3/2025 Posts: 16056 Rating:
|
Sure it is possible, but you may be better off to create the maximum size OB you could ever possibly use. Then you can configure how many "records" of the DB are used which can change as your project sees fit. Creating and deleting DBs takes several plc scans. During that time, you would not be able to process data and store to the new DB.
|
science guy |
|
This contribution was helpful to
1 thankful Users |
9/5/2018 10:51 AM | |
Joined: 9/8/2009 Last visit: 7/17/2023 Posts: 1410 Rating:
|
Well that could be a definition of dynamic array.
How would you address the new created DB? I mean, you can't make random structures, unless they are well predefined with UDT,...It makes useless to create/remove DBs with several different structures. It can be done equally with fixed DB, no need to create and remove. Same rules apply: you can't have a datablock larger than certain ammount of space. With the use of non-optimized DB, you can create a DB with data of type BYTE[N] , then you can use AT statement to declare several overlaping structures. Since these structures are known "a priori" then you get the same functionality as dynamic array. |
Last edited by: Marko Bursic at: 9/5/2018 11:04:53 AM |
|
This contribution was helpful to
1 thankful Users |
Follow us on