Need help figuring out the percent operation/sleep time a battery should use per amount of time

Hoping this isn't a dumb question. I'm really new to this stuff..

I have a battery with 1000mAH, it consumes 20mA when it operates and 0.05mA when it sleeps. If I need the battery to last for a certain amount of time, lets say 8000 hours. How can I figure out the percent of time the battery will need to be operating and sleeping to total 8000 hours? Does anyone know of a formula to make this math easier?

Thanks in advance anyone who helps! -F

Battery capacity C=1000mAh

Operating current Io=20mA

Sleeping current Is=0.05mA

Operating time To

Sleeping time Ts

Time total To+Ts=8000 ..................... (1)

Ignoring the self discharge,

C = IoTo + IsTs

1000 = 20*To + 0.05*Ts......................(2)

Equation (1) & (2) are two linear equations with two variables and easy to solve.

You may solve them using substitution method. Online solution here

Let the duty cycle be $0 \le \sigma \le 1$, and the battery capacity be C in mAh

Average consumption is $\sigma \cdot 20mA + (1- \sigma) \cdot 0.05mA$ = $\sigma \cdot 19.95mA + 0.05mA$

(You can easily see that this is correct by setting duty cycle to 0 and 100% and confirming that the results are 0.05mA and 20mA respectively, as expected).

Operating time is thus T= $\frac {C} {\sigma \cdot 19.95mA + 0.05mA}$ and

$\sigma = \frac { \frac{C}{T} - 0.05mA}{19.95mA}$

If C = 1000mAh and T = 8000h then duty cycle is 0.376%

Hours * mA = mAH . It's really that simple.

So if you ran at full power for 50 hours, you'd have 20mA * 50 H = 1000mA hours. So you can see that 1000mAH / 20mA = 50 hours. Do that with .05mA, and you'll find that it would run for 20,000 hours if it never woke up.

Percentages run by proportion. So, if it woke up for 600ms each minute, that would be 1% of each minute, and asleep for the remaining 99%. Your current then is (.01 * 20) + (.99 * .05) = .2495mA average. Go back to your 1000mAH and divide, and it runs for 4000 hours.