Codesys - Upload and Save Parameters?

Paullys50

Lifetime Supporting Member
Join Date
Jan 2006
Location
WI
Posts
2,188
Coming from the world of Rockwell I am used to saving and uploading current parameter data, which then get downloaded with the logic if I do another download.

I'm trying to understand how this works in Codesys, I see I need to be concerned with retaining values during a power loss (such as analog scaling parameters), but I also want to commission a system, and save the program and all the parameters and download it into a sister system since they will be the same, or if the controller has to be replaced the program can be downloaded an off you go.

As I seem to understand, I have to design this data retention with VAR RETAIN and PERSISTENT, but that seems to only apply at the controller level. Will the actual data ever be saved with the project file? Or will I have to add logic to initialize hard-coded values into the system critical parameters?
 
you will need to make a file on some memory to save them outside the PLC.
depending on target (type PLC you can use internal memory for it, however it must be a file outside the program (that is compiled)
 
If these are truly constants, then I would just hard code them. If they are getting changed by some other means(HMI), then you will want to use another method. What controller are you using? You may have to declare a section of memory to be retained for variables to be truly retained.
 
Depending on the hardware, you should be able to write to a FTP location or memory card. You can then write a script that will write all of those values to the card. Similarly, you can use another script to load them all back in.
 
I grew up in the world of Rockwell too and saving data is a relatively new thing.

The way I handle this in CoDeSys is to write my set-point and similar data to a file in the PLC flash. I then can read this file either automatically (power turn on, for example) or manually. The commands to use are sysfilewrite and sysfileread.

Good luck,

Yosi
 
Be aware that writing to a flash card constantly will eventually break the card - consumer grade devices having a limited erase/write cycles per block of 500 to 3,000 - industrial grade device have more (maybe 10 - 50 times more).

So, limiting the writes to just when power is going down (Beckhoff systems have a method for doing this) or only when the data changes will ensure a long life.

edit: wear-leveling can help by putting data in other blocks than the original to spread out the wear.
 
Thanks for the feedback, seems like a PITA.

Right now I'm just testing in simulation mode to get familiar with the Codesys programming environment. Having a separate file doesn't make much sense and while I'll accept hard-coding in places, there are other places that you just can't. Retaining vales on the controller sorts out power issues, but if the controller is ever replaced or it's a duplicate system you have to set all the various control set points back to 'default' some how. And if they ever change simply saving the project won't capture that.

There's always a catch isn't there?
 
First, Rockwell's method of also uploading/downloading all tag values and all tags being retained on power cycle is really weird and is the abnormal thing.

In the rest of PLC land, you can mark a variable (tag for you AB guys) as volatile (the normal, loses value on power cycle way), retentive/remnant (keeps value on power cycle, but is wiped by a "cold restart") or permanent (takes a special command to erase). Only your code is uploaded/downloaded and you either hard code values or you keep them as a recipe (either stored in permanent memory or a recipe file on the flash card).

Every PLC maker I've come across has a way to pull up all the variable value information and transfer it to a second system for serial commissioning and/or backup. For Schneider, they have controller assistant; for B&R, they have the runtime utility center (aka PVI transfer tool); for Beckhoff, I don't know, I never did it, but I'm sure there is something. Of those three, Schneider is Codesys, but controller assistant isn't baked into Codesys.
 
Be aware that writing to a flash card constantly will eventually break the card - consumer grade devices having a limited erase/write cycles per block of 500 to 3,000 - industrial grade device have more (maybe 10 - 50 times more).
.

Absolutely right on that point. The idea is to write only when you need to. We almost exclusively use industrial flash cards.

Don't forget though that since it's a file you can always fileZilla it (if your PLC supports FTP.)
 
First, Rockwell's method of also uploading/downloading all tag values and all tags being retained on power cycle is really weird and is the abnormal thing.

While I agree it would be great if you could chose what you want to download (logic, values, both) like you can do with a GE PLC the value of upload and save values is priceless. Same with retaining values. Granted I'm used to working on large process systems where there are thousands of set points that are critical and can be changed at any given time and saving these set point changes to a separate file constantly just seems bulky. You'd need a PLC code save that syncs with a data file save, maybe I'm just missing the value.

On these large systems hard coding every device range and configuration would be impractical, especially if things change during commissioning. Simply going online and doing a save and upload gives you snap shots and you can go back to.

I've experienced enough power failures in facilities that if all the data were not retained, that'd be a pain to get back up and running. You'd have to throw a UPS in every system. Then re-download the values prior to running again. Granted tagging them as retentive alleviates some of that but seems that you have to pay more attention to the software design.

Saving data and defining it as 'recipes' doesn't make much sense either. Coming from the batching world recipes are a collection of data values which dictate the process control set points, not necessarily other configurable system set points such as time delays, alarm watch dogs, and device configurations.

I'm sure arguments can be made in both directions, just something new for me to learn and consider.
 
I grew up in the world of Rockwell too and saving data is a relatively new thing.

The way I handle this in CoDeSys is to write my set-point and similar data to a file in the PLC flash. I then can read this file either automatically (power turn on, for example) or manually. The commands to use are sysfilewrite and sysfileread.

Good luck,

Yosi

I know that it is an old thread but I have a controller without the non-volatile memory for persistent variables saving so I have to find a way to save and load all setpoints and parameters to/from text file on sd card.

Could you provide any examples on how you do it?

Thanks
 
There should be a library on your platform that does it. On Moeller it used to be:
IF gxSaveRetains THEN
DINT1 := SysSaveRetains('\StorageCard\BackupRetains');
END_IF

IF gxRestoreRetains THEN
DINT2 := SysRestoreRetains('\StorageCard\BackupRetains');
END_IF
 
There is no library for doing this.
I'm able to read and write data in a text file using CAA_File library and I'm just looking for a clever way to write the around 200 values into the text file and the uploading the values into corresponding variables during start-up.
 

Similar Topics

Hello, I am using a Hitachi Micro EHV+ for a small project, and I wanted to have a Web visu, done with Codesys V3.5 SP13 Patch 2. I test the...
Replies
6
Views
290
Hello, I have a requirement to manage the text alignment dynamically. So, for example: 1. English Texts should be displayed from Left in...
Replies
0
Views
90
Hello, I am new to Codesys, and am trying to learn about it for a project we're developing. I've got a couple questions, but first a little...
Replies
1
Views
140
Hi everyone, as this is my first experience with Rockwell Software i would like to know what's the best way to make Enumerations?
Replies
10
Views
501
I am trying to get Codesys to work with a couple of Moxa ioLogik E1200 series DIO devices (E1210 and E1211). I am able to write to the E1211 DOs...
Replies
2
Views
168
Back
Top Bottom