Slope calcualtion and use

280 views
Skip to first unread message

Eric Hanssen

unread,
Feb 5, 2022, 2:58:19 PM2/5/22
to golden-cheetah-users
Hi, i am fairly new to GoldenCheetah. i am currently using 3.6 with my Kickr Core. i am trying to understand the slope calculation that GC does in the raw data from a gpx file and where is uses it. 
If i import a GPX file in train mode GC seems to use the slope directly form the altitude vs distance (alt2-alt1)*100/(dist2-dist1)*1000, however the slope displayed in the SLOPE column of the Raw Data in details of an activity doesnt match these value. the first few are exactly the same than everything diverges. 
eg:
displayed

0
-3.94272
-3.24062
-1.82149
-2.80848
-1.42581
0.747658
-2.62466
-1.37619
-1.71404
-1.85442
-1.44089
-1.47958
-1.58803
-2.01122
-1.62912

Calculated

0
-3.94272
-3.24059
-1.8215
-2.8085
-1.4258
0.747659
-2.62467
-1.37621
-1.71403
-0.33783
0.192579
-3.62752
-2.90607
-7.04051
2.395183

Thoughts?

Ale Martinez

unread,
Feb 5, 2022, 8:28:52 PM2/5/22
to golden-cheetah-users
When a file without slope is imported as an activity, derived slope is smoothed, see https://github.com/GoldenCheetah/GoldenCheetah/blob/130abda5feeb999f13b73415c42b6c9ec58df8da/src/FileIO/RideFile.cpp#L2673

Eric Hanssen

unread,
Feb 8, 2022, 6:45:21 PM2/8/22
to golden-cheetah-users
HI Ale, 
thanks, i guess i shoudl rephrase my question: 
does GC use the slope or does it use elevation during a training session. it seems that it uses elevation seeing the values i have appearing on my screen. 

Message has been deleted

Eric Christoffersen

unread,
Feb 8, 2022, 9:26:44 PM2/8/22
to golden-cheetah-users
The object that holds train mode's representation of workouts is called ErgFile. ErgFile has a bool field called 'strictGradient'. Each importable format knows how to import itself to ergfile. When 'natural location based routes' like gpx, tts and json import to ErgFile they set the strictGradient field to False. When strictGradient is false the gradient will be interpolated from altitude using a cubic spline, so for example you'll see the gradient across a pass will be positive and slowly adjust to negative as you cross, even though the pass might have been represented with 3 route points.

Gc train mode runs against ergfile so all gc workouts are imported to ErgFile. Other workouts types set the strictGradient is set to true meaning imported gradient is honored literally so you can define and ride nice sawtooths if you like.

Gc also supports a no workout file 'manual gradient' mode where you can adjust gradient by clicky clicking the intensity buttons. Manual mode also defines strictGradient to true.

The training runtime logic is here:

https://github.com/GoldenCheetah/GoldenCheetah/blob/a13da9e91751566fec544673b4b2509b12821a3b/src/Train/TrainSidebar.cpp#L1855
Reply all
Reply to author
Forward
0 new messages