Well I have been working on the next version of the software the version 4.4, the TankyMcTankFace version.
One of thing I wanted my controller to do (though didn't do on initial design, as I wanted to get something that worked), was to be able to just set one timer for the time I wanted my tank lights on eg 3pm to 11pm and have all other device on/off times be calculated based on these times. For instance turn CO2 on 2 hours earlier than light on 1pm, and off one hour before lights eg 10pm. Same for brighter lights, wave maker, air pump etc. Then if I see algae starting to appear just simply reduce light on time by an hour or two, edit one timer )on front panel or via web front end) and have all other times change as well.
Below is the link to the Logo!SoftComfort source file, for those of you following along at home.
😉
https://1drv.ms/u/s!AgIGUdnorxMQtOVYVFg_yKAQNkwz9g
Basically the functional block diagram is largely the same, so same output relays and inputs from switches to turn on/turn off/disable/enable lights and devices.
However there is now a new bit that reads the time values from the timer block from the PLC memory. This makes use of a facility to map functional blocks "internal parameters" eg timer on time, to memory. Use the Tools->Parameter VM Mapping to set this up. Below shows the parameters for two timers (normal and holiday times) being mapped to memory locations 0 to 6.
This value can then be accessed using a network analogue input as shown below. The value read is 5888 for timer on time.
Unfortunately the read value is in binary coded decimal format
🙁 so is not immediately useful for calculations.
https://en.wikipedia.org/wiki/Binary-coded_decimal
The value read above, 5888 is in 1700 in BCD (use windows calculator to convert decimal to hex), and 17:00 is the actual timer value. To convert BCD to decimal value (no of minutes since midnight) the following calculation blocks are used. As can be seen this converts the read value of 5888 to 1020 (decimal), thus 1020 minutes since midnight ie 17:00 hours.
This is then fed to analogue threshold trigger to determine if the lights (or other device) should be on or off. Below shows the diagram for two tubes on/off based on the time (more on that later) being between the values 1020 (17:00 hours) and 1380 (23:00 hours).
Unfortunately one cannot get access to the Logo real time clock values, so a couple of blocks are devoted to counting minutes since midnight. A timer resets the counter minutes at 00:00 hours every day. This does have the issue that when the unit is first powered up the time is 00:00, so a menu setup is provided to set the initial time.
One other change (as we can now calculate things) is the macro, micro and liquid carbon dosing values are now set in millilitres based on rated pump rate. Below shows dosing 40ml macro on Monday, Wednesday and Saturday and only 20ml if in holiday mode. The 40 & 20 can be modified to change the dose depending on your tank size.
The rest of the "new stuff" is devoted to on screen menus to allow parameters to be edited either from LCD screen or remotely over the web. One can edit the no of minutes early CO2 starts, CO2 ends, wave maker starts/end etc. Below 4 T5 tubes turn on 60 minutes after the initial start time and go off 60 minutes before the end time. Similar for CO2, wavemaker & air pump.
One variation I wanted, was to leave wave maker on longer when on holiday, so if in holiday mode it is on for all the time CO2 is on. Non holiday mode turns off 240 minutes before lights off, so that when I am in the lounge, where the tanks is, in the evening there is no faint hum of wave maker.
Another issues is I like to run my air pump from 15 minutes before lights of (to degas CO2, provide extra tank agitation and pass air through my fish feeder) say 2am. Unfortunately with this design times cannot cross the midnight boundary, as the minutes counter gets reset at midnight, thus in my case air will come on 10:45 till 00:00 (rather than 2:00). Oh well, something for the next version to fix.
Anyway enjoy.