SeanT,
There are a few things I want to comment on here… They are all somewhat linked, so I hope you can untangle my thoughts here as we walk through them all…
First up, the writing of the OX03 to mem map address F038 0000 is a bit of a backdoor way to save the unit configuration to flash.
Since you are doing the save via this method, it does not take into account what the strategy is doing when the save to flash gets triggered.
The strategy could be up to anything, and yet, this event message is just going to fire off and do its thing.
Not the cleanest solution in my humble opinion.
What I have done in the past is to do the save configuration to flash from within the strategy… We use the PAC Control command ‘Write I/O Unit Configuration to EEPROM’.
By doing it in the strategy, we have more control over whats going on when we fire the save… For example, we make sure all charts are stopped, this way we know that nothing is writing to the I/O unit when the command is issued.
Also, we can delay a good amount of time after we issue the command. Depending on your rack size (4,8,12, or 16), the number of modules in the rack the number of PID loop’s configured and the number of event reactions you have set up, the command could take a few seconds, the manual states 2 seconds, my chart waited 5 seconds.
Lastly, after that delay was up, we can re-enable the I/O unit (necessary if its an EB or an R).
You mention that you feel this command does not always work because the digital outputs are not always restored…
This command, BOTH the 0x03 or the PAC Control command do NOT save the state of the digital output points.
The commands save the [I]configuration[/I] of the I/O unit, [I]not[/I] the state… The configuration is what modules are plugged into what positions, what PID’s, what event reactions, analog filter weight, scaling and so on.
It does not save digital point or analog point state.
So to answer your question about PAC Manager inspect page being open, no, it does not make any difference. Those pages are only doing a read, if you happen to hit refresh on them while the save to flash was happening, they would time out and nothing more (They time out because the unit is offline while it does the save, hence the need to re-enable communications to it via the strategy or some other method when the command completes).
To answer your question, how to save the digital output state?
You will need to have a chart running (or slip this command into a looping chart that will do this as often as you feel is going to catch the outputs) that uses the command ‘Get I/O Unit as Binary Value’.
Look up the help for this one, you will see that it reads the status of all digital points on a single I/O unit and puts them into a variable, its a bit mask of the state of the points.
(View it in binary to make it clear).
In your case, I would be making sure that the variable you store it to is a persistent.
The last step is then to tweak your powerup chart and either do it there, or call an ‘init’ chart that then sets the digital output points from this bit mask. Once that chart has done its thing, then you can go on and do the rest of the charts in your strategy.
(Note. Depending on how much you care about the analog outputs, you could use the commands ‘Move I/O Unit to Numeric Table Ex’ to get the values, and then ‘Move Numeric Table to I/O Unit Ex’ to set the outputs. Again, make sure that the table is set up as a persistent - If you want to use the table, but don’t want to set the analog outs on power-up, then write a little logic that strips the analog outs of the table before doing the write).
Since your configuration rarely changes once you have done setting up the rack and debugging it, you simply have to the save to EEPROM once and its done.
Since the digital outputs can change as per the strategy, you need to save the rack into a bitmask or table as often as you like (after each write to a digital point if you like).
Unlike the EEPROM command, the persistent memory can not be worn out, so it can be run as often as you like.
Also, unlike the EEPROM commands, the unit is not going to go offline or take a few seconds to do the write when using the persistent method.
If you are going to use this command from the strategy, or call it via the 0x03 method, be sure and set the time out value in the I/O unit config to something more than 1 second (the default). (If you have the default 1 second still in there, this may be a reason you see odd things happening with your current set up. The unit will try and re-enable itself every second 3 times while its saving its config to FLASH).
As an aside, on the topic of saving to EEPROM, the other thing we did is to use PAC Manager to save the I/O unit to a file on the computer. We used the Tools -> Import/Copy I/O Unit dialog.
This way, if anything major happen (lighting strike), we had a back up of that I/O rack config.
Lastly, I get why you are asking for a success/failure status on the save to EEPROM, it would be good to have something, I will put in a customer feature request ticket and see what happens.
So, to sum it all up.
Save the config of the I/O unit to FLASH via PAC Manager once you are done setting it up.
Save the config to your hard drive via PAC Manager so you have a back up of the unit in a second place. (Optional).
Save the state of your digital outputs into a persistent variable or table as often as you want.
When you power up, before doing much else, set the outputs to the value of that persistent variable.
Hope that helps.
Cheers,
Ben.