adds distance pieces to OTE ranking piece (PRO)
The PRO ranking piece calculation for erg pieces now also calculates distance based pieces.
This commit is contained in:
@@ -3779,6 +3779,8 @@ def oterankings_view(request,theuser=0,
|
||||
rankingdurations.append(datetime.time(hour=1))
|
||||
rankingdurations.append(datetime.time(hour=1,minute=15))
|
||||
|
||||
rankingdistances = [100,500,1000,2000,5000,6000,10000,21097,42195,100000]
|
||||
|
||||
thedistances = []
|
||||
theworkouts = []
|
||||
thesecs = []
|
||||
@@ -3874,21 +3876,29 @@ def oterankings_view(request,theuser=0,
|
||||
form = PredictedPieceForm(request.POST)
|
||||
clean = form.is_valid()
|
||||
value = form.cleaned_data['value']
|
||||
hourvalue,value = divmod(value,60)
|
||||
hourvalue,tvalue = divmod(value,60)
|
||||
hourvalue = int(hourvalue)
|
||||
minutevalue = int(value)
|
||||
value = int(60*(value-minutevalue))
|
||||
minutevalue = int(tvalue)
|
||||
tvalue = int(60*(tvalue-minutevalue))
|
||||
if hourvalue >= 24:
|
||||
hourvalue = 23
|
||||
rankingdurations.append(datetime.time(minute=minutevalue,
|
||||
hour=hourvalue,
|
||||
second=value))
|
||||
pieceunit = form.cleaned_data['pieceunit']
|
||||
if pieceunit == 'd':
|
||||
rankingdistances.append(value)
|
||||
else:
|
||||
rankingdurations.append(datetime.time(
|
||||
minute=minutevalue,
|
||||
hour=hourvalue,
|
||||
second=tvalue
|
||||
))
|
||||
else:
|
||||
form = PredictedPieceForm()
|
||||
|
||||
|
||||
cpredictions = []
|
||||
|
||||
|
||||
|
||||
for rankingduration in rankingdurations:
|
||||
t = 3600.*rankingduration.hour
|
||||
t += 60.*rankingduration.minute
|
||||
@@ -3900,6 +3910,9 @@ def oterankings_view(request,theuser=0,
|
||||
pwr = p1[0]/(1+t/p1[2])
|
||||
pwr += p1[1]/(1+t/p1[3])
|
||||
|
||||
velo = (pwr/2.8)**(1./3.)
|
||||
p = 500./velo
|
||||
d = t*velo
|
||||
|
||||
if pwr <= 0:
|
||||
pwr = 50.
|
||||
@@ -3912,16 +3925,78 @@ def oterankings_view(request,theuser=0,
|
||||
pwr2 = pwr
|
||||
|
||||
a = {
|
||||
'distance':int(d),
|
||||
'duration':timedeltaconv(t),
|
||||
'power':int(pwr),
|
||||
'upper':int(pwr2)}
|
||||
'upper':int(pwr2),
|
||||
'pace':timedeltaconv(p)}
|
||||
|
||||
cpredictions.append(a)
|
||||
|
||||
|
||||
del form.fields["pieceunit"]
|
||||
# initiation - get 10 min power, then use Paul's law
|
||||
|
||||
t_10 = 600.
|
||||
power_10 = p1[0]/(1+t_10/p1[2])
|
||||
power_10 += p1[1]/(1+t_10/p1[3])
|
||||
|
||||
velo_10 = (power_10/2.8)**(1./3.)
|
||||
pace_10 = 500./velo_10
|
||||
distance_10 = t_10*velo_10
|
||||
|
||||
paulslope = 5.
|
||||
|
||||
for rankingdistance in rankingdistances:
|
||||
|
||||
delta = paulslope * np.log(rankingdistance/distance_10)/np.log(2)
|
||||
|
||||
|
||||
p = pace_10+delta
|
||||
velo = 500./p
|
||||
t = rankingdistance/velo
|
||||
|
||||
pwr2 = p1[0]/(1+t/p1[2])
|
||||
pwr2 += p1[1]/(1+t/p1[3])
|
||||
pwr2 *= ratio
|
||||
|
||||
if pwr2 <= 0:
|
||||
pwr2 = 50.
|
||||
|
||||
velo2 = (pwr2/2.8)**(1./3.)
|
||||
|
||||
if np.isnan(velo2) or velo2 <= 0:
|
||||
velo2 = 1.0
|
||||
|
||||
t2 = rankingdistance/velo2
|
||||
|
||||
pwr3 = p1[0]/(1+t2/p1[2])
|
||||
pwr3 += p1[1]/(1+t2/p1[3])
|
||||
pwr3 *= ratio
|
||||
|
||||
|
||||
if pwr3 <= 0:
|
||||
pwr3 = 50.
|
||||
|
||||
velo3 = (pwr3/2.8)**(1./3.)
|
||||
if np.isnan(velo3) or velo3 <= 0:
|
||||
velo3 = 1.0
|
||||
|
||||
t3 = rankingdistance/velo3
|
||||
p3 = 500./velo3
|
||||
|
||||
a = {
|
||||
'distance':rankingdistance,
|
||||
'duration':timedeltaconv(t3),
|
||||
'power':'--',
|
||||
'upper':int(pwr3),
|
||||
'pace':timedeltaconv(p3)}
|
||||
|
||||
cpredictions.append(a)
|
||||
|
||||
# del form.fields["pieceunit"]
|
||||
|
||||
messages.error(request,message)
|
||||
return render(request, 'otwrankings.html',
|
||||
return render(request, 'oterankings.html',
|
||||
{'rankingworkouts':theworkouts,
|
||||
'interactiveplot':script,
|
||||
'the_div':div,
|
||||
|
||||
Reference in New Issue
Block a user