SoftPAC losing it's values and strings

Is there a way to save or back up all your internal values and strings to a file and load that file on start up of SoftPAC? I was working on a project with SoftPAC and Groov. All of a sudden the power went out and when power was restored, I started my computer (luckily I just had saved everything right before it happened) and when I load groov all my values are blank. So, I check out SoftPAC and it is on, but no charts are running. Seems I didn’t have the Autorun Enabled. So I Enable it and then Run my strategy. SoftPAC is good to go. I click back to Groov. All my values are still blank. So now I have to retype all the data again and yes all my values and strings are persistent.
What makes SoftPAC (Version R9.5a) dump the values? I need to protect this from ever happening or at least if it does it will load the most recent values on start up. Is there a way to do that?

You could try the Opto Tag Preserve utility - never tried it on SoftPAC though (Docs say it’s compatible).

Thanks philip.
That did work correctly with SoftPAC.
However, I will need something that is a little more automatic. Something like SoftPAC writes a list of tags and values in a location on the hard drive or usb stick every hour and if it loses the values, then it can just upload the file and restore the values. Any other ideas? Can a SoftPAC controller mirror another SoftPAC controller?

You can write a script that calls the Opto Tag Preserve utility and set it up to run from the Windows Task Scheduler.

It’s a bit more work, but you can also program the strategy to write the important variables to a file and then restore from the file when the strategy starts if it detects memory loss.

Yeah, How do I make that file and recall that file? … I actually would love to know how to do both of those ideas.

Before you do all that, @Drenton , sounds like what you’re looking for is persistence.

Were any of your variables configured as “Persistent”? Vs. “Initialize on strategy download” (which is another feature that might be relevant here) or “Initialize on strategy run” (which will just set each variable to whatever you choose for “Initial Value”, the default is 0).

SoftPAC should work like other PACs that way. Ditto for the Autorun flag. (Rather than that info being stored to flash memory, it gets written to a little file in the same directory as your SoftPAC.exe.)


Oops, sorry, I just saw you had them set as persistent. That’s a bug, then. It should work (and might’ve already been fixed, I’ll check the readme…)

If you are using PAC Display, you can use the recipe save and restore.
(That’s how we do it at the hospital).

Yes all my variables are Persistent. I only have FW version B9.4d for SoftPAC, so maybe it is fixed. The SoftPAC running on my Windows 10 PC or Windows 7 PC will not send emails with versions 9.5+ loaded, so I am stuck with version 9.4d for now. Kathy called me yesterday to figure out what was going with the emails and SoftPAC, so we’ll see.
So far I pulled the plug on my PC twice now and have not been able to duplicate what happened to me earlier, but if I am going to be successful at what I am trying to achieve I simply can not have SoftPAC lose the data and if it does, I need a fast solution to get those values back quickly.
If I can duplicate it, I’m curious to see the time stamp on that “File” located in the directory is. What is the name of that file?

It’s a hidden file named O22PersistSP.O22 on my system. It’s in the same location as SoftPAC.exe as Mary stated.

Hmm… so can I just make a backup of that file and copy it to the directory in the event that something happens?

@Ben I’m using Groov for this project, but that is a good idea as well. Just have a “blank” runtime running and just trigger it with the strategy.

I don’t think that will work, as the persist file isn’t written to that often - possibly only when SoftPAC shuts down (that’s the only time it wrote to the file in my limited testing). That is the likely reason you lost data when the power was lost suddenly.

The relevant SoftPAC files here (for example, if you use the defaults when you installed 9.6, like I did), can be found in:
C:\Program Files (x86)\Opto22\PAC Project 9.6\SoftPAC
They start w/O22 and have an .O22 extension.

While we’re brainstorming work-arounds (I can never resist a good brainstorm!), you could also leverage the Scratch Pad part of SoftPAC’s mem map, which you can “save to flash” (also written to a little file) values like those you could store in the Int32 or String part of the Scratch Pad mem map section. Do you see what I mean here? Of course, if you repeatedly store that info to the SoftPAC “flash,” you’d have to be careful if you ever ran the same strategy on a hardware PAC, since you could very quickly wear out the real/physical flash.

Warning: Sometimes when I brainstorm I come up with wacky impracticable ideas, but they often trigger someone else’s more useful idea. Or at least get the gears turning…

I found the file. Mine says it was last modified on Mar in 2017. But that raises an interesting question. If I test multiple projects with SoftPAC on the same PC, can I save that file and store it with all the PAC Control projects I test? That way I wouldn’t have to enter new values every time I change what is loaded in SoftPAC?

Yeah, mine says 10/2017 - Windows isn’t updating the modified date, but the file does get written to (verified with procmon). You should be able to backup that file to run a different project on your SoftPAC. You will need admin rights to write to it (to copy it back).

@Mary … If the flash got worn out, is it replaceable? Just curious.

So this all comes back to this one file then. When the power went out, did that file get corrupt and it just gets overwritten?

Mary is this all correct?:

O22FlashSP.O22 <- The saved strategy file, read on startup, written after strategy download when “Save strategy to flash memory after download” option is enabled.

O22PersistSP.O22 <- Persistent variables are saved here - they seem to be kept in RAM and then saved to this file when SoftPAC is shutdown - so a dirty shutdown and you won’t have the latest values of your persistent variables.

O22Config.O22 <- This is where all the memory map data is stored if you call a “Store configuration to flash” or write a 0x03 to 0xF0380000 of the memory map. WriteIoUnitConfigToEeprom command will probably do this too if you set the IO unit up as something other than Generic OptoMMP. This file is written as soon as requested.

Ok, so I tried coping the file over. I copied the Persist file before I shut down SoftPAC and after. Then just changed the FW to 9.5g (wanted to see if email works with that version… It doesn’t) which dumped everythg. Loaded the strategy then tried coping the file to the directory. Neither file worked.
Then I load FW 9.4d, which dumped everything (awesome, email works again). Then I copied the persistent file back to the directory and neither file works. …Strike 2.

@philip I just loaded my values back from the Opto Tag Preserve utility …thanks for that. Saved some time there.

Make sure that SoftPAC is stopped* when you copy or restore the files. Also, I wouldn’t expect the files to be compatible between firmware versions. Firmware upgrades specifically state to use the Opto Tag Preserve utility.

*I mean make sure SoftPAC is stopped (off) in SoftPAC Monitor - or through windows services.