News:

  • June 06, 2026, 09:40:49 PM

Login with username, password and session length

Author Topic: PID Memory Block vs Heap Item  (Read 7952 times)

jeremyjo

  • Newbie
  • *
  • Posts: 4
PID Memory Block vs Heap Item
« 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

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3827
    • Host Engineering
Re: PID Memory Block vs Heap Item
« Reply #1 on: June 22, 2016, 05:18:56 PM »
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

jeremyjo

  • Newbie
  • *
  • Posts: 4
Re: PID Memory Block vs Heap Item
« Reply #2 on: June 23, 2016, 05:26:05 PM »
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

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: PID Memory Block vs Heap Item
« Reply #3 on: June 24, 2016, 07:24:04 AM »
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.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: PID Memory Block vs Heap Item
« Reply #4 on: June 24, 2016, 09:55:53 AM »
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.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO