ASCOM Generic UPS driver (for SGP)
As my MountCMD tool could not warm up the camera, I decided to write this ASCOM Generic UPS SafetyMonitor driver for use in Sequence Generator Pro (SGP). It is written in C# .NET using Visual Studio and has passed the ASCOM Conform test (report is included in the zip file). Version 0.4.6 can be downloaded from my server: http://www.dehilster.info/docs/GenericUPS-Setup.zip
The driver works with the events in the Windows Application Events Logbook (can be accessed via eventvwr). This SafetyMonitor can be combined with others, like a weather SafetyMonitor, by using the ASCOM SafetyMonitor Hub.
Before configuring the driver the UPS and its software should be installed (i.e. PowerChute for an APC UPS or PowerPanel for a CyberPower UPS).
The Generic UPS SafetyMonitor works with a set of rules similar to a firewall. These rules can be specified and added by pressing the Add button. Once defined, each rule can be altered by clicking on the rule, editing the corresponding fields, and accept them by clicking the Update button.
There are several fields to be filled (see figure 2):
Manual set-up using Windows EventViewer
In order to find these Event-IDs, unplug the UPS from mains at a given time (e.g. 16:20:30) and plug it in again a short while later (e.g. 16:23:35). Start the Windows Event Viewer by clicking the [Windows] and [R] keys, typing "eventvwr" (without the quotes) and hitting enter. It should result in the adjacent screen.
Goto Windows-logbook->Application and search for the times that the UPS took over control. Note down the two Event-IDs given for the UPS events (174 and 61455 in this example) and enter these values in the driver setup. In case these two IDs are equal, note down the messages that come with it. If the Application logbook does not contain the necessary information, the System logbook may contain them. In that case the "Logbook to Monitor" in the driver should be changed to "System".
Learning mode will automatically detect all events that are logged in the selected Windows logbook. To avoid non-UPS-related events to be detected a filter can be defined by entering a number between 0 and 65525 in the EventID box. Only events with that number will be logged (useful for CyberPower UPS).
If it is to be expected that multiple events are used (as by an APC UPS) a range can be defined by entering a second number in the Unsafe Delay box.
Switching on the Verbose option (next to the Learn option) will cause the learning mode to show message boxes with the events that are found.
To test-fire the events:
If mains returns with the Set Unsafe Delay [minutes] time, the driver keeps the safe mode to safe. It will not return to safe when the delay time has expired, unless the option Report SAFE after Unsafe Delay is checked. There is, however, a risk that using this option will exhaust the UPS when multiple power failures occur shortly after each other. So use this option with caution and preferably with a short Set Unsafe Delay time.
The Generic UPS driver communicates with the ASCOM SafetyMonitor Hub. In that driver a timer will be visible when the UPS fails, while the alert window turns orange as an indication that the system is becoming unsafe.
The only thing not covered is the complete shutdown of the mount, but that is done using my MountCMD tool on computer shutdown.
I have tested this driver with SGP doing its stuff with a ZWO ASI1600MM Cool, a 10Micron GM3000 mount and the slaved LesveDome, which all parked and warmed up properly.
UPS systems tested so far
Hopefully other people will test my Generic UPS Safety Monitor driver and give some feedback on how their UPSís work. Please note that the driver will not work until the first image has been taken (that is a documented SGP feature, see the not at the bottom of their Safety Monitor page). If you wish to postpone imaging, it is best to have two targets in the sequence: one with a single exposure directly taken, the next target being timed.
v.0.0.1 (14/06/2019): first stable version.
v.0.1.2 (23/06/2019): Added select options for System and Application, extended the triggers with search strings.
v.0.2.0 (10/07/2019): Added the option to return to safe even when delay time has expired. Added communication with SafetyMonitor Hub.
v.0.2.1 (10/07/2019): Bug fix in the count-down timer.
v.0.3.0 (13/07/2019): Added communication with UPS tests to see if the UPS is still connected.
v.0.4.0 (16/07/2019): Complete revised version of the UPS driver, now serializing events, by which it becomes possible to have an unlimited amount of SAFE and UNSAFE event detections.
v.0.4.1 (16/07/2019): Added Learning mode, by which the driver semi-automatically adds UPS events found in the Event Viewer.
v.0.4.2 (22/07/2019): Improved feedback of Learning mode, now not only showing the EventID, but also the event description.
v.0.4.6 (07/09/2019): Fixed bug that resulted in shutdown if a SAFE event was triggered before an UNSAFE event (i.e. while the system was still SAFE).
If you have any questions and/or remarks please let me know.
InFINNity Deck... Astrophotography... Astro-Software... Astro Reach-out... Equipment...
ASCOM Generic UPS driver ASCOM SafetyMonitor Hub Astronomical Twilight Log10mGrabber MountCMD MountMonitor