This created a problem in that MAIN.STARTUP wasn't working correctly because it takes a couple of cycles to complete and MAIN.SHUTDOWN was overriding the values stored after a power loss. Thus the restore won't work for a user cold reset. It can be catered for by adding it back into the ordinary PLC cycle but only executing if bPositionRestoreDone is set.