Jump to content

PID struct retain


Recommended Posts

Hello Ray,

It seems that you can't have the struct retain on its own.

Alternatively, you should be able to STORE the information you want retained into placeholders. You could use the startup bit "General.Ladder Initial Cycle" and move that info back into the PID Config struct values you want to retain.

I hope this helps!



Link to comment
Share on other sites


For PID there are 2 structs:

PID Config - This is non retained struct which will be used for running the PID.

PID AT Parmas - This struct can be marked as retained.

Once you completed your manual tune or autotune, you need to use the Ladder element "save PID Autotune data" from the PID Config  struct to the PID AT Parmas struct.- This will save the PID data into the retained struct.

On power up you will use the ladder element "Load PID autotune data" from the PID AT Parmas struct to the PID Config  struct.

  • Upvote 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi Ofir and all


My problem is the the PID AT Parmas struct is not retaining  although it is marked as retain.

I am trying to find a workaround for that, and in addition to  be able to save/load PID parameters from SD card.

I define a user struct with exactly the same members like the system struct . this i wanted to use for indexed data-table that i can write one row into and save it as a UDTF file on the SD.

my problem with that solution is that Copy struct function is not working with the system struct . The only thing is to to is to use  few Store functions each for one PID value.

My questions:

Why the system struct PID AT Parmas struct is not retained as its set to be?

Any way to copy a system struck valued to a user struct as a whole?




Link to comment
Share on other sites


PID Config struct is non retained. Running PID  will use PID Config struct.

Once completing Autotune or manual tune, you can use the Save PID Autotune data ladder element. This will save the PID config struct to a PID AT params struct.

Then on power up you can use the Ladder element Load PID Autotune data from PID AT params struct to PID config struct.

Please make sure that the PID AT Params struct is checked as retained.

Link to comment
Share on other sites

  • 4 months later...

Hello Ofir.

I have a client system using a PID loop for temperature control. To investigate a separate problem (as in D Green's recent FTP post) I would like to download and run a new, different, temporary project; and subsequently restore the original. I believe however this will destroy the original retained PID AT settings, which I would like to restore, possibly from a file, to avoid having to run the (lengthy) PID Autotune again.

Is it possible save the PID AT params to a file on the SD card, as it is with any user-defined structure using a data table?



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

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...