If you use MX-RTC and leave DIP switch #1 ON, then all I/O status and internal memory status are kept when power failure occur. If you want to reset the I/O status after a power failure, then on your 1st.Scan function, clear out the I/O by running statement such as:
OUTPUT[1] = 0 ' clear output #1 to #16
OUTPUT[2] = 0 ' clear output #17 to #32
RELAY[1] = 0 ' clear relay #1 to #16.