![]() |
![]() |
![]() |
#1 |
Registered Member
Join Date: Oct 2014
Location: Toronto GTA,Canada
Posts: 1,763
|
Scripts for XML Parsing of Outlet Logs
I am surprised there are not many posts about scripting, and automation. Are there any posts you can past on.
I am in the process of setting up my Neptune Apex Jr, and playing with some switch inputs, and programming the controller. The script I have almost ready, will pull XML from the controller (specifically the OUTPUT XML". Then run some simple reports. The reason for this is it's a bit tough to read the XML when troubleshooting for example the OSC command for my dosing pump Outlets. The script is written in Perl, and runs on ActiveState Perl. On window 7 64bit. You run the script and select one OUTLET. Physcial or Virtual, and you get a nice report to see only that outlet. When it went on, when it when off, maybe as % summary on % of day on vs off. I have idea's for more scripts to do water changes by setting outlets on an off via telnet command in apex controller. Other things like a push button triggering a maintenance activity. STuff you can't do with the good, but limited apex core programming language. Not critical day to day running of the outlets (leave that to the controller). Anyway, just looking to see if there is a section with respect to scripting using the Apex controller as a source. There must be, since Apex controllers in their early days appeared to have evolved over time. Things like Fusion and web portals is more recent. I've had my Apex Jr, just over a month. |
![]() |
![]() |
![]() |
#2 |
Registered Member
Join Date: Oct 2014
Location: Toronto GTA,Canada
Posts: 1,763
|
I got the script finished and working.
I added a counter, to track how many times the OUTLET changes state. This could be used to trigger something like an email (from my PC), or something similar. At this point, I am using the report for my DOSING Pump outlets to make 100% sure my Apex Programming is 100% working the way I expect, before plugging in my dosing pumps into the EB8 outlets. This script is hard coded, but could easily be modified to change to a command line argument. Script is a read only script, so won't change anything on the controller. I can post of copy of this simple script, if anyone is interested. Here is the running script and it's output. C:\Perl64\eg>QueryApexOutletXML.pl **************************************************************** * Starting XML Outlet Query * * (Today TYPE Query 00:00 hrs-24:00 hrs) * * Controler IP Address=(192.168.2.18) * * Scanning for OUTLET=(EB8_B3-DOS-A) * **************************************************************** Please wait... -----> CONTROLLER NAME = ( apex ) -----> -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 03:00:00) (ON) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 03:00:20) (OFF) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 03:54:40) (ON) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 03:55:00) (OFF) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 03:56:00) (ON) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 03:56:20) (OFF) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 04:00:00) (ON) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 04:00:20) (OFF) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 04:30:00) (ON) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 04:30:20) (OFF) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 05:00:00) (ON) -----> OUTLET NAME = (EB8_B3-DOS-A) (12/03/2014 05:00:20) (OFF) ----------------------------------------------------------------- Outlet (EB8_B3-DOS-A) found: (12) TIMES -----------------------------------------------------------------' The above report is easier to read, than looking through full XML output log, which looks like snapshot below. (just a very small piece of the full Outlet XML output LOG), which this script parses through and reformats into easier more readable text. Maybe APEX Fusion has something like this, but I haven't looked. Regardless, I plan on more scripts, for my full automation goals. Last edited by Wally.B; 12/03/2014 at 05:15 AM. |
![]() |
![]() |
![]() |
#3 |
Registered Member
Join Date: Oct 2014
Location: Toronto GTA,Canada
Posts: 1,763
|
The script report proved to be useful right away. On my first A/B Dose run. I had PH probe too close to A/B Does outs, thus the reason for Controller shutting off B dosing.
Dosing was suppose to start at the hour for A, and 30 minute mark for B. Then stop 30 seconds later. Notice the APEX picked up the High PH and cut off the First B overdose. The 2nd time, PH recovered to normal, so APEX restarted dosing B, and ended properly at +30 seconds later. DOSING run XML LOG (HTML script report). -----> OUTLET NAME = (EB8_B3_DOS_A) (12/08/2014 03:00:00) (ON) -----> OUTLET NAME = (EB8_B3_DOS_A) (12/08/2014 03:00:30) (OFF) -----> OUTLET NAME = (EB8_B4_DOS_B) (12/08/2014 03:30:00) (ON) -----> OUTLET NAME = (EB8_B4_DOS_B) (12/08/2014 03:30:22) (OFF) ** DOSING TERMINATED ** -----> OUTLET NAME = (EB8_B3_DOS_A) (12/08/2014 04:00:00) (ON) -----> OUTLET NAME = (EB8_B3_DOS_A) (12/08/2014 04:00:30) (OFF) -----> OUTLET NAME = (EB8_B4_DOS_B) (12/08/2014 04:30:00) (ON) -----> OUTLET NAME = (EB8_B4_DOS_B) (12/08/2014 04:30:15) (OFF) ** DOSING STOPPED (PH too high) ** -----> OUTLET NAME = (EB8_B4_DOS_B) (12/08/2014 04:30:23) (ON) ** STARTED AGAIN ** -----> OUTLET NAME = (EB8_B4_DOS_B) (12/08/2014 04:30:30) (OFF) ** NORMAL STOP TIME ** |
![]() |
![]() |
![]() |
Tags |
apex, apex jr, perl, script |
|
|