![]() |
Forum Index : Microcontroller and PC projects : Time Calculations.
Author | Message | ||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Need to check a few time parameters in my solar control code logic. Things like Minimum Runtime & Minimum wait time for the Heat Pump compressor. IE, let the Compressor depressurise for at least 7 minutes before restarting... So far I'm considering using Time String variables & converting them to seconds for the calcs & logic. What I have so far is:- [Code] 'Functions to turn time to seconds & back. Print TimeSecs(Time$) 'Convert Current Time to Seconds Print SecsTime(78515) 'Convert 21:48:35 Back to String Function TimeSecs(TimeS as String) As integer TimeSecs=Val(left$(TimeS,2))*60*60+Val(Mid$(TimeS,4,2))*60+Val(Right$(TimeS,2)) End function Function SecsTime(TimeI as Integer) as String Local Integer HH,MM,SS HH=Int(TimeI/3600) MM=Int((TimeI-HH*3600)/60) SS=TimeI-HH*3600-MM*60 SecsTime=Str$(HH)+":"+Str$(MM)+":"+Str$(SS) End Function [/code] Any alternate suggestions? I'm aware that this will create errors on times either side of midnight, but that's not going to be relevant in this application. Thanks Phil. |
||||
paceman Guru ![]() Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
If your timing needs are just elapsed time, i.e. not 'time of day', then just use the TIMER command or function. You don't need to worry about midnight using that. Greg |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Trouble with Timer is I'm already using it elsewhere in other Subs and it gets reset quite often. Realised I should be able to deal with some type of error correction. |
||||
mikeb![]() Senior Member ![]() Joined: 10/04/2016 Location: AustraliaPosts: 174 |
Hi Phil, Why not set up a 'Timer Tick' (1 sec)', to service a subroutine\function which increments\decrements a seconds\minutes variable. I would advise not using a 'minimum on time' as you will overshoot setpoint. Mike B. There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
|
||||
mikeb![]() Senior Member ![]() Joined: 10/04/2016 Location: AustraliaPosts: 174 |
Hi Phil, Yes, I am a Fridgie amongst other things. Feel free to 'PM' me if you would like to discuss this side of things in more detail. Happy to help where I can. Can you give a bit more detail on model # of the heatpump ? Also the water circuit arrangement. Maybe there is the possibility of you adding an insulated water storage tank to help with any short cycling. If it's a three phase unit you won't have to worry about 'depressurise' time, or more accurately pressure equalising time. The main thing is limiting number of starts to less than six per hour to alleviate stress on the starting gear. It is a different matter if it is a single phase capacitor start\run arrangement. You will certainly stall the compressor if trying to start too quickly after a stop. Still, I would have thought a one or two minute delay would have sufficed but if you need to start it this quickly after a stop then the system design is flawed. In industry we generally use a start to start timer. What this entails is setting the timer after a start and inhibiting the next start until the timer has expired. This is easily accomplished in software with flags. This timer is usually set to ten minutes thereby preventing more than six starts per hour. However, it all depends on the type of equipment as to what is appropriate. Mike B. There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Thanks Mike, Might do that when I've got some points together. The unit I'm using is mentioned in my one of my other posts here.... Cheers |
||||
mikeb![]() Senior Member ![]() Joined: 10/04/2016 Location: AustraliaPosts: 174 |
No worries Phil. When you're ready. Are you going with the Rheem unit, complete with tank ? I would. The modified 'window rattler', complete with storage box (I mean tank ![]() As long as the ambient temperature doesn't drop much below about 10°C efficiency should remain fairly reasonable. I used to laugh when retailers say, from the manufacturers data, that Heatpumps, and reverse cycle air conditioners will operate down to -20°C. Yes they will, but their heat output is rubbish and they spend most of their time in defrost mode. A\C and Heatpump systems are rated on a term called COP or coefficient of performance. This is derived from their heating, or cooling output, in kW, divided by the power input in kW. Heating performance should always be better than cooling performance. It requires 4.12 kW to raise 1L of water 1°C in 1 sec. I would expect a COP of around low to mid 3's with an ambient of around 10°C and a water temperature of approximately 40°C. Performance will drop as the water temperature rises due to higher condensing temperatures resulting in more 'flash gas' through the expansion device. Also as the ambient temperature drops due to lower suction pressure and volumetric flow back to the compressor. Mike B. There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |