Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: jeremyjo on June 22, 2016, 04:31:23 PM
-
I'm working on a project that contains 11 PID loops. One of them is pretty well on on it's own, while the other 10 will be very similar with identical tuning, just different PVs, SPs, and outputs.
The question is: when would you use a PID Memory Block instead of creating individual PID Heap Items? Is this such an occasion? Does the Memory Block approach make initializing and managing the loops easier or is it just a way to make a bunch of somethings at once? I guess I'm looking for an example use case for each type.
Thanks!
-Jeremy
-
The benefits of creating a data-block (say MyPID)
- You can create new PID instructions with the next unused MyPID ID without having to go to PROGRAM mode to create a new heap-item (for some systems, staying in RUN mode is critical, and whenever you create a new heap-item, that requires a change to the System Configuration, which requires a PGM mode download)
- You can do array indexing (e.g. MyPID[V0].SP), good for "indirect" addressing mechanisms or indirect addressing via COMM (e.g. Data View with MyPID[V100] and then just tweak V100 to 0 to see MyPID0 or V100 17 to see MyPID17
Benefits of Heap-Item
- The heap-item name IS the name - no need for a nickname for MyPID0, MyPID1, etc.
- No "memory map" issues, i.e. which process elements are tied to MyPID5 vs. MyPID6 if it was in a memory block
-
Forgot to check the notify button on my post.
Thanks for that clarification! Since runtime edits aren't a big deal here and indexing will probably be more trouble than it's worth for this simple setup, I think I'll go with adding them as Heap Items to make the naming more clear for future support.
-Jeremy
-
You don't 'have' to use indexing to use the data-block PID's, and you can also give each of the data-block items a nickname to use in your program. I rarely use the heap-items, and always use the memory blocks. That is my personal preference.
Either method should work just fine for what you are doing.
-
Probably bears mentioning that the purpose of the heap was to give the system a place to allocate structures associated with devices and code blocks. Once we had the heap, it made sense to allow users to allocate singletons like PID or Ramp Soak structures there, and gave the advantage of making the name something meaningful. There really is no right or wrong answer, just different benefits of each.