ukaea / PROCESS

PROCESS is a systems code at UKAEA that calculates in a self-consistent manner the parameters of a fusion power plant with a specified performance, ensuring that its operating limits are not violated, and with the option to optimise to a given function of these parameters.
https://ukaea.github.io/PROCESS/
MIT License
34 stars 11 forks source link

Over/underestimation of planned unavailability #877

Open jonmaddock opened 5 years ago

jonmaddock commented 5 years ago

In GitLab by @rcarreck on Jul 2, 2019, 16:56

The code to calculate planned unavailability works by calculating $\frac{downtime}{uptime+downtime}$ the code that does this is line 466 of availability.f90:

    u_planned = (n*mttr_shortest + mttr_blanket) / &
         ( (n+1)*lifetime_shortest + (n*mttr_shortest + mttr_blanket) )

this will over or underestimate the planned unavailability when

    lifetime_longest/lifetime_shortest

is not an integer. This is because the code for determining n is

    n = ceiling(lifetime_longest/lifetime_shortest) - 1

therefore, the uptime, calculated by (n+1)*lifetime_shortest, will be correct if the lifetime_longest and lifetime_shortest are 4 and 2 respectively but not 5 and 2.

The equation will give that for 5 and 2 uptime is 3 shortest_lifetime when it should give 2.5 shortest_lifetime, overestimating the uptime by half of shortest_lifetime

To fix this I propose this code

Line 410:

    real(kind(1.0D0)) :: lifetime_shortest, lifetime_longest, lifetime_ratio
    integer :: n //gives the failures between a full repair

Line 463:

    lifetime_ratio = lifetime_longest/lifetime_shortest
    n = floor(lifetime_ratio)

Line 466:

    u_planned = (n*mttr_shortest + mttr_blanket) / &
         ( liftime_ratio*lifetime_shortest + (n*mttr_shortest + mttr_blanket) )
jonmaddock commented 5 years ago

In GitLab by @mkovari on Jul 2, 2019, 19:02

Ryan,
Thanks for this issue - which is very well written and comprehensive. This code was written by @jmorris-uk . We must have had a reason for setting n as an integer, but I can't remember what it was.