Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:02 06 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Time Calculations.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 02:07am 13 Jun 2016
Copy link to clipboard 
Print this post

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: Australia
Posts: 1329
Posted: 03:45am 13 Jun 2016
Copy link to clipboard 
Print this post

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: Australia
Posts: 1667
Posted: 10:51am 13 Jun 2016
Copy link to clipboard 
Print this post

  paceman said   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


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: Australia
Posts: 174
Posted: 11:51am 13 Jun 2016
Copy link to clipboard 
Print this post

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: Australia
Posts: 1667
Posted: 12:08pm 13 Jun 2016
Copy link to clipboard 
Print this post

  mikeb said   Hi Phil,

Why not set up a 'Timer Tick' (1 sec)', to service a subroutine\function which increments\decrements a seconds\minutes variable.[/quote]

That's in mind, just not sure which fits best.

[Quote]
I would advise not using a 'minimum on time' as you will overshoot setpoint.
[/quote]

You're a Friggie Right?

Might need some advice.

What I'm trying to avoid is the situation where the heat pump just cuts out, then has a 7 minute wait before starting again & then runs only a few seconds, so I then end up with 15 minutes of lost heat input, which is significant when you are using the thing on a chilly night.

Water temp can be around 36°C on those nights, Air 10-15°C so heat loss is significant & the pump needs a fairly high duty cycle.

Phil
 
mikeb

Senior Member

Joined: 10/04/2016
Location: Australia
Posts: 174
Posted: 07:29pm 13 Jun 2016
Copy link to clipboard 
Print this post

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: Australia
Posts: 1667
Posted: 12:39am 14 Jun 2016
Copy link to clipboard 
Print this post

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: Australia
Posts: 174
Posted: 02:39am 14 Jun 2016
Copy link to clipboard 
Print this post

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 ) should probably be retired. You would definately need a time delay with that one as it uses a capillary, for expansion, and has a very low starting torque compressor. It would stall for sure on a quick successive start. But then, as I said before, if it needs to start so quickly after stopping then something is wrong (Like using a plastic tub as a thermal storage tank). Stick with the Rheem unit. Looks like a rotary, or a scroll compressor in that one.
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. Edited by mikeb 2016-06-15
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025