-1
Under review

Persistant Virtual Server Variables : how to get them working?

Dennis Piet 4 years ago in Bugs and problems updated by Vladimir Ovchinnikov (expert) 3 years ago 8

For a parkingsystem I use some Virtual Commands / Channels in combination with Feedback / Tags to store the maximum capacity of a parking.

For example, for Parking 1, I have

Server.Channels.P1_Capacity

and

Server.Tags.P1_Capacity


As per the manual I have connected them with the virtual_to_virtual in the script modifier of the channel (and now with newer Iridium Studio version I can also use Forward Value To for this)

I have set the Persist property of Server.Tags.P1_Capacity to true.

Expected behavior : after server reboot (or restart after powerloss), the Capacity variables keep their last know value.

Actual Behavior : after restart, all Capacity variables are 0  , so the parking manager has to fill in the capacities again for all 6 parkings.

How can I fix this???

Just to try and understand what is happening, I removed the virtual_to_virtual relation (or the forward) and then manually set the value of the feedback through the webinterface.  Now, when I restart the server, the value persists.

So, I guess the problem is the persisting feedback is overwritten by a 0 value coming from the command just after startup of the server?

Can some admin please moderate this posting, so other users can respond?

Under review

Hello.

In the current release, the "Persist" and "forward value to" parameters should work correctly. Attach your project that is not working correctly.

Thanks Vladimir, I have tested again with my project running on the latest server release and did not get it working as expected. All virtual feedbacks were still empty after each server reboot.

Then I made a new simple testproject with only 1 persistant virtual command forwarded to a virtual feedback, just to show you what settings I was using. To my surprise in this sample-project (with exact same settings) persistency worked perfect.

Then for further testing I added one more virtual command/feedback combination to my main project. This new variable kept it's value after reboot (exact same settings as the P1_Capacity variable mentioned above), but the old onces still did not persist.

At that time, I decided to delete all old persistant variables and just recreate them with exact same names and properties.

So I guess there was something wrong in the way these variables were stored in the serverprojectfile, that could only be fixed this way.

Hello.

You did the right thing. If the project was created in an old version of the Studio (which had an error with saving feedbacks), then you need to delete these feedbacks in the current release of the Studio and create them again.

Do you have any more questions?

In our current project we have updated the server-project many times to implement all requests by our client.

We have seen every time we upload a new server project to the UMC server, all virtual tags are reset to 0.000000, including the ones we have set to persist.    Why is this happening and what can we do to fix it?

In this project it means every time we change sometime on the server-project the client has to set openingtimes of the parking-lot and he loses the current car-count. Of course this is unwanted behavior of the software.

iRidium Studio: 2.0.21.25286 (64 bit)
Server: 1.3.26

Hello.

After loading the project, the server restarts to read the new configuration. During initialization, there will always be zeros in all tags. If you want to see the values in the virtual tags that were before the server restart, you can enable the "Persist" parameter for the necessary tags or enable the "Store in DB" and "Load on start" parameters. This will write the early values to the virtual tags. Until then, there will be zeros in the tags for a short time. Therefore, consider this feature if you use zeros from tags in some conditions (in JS or Routines).

+1

In my projects, the "Persist" paramater only works during server-reboots, NOT after loading a new project version. So every time I change something, the values get lost.   If I read your answer correct, this is not what should happen ?????

In my opinion, the persistent variables should keep their values also after loading  new project version, at least when the variable is still used in that new project version.

Only when the variable is not in the new project version anymore, it should be erased from persistent server memory.

Hello.

When loading a new version of the project: the documents of the old version of the project are NOT deleted (they remain in the same directory), but the documents of the new version of the project are added (in the same directory). The current value of the variable for which the "Persist" flag is set is stored in the file "*_cur. per".

The list of files of the uploaded single project looks like this:


After downloading a new version of the project, the list of files is as follows:

As you can see, the old files remained in place, they have values for which the "Persist" flag is set, but they are no longer used.

Attention! Do not edit these files manually! This may cause the project to fail.


If you often upload a new version of the project, then use the "Store in DB" flag instead of the "Persist"flag. The DB file remains the same.