7/10/2017 10:30 PM | |
Joined: 7/7/2010 Last visit: 9/10/2024 Posts: 15166 Rating:
|
Ok, you may not like it, but after someone suggested it, I gave it a whirl, serialize. See attached. DB_in & DB_InOut: called by typing the DB# and portal fills in the name for you. Buffer_Size is a dint that is supposedly holds the count, but not tested it. It sure feels like it overlays DB4 on top of DB1 even though it may not. But it should be capable of a huge block move at the system level since it knows the size of the DB passed to it. Once you have the size of your DB, you can pass the Buffer_DB to the BITSUM as many others have mentioned. This is a strange mix of opt/non-opt db's. There are too many missing instructions to do everything we need strictly in optimized DBs. That said, with some careful thought into how the alarm system data is structured, I think you could generate some better approaches that would not require this approach. However, a simple approach would be to increment a global count anytime any alarm bit is set. Then if groups of alarm bits are reset, counts are subtracted, and if all are reset (which would in your case result in 2048?? individual reset calls, and 2048 individual decrements to the global count. A simple FB to set / reset alarm with an index into the UDT, the UDT as InOut, AlarmCount as InOut, and it can use the AT overlay with array of bool and the right bool is set / reset. You can then use the UDT defined names but set / reset via number. Simpler to use array but then you lose that option for a nice descriptive name for the alarm, or did they fix that for TIA Portal v18 SP2?
AttachmentDB_Size_Of_Something.zip (118 Downloads) |
science guy |
|
This contribution was helpful to
1 thankful Users |
7/11/2017 9:57 AM | |
Posts: 8946 Rating:
|
No. Please find attached your block. It is working fine with standard DB. It is NOT WORKING with "optimized" DB, as said in the manual also. Thank you for your efforts but it is not a solution. Attachmentbitszahelen_standard.zip (115 Downloads) |
7/11/2017 9:58 AM | |
Posts: 8946 Rating:
|
No, that is not what I am asking for. |
7/11/2017 3:53 PM | |
Joined: 3/14/2016 Last visit: 9/1/2024 Posts: 162 Rating:
|
Thanks, and yes, it is a new function on V14. I believe it's on instruction registers level, so I guess it is faster than using "Var := Var + 1". If it's not then it's just easier to code and read.
That is correct, you cannot define AT on the IN/OUT interface of a FB. But you can define it in the INPUT area, so... If memory is not an issue, at least for the 128 bools, I made a FB that will do the work. The scan time for a UDT Struct with 128 bools stayed less then 3ms(1511-1 PN on PLCSIM). The downside is you'll need a DB with the same memory length of your UDT. Project and SCL source code is for V14 SP1, if you want it for V13 SP1 let me know. AttachmentBitSumBoolStruct.zip (119 Downloads) |
"Engineers like to solve problems. If there are no problems handily available, they will create their own problems." (Scott Adams) |
|
This contribution was helpful to
1 thankful Users |
Follow us on