@glandais/vcyclist-engine 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/fit-kotlin-sdk.js +10137 -2077
- package/fit-kotlin-sdk.js.map +1 -1
- package/kotlin-kotlin-stdlib.js +836 -338
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/kotlinx-atomicfu.js +9 -9
- package/kotlinx-coroutines-core.js +84 -84
- package/kotlinx-serialization-kotlinx-serialization-core.js +1 -1
- package/package.json +1 -1
- package/vcyclist-elevation.js +52 -52
- package/vcyclist-engine.d.ts +45 -0
- package/vcyclist-engine.js +378 -116
- package/vcyclist-engine.js.map +1 -1
- package/vcyclist-fit.js +31 -31
- package/vcyclist-gpx.js +172 -151
- package/vcyclist-gpx.js.map +1 -1
- package/xmlutil-core.js +180 -180
- package/xmlutil-core.js.map +1 -1
package/vcyclist-engine.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (factory) {
|
|
2
2
|
if (typeof define === 'function' && define.amd)
|
|
3
|
-
define(['exports', './kotlin-kotlin-stdlib.js', './vcyclist-gpx.js', './vcyclist-elevation.js', './kotlinx-coroutines-core.js', './vcyclist-fit.js'], factory);
|
|
3
|
+
define(['exports', './kotlin-kotlin-stdlib.js', './vcyclist-gpx.js', './vcyclist-elevation.js', './kotlinx-coroutines-core.js', './vcyclist-fit.js', './fit-kotlin-sdk.js'], factory);
|
|
4
4
|
else if (typeof exports === 'object')
|
|
5
|
-
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./vcyclist-gpx.js'), require('./vcyclist-elevation.js'), require('./kotlinx-coroutines-core.js'), require('./vcyclist-fit.js'));
|
|
5
|
+
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./vcyclist-gpx.js'), require('./vcyclist-elevation.js'), require('./kotlinx-coroutines-core.js'), require('./vcyclist-fit.js'), require('./fit-kotlin-sdk.js'));
|
|
6
6
|
else {
|
|
7
7
|
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
8
8
|
throw new Error("Error loading module 'io.github.glandais:engine'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'io.github.glandais:engine'.");
|
|
@@ -19,95 +19,99 @@
|
|
|
19
19
|
if (typeof globalThis['vcyclist-fit'] === 'undefined') {
|
|
20
20
|
throw new Error("Error loading module 'io.github.glandais:engine'. Its dependency 'vcyclist-fit' was not found. Please, check whether 'vcyclist-fit' is loaded prior to 'io.github.glandais:engine'.");
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
if (typeof globalThis['fit-kotlin-sdk'] === 'undefined') {
|
|
23
|
+
throw new Error("Error loading module 'io.github.glandais:engine'. Its dependency 'fit-kotlin-sdk' was not found. Please, check whether 'fit-kotlin-sdk' is loaded prior to 'io.github.glandais:engine'.");
|
|
24
|
+
}
|
|
25
|
+
globalThis['io.github.glandais:engine'] = factory(typeof globalThis['io.github.glandais:engine'] === 'undefined' ? {} : globalThis['io.github.glandais:engine'], globalThis['kotlin-kotlin-stdlib'], globalThis['vcyclist-gpx'], globalThis['vcyclist-elevation'], globalThis['kotlinx-coroutines-core'], globalThis['vcyclist-fit'], globalThis['fit-kotlin-sdk']);
|
|
23
26
|
}
|
|
24
|
-
}(function (_, kotlin_kotlin, kotlin_io_github_glandais_gpx, kotlin_io_github_glandais_elevation, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_github_glandais_fit) {
|
|
27
|
+
}(function (_, kotlin_kotlin, kotlin_io_github_glandais_gpx, kotlin_io_github_glandais_elevation, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_github_glandais_fit, kotlin_io_github_glandais_fit_kotlin_sdk) {
|
|
25
28
|
'use strict';
|
|
26
29
|
//region block: imports
|
|
27
30
|
var imul = Math.imul;
|
|
28
31
|
var hypot = Math.hypot;
|
|
29
32
|
var sign = Math.sign;
|
|
30
|
-
var protoOf = kotlin_kotlin.$_$.
|
|
31
|
-
var initMetadataForCompanion = kotlin_kotlin.$_$.
|
|
33
|
+
var protoOf = kotlin_kotlin.$_$.c7;
|
|
34
|
+
var initMetadataForCompanion = kotlin_kotlin.$_$.o6;
|
|
32
35
|
var VOID = kotlin_kotlin.$_$.a;
|
|
33
|
-
var getNumberHashCode = kotlin_kotlin.$_$.
|
|
34
|
-
var equals = kotlin_kotlin.$_$.
|
|
35
|
-
var initMetadataForClass = kotlin_kotlin.$_$.
|
|
36
|
-
var toString = kotlin_kotlin.$_$.
|
|
37
|
-
var hashCode = kotlin_kotlin.$_$.
|
|
38
|
-
var getBooleanHashCode = kotlin_kotlin.$_$.
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
36
|
+
var getNumberHashCode = kotlin_kotlin.$_$.j6;
|
|
37
|
+
var equals = kotlin_kotlin.$_$.g6;
|
|
38
|
+
var initMetadataForClass = kotlin_kotlin.$_$.n6;
|
|
39
|
+
var toString = kotlin_kotlin.$_$.f7;
|
|
40
|
+
var hashCode = kotlin_kotlin.$_$.m6;
|
|
41
|
+
var getBooleanHashCode = kotlin_kotlin.$_$.i6;
|
|
42
|
+
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.a2;
|
|
43
|
+
var Unit_instance = kotlin_kotlin.$_$.g1;
|
|
44
|
+
var CoroutineImpl = kotlin_kotlin.$_$.x4;
|
|
42
45
|
var PointPerDistance_instance = kotlin_io_github_glandais_gpx.$_$.k;
|
|
43
46
|
var ElevationStep_instance = kotlin_io_github_glandais_gpx.$_$.h;
|
|
44
|
-
var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.
|
|
47
|
+
var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.i4;
|
|
45
48
|
var PointPerSecond_instance = kotlin_io_github_glandais_gpx.$_$.l;
|
|
46
49
|
var PathSimplifier_instance = kotlin_io_github_glandais_gpx.$_$.i;
|
|
47
|
-
var initMetadataForCoroutine = kotlin_kotlin.$_$.
|
|
48
|
-
var initMetadataForObject = kotlin_kotlin.$_$.
|
|
49
|
-
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.
|
|
50
|
-
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.
|
|
51
|
-
var last = kotlin_kotlin.$_$.
|
|
52
|
-
var toIntArray = kotlin_kotlin.$_$.
|
|
53
|
-
var sortedWith = kotlin_kotlin.$_$.
|
|
54
|
-
var toMutableList = kotlin_kotlin.$_$.
|
|
55
|
-
var first = kotlin_kotlin.$_$.
|
|
56
|
-
var removeAll = kotlin_kotlin.$_$.
|
|
57
|
-
var numberRangeToNumber = kotlin_kotlin.$_$.
|
|
58
|
-
var collectionSizeOrDefault = kotlin_kotlin.$_$.
|
|
50
|
+
var initMetadataForCoroutine = kotlin_kotlin.$_$.p6;
|
|
51
|
+
var initMetadataForObject = kotlin_kotlin.$_$.t6;
|
|
52
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.j1;
|
|
53
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.i1;
|
|
54
|
+
var last = kotlin_kotlin.$_$.o3;
|
|
55
|
+
var toIntArray = kotlin_kotlin.$_$.a4;
|
|
56
|
+
var sortedWith = kotlin_kotlin.$_$.y3;
|
|
57
|
+
var toMutableList = kotlin_kotlin.$_$.e4;
|
|
58
|
+
var first = kotlin_kotlin.$_$.i3;
|
|
59
|
+
var removeAll = kotlin_kotlin.$_$.t3;
|
|
60
|
+
var numberRangeToNumber = kotlin_kotlin.$_$.y6;
|
|
61
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.x2;
|
|
59
62
|
var Vector3D = kotlin_io_github_glandais_elevation.$_$.g;
|
|
60
|
-
var emptyList = kotlin_kotlin.$_$.
|
|
61
|
-
var coerceIn = kotlin_kotlin.$_$.
|
|
63
|
+
var emptyList = kotlin_kotlin.$_$.f3;
|
|
64
|
+
var coerceIn = kotlin_kotlin.$_$.m7;
|
|
62
65
|
var DouglasPeucker_instance = kotlin_io_github_glandais_elevation.$_$.b;
|
|
63
|
-
var FunctionAdapter = kotlin_kotlin.$_$.
|
|
64
|
-
var isInterface = kotlin_kotlin.$_$.
|
|
65
|
-
var Comparator = kotlin_kotlin.$_$.
|
|
66
|
-
var compareValues = kotlin_kotlin.$_$.
|
|
67
|
-
var until = kotlin_kotlin.$_$.
|
|
68
|
-
var Pair = kotlin_kotlin.$_$.
|
|
69
|
-
var listOf = kotlin_kotlin.$_$.
|
|
70
|
-
var Default_getInstance = kotlin_kotlin.$_$.
|
|
66
|
+
var FunctionAdapter = kotlin_kotlin.$_$.u5;
|
|
67
|
+
var isInterface = kotlin_kotlin.$_$.v6;
|
|
68
|
+
var Comparator = kotlin_kotlin.$_$.i9;
|
|
69
|
+
var compareValues = kotlin_kotlin.$_$.g4;
|
|
70
|
+
var until = kotlin_kotlin.$_$.q7;
|
|
71
|
+
var Pair = kotlin_kotlin.$_$.p9;
|
|
72
|
+
var listOf = kotlin_kotlin.$_$.p3;
|
|
73
|
+
var Default_getInstance = kotlin_kotlin.$_$.b1;
|
|
74
|
+
var isFinite = kotlin_kotlin.$_$.ca;
|
|
71
75
|
var PointField_TEMPERATURE_getInstance = kotlin_io_github_glandais_gpx.$_$.c;
|
|
72
|
-
var isNaN_0 = kotlin_kotlin.$_$.
|
|
76
|
+
var isNaN_0 = kotlin_kotlin.$_$.ea;
|
|
73
77
|
var get_entries = kotlin_io_github_glandais_gpx.$_$.u;
|
|
74
78
|
var Path = kotlin_io_github_glandais_gpx.$_$.t;
|
|
75
79
|
var GpxParser_instance = kotlin_io_github_glandais_gpx.$_$.d;
|
|
76
|
-
var copyToArray = kotlin_kotlin.$_$.
|
|
80
|
+
var copyToArray = kotlin_kotlin.$_$.e3;
|
|
77
81
|
var firstTrackAsPath = kotlin_io_github_glandais_gpx.$_$.n;
|
|
78
82
|
var tracksAsPaths = kotlin_io_github_glandais_gpx.$_$.q;
|
|
79
83
|
var segmentsAsPaths = kotlin_io_github_glandais_gpx.$_$.o;
|
|
80
84
|
var GpxPathKind_TRACK_getInstance = kotlin_io_github_glandais_gpx.$_$.b;
|
|
81
|
-
var setOf = kotlin_kotlin.$_$.
|
|
85
|
+
var setOf = kotlin_kotlin.$_$.w3;
|
|
82
86
|
var GpxPathKind_ROUTE_getInstance = kotlin_io_github_glandais_gpx.$_$.a;
|
|
83
87
|
var GpxWriter_instance = kotlin_io_github_glandais_gpx.$_$.e;
|
|
84
|
-
var toList = kotlin_kotlin.$_$.
|
|
88
|
+
var toList = kotlin_kotlin.$_$.d4;
|
|
85
89
|
var toGpxDocument = kotlin_io_github_glandais_gpx.$_$.p;
|
|
86
|
-
var Companion_getInstance = kotlin_kotlin.$_$.
|
|
87
|
-
var numberToLong = kotlin_kotlin.$_$.
|
|
90
|
+
var Companion_getInstance = kotlin_kotlin.$_$.d1;
|
|
91
|
+
var numberToLong = kotlin_kotlin.$_$.o5;
|
|
88
92
|
var GlobalScope_instance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a;
|
|
89
93
|
var promise = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
|
|
90
94
|
var Companion_getInstance_0 = kotlin_io_github_glandais_gpx.$_$.j;
|
|
91
|
-
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.
|
|
95
|
+
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.c2;
|
|
92
96
|
var CsvWriter_instance = kotlin_io_github_glandais_gpx.$_$.f;
|
|
93
|
-
var firstOrNull = kotlin_kotlin.$_$.
|
|
97
|
+
var firstOrNull = kotlin_kotlin.$_$.g8;
|
|
94
98
|
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.b;
|
|
95
|
-
var Char = kotlin_kotlin.$_$.
|
|
99
|
+
var Char = kotlin_kotlin.$_$.h9;
|
|
96
100
|
var CsvOptions = kotlin_io_github_glandais_gpx.$_$.r;
|
|
97
101
|
var JsonWriter_instance = kotlin_io_github_glandais_gpx.$_$.g;
|
|
98
102
|
var JsonOptions = kotlin_io_github_glandais_gpx.$_$.s;
|
|
99
103
|
var toFitBytes = kotlin_io_github_glandais_fit.$_$.a;
|
|
100
|
-
var Companion_getInstance_1 = kotlin_kotlin.$_$.
|
|
101
|
-
var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.
|
|
102
|
-
var toDuration = kotlin_kotlin.$_$.
|
|
104
|
+
var Companion_getInstance_1 = kotlin_kotlin.$_$.c1;
|
|
105
|
+
var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.w;
|
|
106
|
+
var toDuration = kotlin_kotlin.$_$.g9;
|
|
103
107
|
var toFitBytes_0 = kotlin_io_github_glandais_fit.$_$.b;
|
|
104
|
-
var toNumber = kotlin_kotlin.$_$.
|
|
108
|
+
var toNumber = kotlin_kotlin.$_$.t5;
|
|
105
109
|
var GpxWaypoint = kotlin_io_github_glandais_gpx.$_$.m;
|
|
106
|
-
var THROW_CCE = kotlin_kotlin.$_$.
|
|
110
|
+
var THROW_CCE = kotlin_kotlin.$_$.s9;
|
|
107
111
|
var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h;
|
|
108
112
|
var ElevationProvider = kotlin_io_github_glandais_elevation.$_$.d;
|
|
109
|
-
var initMetadataForLambda = kotlin_kotlin.$_$.
|
|
110
|
-
var constructCallableReference = kotlin_kotlin.$_$.
|
|
113
|
+
var initMetadataForLambda = kotlin_kotlin.$_$.s6;
|
|
114
|
+
var constructCallableReference = kotlin_kotlin.$_$.d6;
|
|
111
115
|
//endregion
|
|
112
116
|
//region block: pre-declaration
|
|
113
117
|
initMetadataForCompanion(Companion);
|
|
@@ -118,6 +122,7 @@
|
|
|
118
122
|
initMetadataForCompanion(Companion_1);
|
|
119
123
|
initMetadataForClass(Cyclist, 'Cyclist', Cyclist);
|
|
120
124
|
initMetadataForClass(SimplifyPathOptions, 'SimplifyPathOptions', SimplifyPathOptions);
|
|
125
|
+
initMetadataForClass(WPrimeBalanceOptions, 'WPrimeBalanceOptions', WPrimeBalanceOptions);
|
|
121
126
|
initMetadataForCompanion(Companion_2);
|
|
122
127
|
initMetadataForClass(EnhanceOptions, 'EnhanceOptions', EnhanceOptions);
|
|
123
128
|
initMetadataForCoroutine($enhanceCourseCOROUTINE$, CoroutineImpl);
|
|
@@ -142,17 +147,19 @@
|
|
|
142
147
|
initMetadataForObject(MuscularPowerProvider, 'MuscularPowerProvider');
|
|
143
148
|
initMetadataForObject(PowerComputer, 'PowerComputer');
|
|
144
149
|
initMetadataForClass(PowerProviderConstant, 'PowerProviderConstant', VOID, CyclistPowerProviderBase);
|
|
145
|
-
|
|
150
|
+
initMetadataForCompanion(Companion_6);
|
|
151
|
+
initMetadataForClass(PowerProviderDurability, 'PowerProviderDurability', VOID, CyclistPowerProviderBase);
|
|
146
152
|
initMetadataForObject(PowerProviderFromData, 'PowerProviderFromData');
|
|
147
153
|
initMetadataForObject(RhoProviderDefault, 'RhoProviderDefault');
|
|
148
154
|
initMetadataForObject(RhoProviderEstimate, 'RhoProviderEstimate');
|
|
149
155
|
initMetadataForObject(RollingResistancePowerProvider, 'RollingResistancePowerProvider');
|
|
150
156
|
initMetadataForObject(VirtualizeService, 'VirtualizeService');
|
|
151
157
|
initMetadataForObject(WheelBearingsPowerProvider, 'WheelBearingsPowerProvider');
|
|
152
|
-
initMetadataForCompanion(
|
|
158
|
+
initMetadataForCompanion(Companion_7);
|
|
153
159
|
initMetadataForClass(Wind, 'Wind');
|
|
154
160
|
initMetadataForObject(WindProviderNone, 'WindProviderNone');
|
|
155
161
|
initMetadataForClass(WindProviderConstant, 'WindProviderConstant');
|
|
162
|
+
initMetadataForObject(WPrimeBalanceComputer, 'WPrimeBalanceComputer');
|
|
156
163
|
initMetadataForLambda(enhance$slambda, CoroutineImpl, VOID, [1]);
|
|
157
164
|
initMetadataForLambda(enhanceWithCourse$slambda, CoroutineImpl, VOID, [1]);
|
|
158
165
|
//endregion
|
|
@@ -166,21 +173,34 @@
|
|
|
166
173
|
new Companion();
|
|
167
174
|
return Companion_instance;
|
|
168
175
|
}
|
|
169
|
-
function Bike(crr, inertiaFront, inertiaRear, wheelRadiusM, efficiency) {
|
|
176
|
+
function Bike(crr, inertiaFront, inertiaRear, wheelRadiusM, efficiency, maxPedalingLeanAngleDeg) {
|
|
170
177
|
Companion_getInstance_2();
|
|
171
178
|
crr = crr === VOID ? 0.004 : crr;
|
|
172
179
|
inertiaFront = inertiaFront === VOID ? 0.05 : inertiaFront;
|
|
173
180
|
inertiaRear = inertiaRear === VOID ? 0.07 : inertiaRear;
|
|
174
|
-
wheelRadiusM = wheelRadiusM === VOID ? 0.
|
|
181
|
+
wheelRadiusM = wheelRadiusM === VOID ? 0.35 : wheelRadiusM;
|
|
175
182
|
efficiency = efficiency === VOID ? 0.976 : efficiency;
|
|
183
|
+
maxPedalingLeanAngleDeg = maxPedalingLeanAngleDeg === VOID ? 20.0 : maxPedalingLeanAngleDeg;
|
|
176
184
|
this.crr_1 = crr;
|
|
177
185
|
this.inertiaFront_1 = inertiaFront;
|
|
178
186
|
this.inertiaRear_1 = inertiaRear;
|
|
179
187
|
this.wheelRadiusM_1 = wheelRadiusM;
|
|
180
188
|
this.efficiency_1 = efficiency;
|
|
189
|
+
this.maxPedalingLeanAngleDeg_1 = maxPedalingLeanAngleDeg;
|
|
181
190
|
}
|
|
191
|
+
protoOf(Bike).get_tanMaxPedalingLeanAngle_nft7tz_k$ = function () {
|
|
192
|
+
var tmp;
|
|
193
|
+
if (this.maxPedalingLeanAngleDeg_1 >= 90.0) {
|
|
194
|
+
tmp = Infinity;
|
|
195
|
+
} else {
|
|
196
|
+
// Inline function 'kotlin.math.tan' call
|
|
197
|
+
var x = this.maxPedalingLeanAngleDeg_1 * 3.141592653589793 / 180.0;
|
|
198
|
+
tmp = Math.tan(x);
|
|
199
|
+
}
|
|
200
|
+
return tmp;
|
|
201
|
+
};
|
|
182
202
|
protoOf(Bike).toString = function () {
|
|
183
|
-
return 'Bike(crr=' + this.crr_1 + ', inertiaFront=' + this.inertiaFront_1 + ', inertiaRear=' + this.inertiaRear_1 + ', wheelRadiusM=' + this.wheelRadiusM_1 + ', efficiency=' + this.efficiency_1 + ')';
|
|
203
|
+
return 'Bike(crr=' + this.crr_1 + ', inertiaFront=' + this.inertiaFront_1 + ', inertiaRear=' + this.inertiaRear_1 + ', wheelRadiusM=' + this.wheelRadiusM_1 + ', efficiency=' + this.efficiency_1 + ', maxPedalingLeanAngleDeg=' + this.maxPedalingLeanAngleDeg_1 + ')';
|
|
184
204
|
};
|
|
185
205
|
protoOf(Bike).hashCode = function () {
|
|
186
206
|
var result = getNumberHashCode(this.crr_1);
|
|
@@ -188,6 +208,7 @@
|
|
|
188
208
|
result = imul(result, 31) + getNumberHashCode(this.inertiaRear_1) | 0;
|
|
189
209
|
result = imul(result, 31) + getNumberHashCode(this.wheelRadiusM_1) | 0;
|
|
190
210
|
result = imul(result, 31) + getNumberHashCode(this.efficiency_1) | 0;
|
|
211
|
+
result = imul(result, 31) + getNumberHashCode(this.maxPedalingLeanAngleDeg_1) | 0;
|
|
191
212
|
return result;
|
|
192
213
|
};
|
|
193
214
|
protoOf(Bike).equals = function (other) {
|
|
@@ -205,6 +226,8 @@
|
|
|
205
226
|
return false;
|
|
206
227
|
if (!equals(this.efficiency_1, other.efficiency_1))
|
|
207
228
|
return false;
|
|
229
|
+
if (!equals(this.maxPedalingLeanAngleDeg_1, other.maxPedalingLeanAngleDeg_1))
|
|
230
|
+
return false;
|
|
208
231
|
return true;
|
|
209
232
|
};
|
|
210
233
|
function Course(path, cyclist, bike) {
|
|
@@ -328,7 +351,7 @@
|
|
|
328
351
|
function Cyclist(massKg, maxBrakeG, cd, frontalAreaM2, maxLeanAngleDeg, maxSpeedKmH) {
|
|
329
352
|
Companion_getInstance_4();
|
|
330
353
|
massKg = massKg === VOID ? 80.0 : massKg;
|
|
331
|
-
maxBrakeG = maxBrakeG === VOID ? 0.
|
|
354
|
+
maxBrakeG = maxBrakeG === VOID ? 0.4 : maxBrakeG;
|
|
332
355
|
cd = cd === VOID ? 0.7 : cd;
|
|
333
356
|
frontalAreaM2 = frontalAreaM2 === VOID ? 0.5 : frontalAreaM2;
|
|
334
357
|
maxLeanAngleDeg = maxLeanAngleDeg === VOID ? 35.0 : maxLeanAngleDeg;
|
|
@@ -346,7 +369,7 @@
|
|
|
346
369
|
return Math.tan(x);
|
|
347
370
|
};
|
|
348
371
|
protoOf(Cyclist).get_maxBrakeMS2_nzouxw_k$ = function () {
|
|
349
|
-
return this.maxBrakeG_1 * 9.
|
|
372
|
+
return this.maxBrakeG_1 * 9.80665;
|
|
350
373
|
};
|
|
351
374
|
protoOf(Cyclist).get_maxSpeedMS_xz2r7y_k$ = function () {
|
|
352
375
|
return this.maxSpeedKmH_1 / 3.6;
|
|
@@ -412,6 +435,46 @@
|
|
|
412
435
|
return false;
|
|
413
436
|
return true;
|
|
414
437
|
};
|
|
438
|
+
function WPrimeBalanceOptions(enabled, criticalPowerW, wPrimeJ) {
|
|
439
|
+
enabled = enabled === VOID ? true : enabled;
|
|
440
|
+
criticalPowerW = criticalPowerW === VOID ? 250.0 : criticalPowerW;
|
|
441
|
+
wPrimeJ = wPrimeJ === VOID ? 20000.0 : wPrimeJ;
|
|
442
|
+
this.enabled_1 = enabled;
|
|
443
|
+
this.criticalPowerW_1 = criticalPowerW;
|
|
444
|
+
this.wPrimeJ_1 = wPrimeJ;
|
|
445
|
+
// Inline function 'kotlin.require' call
|
|
446
|
+
if (!(this.criticalPowerW_1 > 0.0)) {
|
|
447
|
+
var message = 'criticalPowerW must be > 0, got ' + this.criticalPowerW_1;
|
|
448
|
+
throw IllegalArgumentException_init_$Create$(toString(message));
|
|
449
|
+
}
|
|
450
|
+
// Inline function 'kotlin.require' call
|
|
451
|
+
if (!(this.wPrimeJ_1 > 0.0)) {
|
|
452
|
+
var message_0 = 'wPrimeJ must be > 0, got ' + this.wPrimeJ_1;
|
|
453
|
+
throw IllegalArgumentException_init_$Create$(toString(message_0));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
protoOf(WPrimeBalanceOptions).toString = function () {
|
|
457
|
+
return 'WPrimeBalanceOptions(enabled=' + this.enabled_1 + ', criticalPowerW=' + this.criticalPowerW_1 + ', wPrimeJ=' + this.wPrimeJ_1 + ')';
|
|
458
|
+
};
|
|
459
|
+
protoOf(WPrimeBalanceOptions).hashCode = function () {
|
|
460
|
+
var result = getBooleanHashCode(this.enabled_1);
|
|
461
|
+
result = imul(result, 31) + getNumberHashCode(this.criticalPowerW_1) | 0;
|
|
462
|
+
result = imul(result, 31) + getNumberHashCode(this.wPrimeJ_1) | 0;
|
|
463
|
+
return result;
|
|
464
|
+
};
|
|
465
|
+
protoOf(WPrimeBalanceOptions).equals = function (other) {
|
|
466
|
+
if (this === other)
|
|
467
|
+
return true;
|
|
468
|
+
if (!(other instanceof WPrimeBalanceOptions))
|
|
469
|
+
return false;
|
|
470
|
+
if (!(this.enabled_1 === other.enabled_1))
|
|
471
|
+
return false;
|
|
472
|
+
if (!equals(this.criticalPowerW_1, other.criticalPowerW_1))
|
|
473
|
+
return false;
|
|
474
|
+
if (!equals(this.wPrimeJ_1, other.wPrimeJ_1))
|
|
475
|
+
return false;
|
|
476
|
+
return true;
|
|
477
|
+
};
|
|
415
478
|
function Companion_2() {
|
|
416
479
|
Companion_instance_2 = this;
|
|
417
480
|
this.DEFAULT_1 = new EnhanceOptions();
|
|
@@ -422,32 +485,35 @@
|
|
|
422
485
|
new Companion_2();
|
|
423
486
|
return Companion_instance_2;
|
|
424
487
|
}
|
|
425
|
-
function EnhanceOptions(fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath) {
|
|
488
|
+
function EnhanceOptions(fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath, wPrimeBalance) {
|
|
426
489
|
Companion_getInstance_5();
|
|
427
490
|
fixElevation = fixElevation === VOID ? true : fixElevation;
|
|
428
491
|
computeMaxSpeeds = computeMaxSpeeds === VOID ? true : computeMaxSpeeds;
|
|
429
492
|
virtualizeTrack = virtualizeTrack === VOID ? true : virtualizeTrack;
|
|
430
493
|
computeOnePointPerSecond = computeOnePointPerSecond === VOID ? true : computeOnePointPerSecond;
|
|
431
494
|
simplifyPath = simplifyPath === VOID ? new SimplifyPathOptions() : simplifyPath;
|
|
495
|
+
wPrimeBalance = wPrimeBalance === VOID ? new WPrimeBalanceOptions() : wPrimeBalance;
|
|
432
496
|
this.fixElevation_1 = fixElevation;
|
|
433
497
|
this.computeMaxSpeeds_1 = computeMaxSpeeds;
|
|
434
498
|
this.virtualizeTrack_1 = virtualizeTrack;
|
|
435
499
|
this.computeOnePointPerSecond_1 = computeOnePointPerSecond;
|
|
436
500
|
this.simplifyPath_1 = simplifyPath;
|
|
501
|
+
this.wPrimeBalance_1 = wPrimeBalance;
|
|
437
502
|
}
|
|
438
|
-
protoOf(EnhanceOptions).
|
|
439
|
-
return new EnhanceOptions(fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath);
|
|
503
|
+
protoOf(EnhanceOptions).copy_bazpxz_k$ = function (fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath, wPrimeBalance) {
|
|
504
|
+
return new EnhanceOptions(fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath, wPrimeBalance);
|
|
440
505
|
};
|
|
441
|
-
protoOf(EnhanceOptions).copy$
|
|
506
|
+
protoOf(EnhanceOptions).copy$default_2rfmrp_k$ = function (fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath, wPrimeBalance, $super) {
|
|
442
507
|
fixElevation = fixElevation === VOID ? this.fixElevation_1 : fixElevation;
|
|
443
508
|
computeMaxSpeeds = computeMaxSpeeds === VOID ? this.computeMaxSpeeds_1 : computeMaxSpeeds;
|
|
444
509
|
virtualizeTrack = virtualizeTrack === VOID ? this.virtualizeTrack_1 : virtualizeTrack;
|
|
445
510
|
computeOnePointPerSecond = computeOnePointPerSecond === VOID ? this.computeOnePointPerSecond_1 : computeOnePointPerSecond;
|
|
446
511
|
simplifyPath = simplifyPath === VOID ? this.simplifyPath_1 : simplifyPath;
|
|
447
|
-
|
|
512
|
+
wPrimeBalance = wPrimeBalance === VOID ? this.wPrimeBalance_1 : wPrimeBalance;
|
|
513
|
+
return $super === VOID ? this.copy_bazpxz_k$(fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath, wPrimeBalance) : $super.copy_bazpxz_k$.call(this, fixElevation, computeMaxSpeeds, virtualizeTrack, computeOnePointPerSecond, simplifyPath, wPrimeBalance);
|
|
448
514
|
};
|
|
449
515
|
protoOf(EnhanceOptions).toString = function () {
|
|
450
|
-
return 'EnhanceOptions(fixElevation=' + this.fixElevation_1 + ', computeMaxSpeeds=' + this.computeMaxSpeeds_1 + ', virtualizeTrack=' + this.virtualizeTrack_1 + ', computeOnePointPerSecond=' + this.computeOnePointPerSecond_1 + ', simplifyPath=' + this.simplifyPath_1.toString() + ')';
|
|
516
|
+
return 'EnhanceOptions(fixElevation=' + this.fixElevation_1 + ', computeMaxSpeeds=' + this.computeMaxSpeeds_1 + ', virtualizeTrack=' + this.virtualizeTrack_1 + ', computeOnePointPerSecond=' + this.computeOnePointPerSecond_1 + ', simplifyPath=' + this.simplifyPath_1.toString() + ', wPrimeBalance=' + this.wPrimeBalance_1.toString() + ')';
|
|
451
517
|
};
|
|
452
518
|
protoOf(EnhanceOptions).hashCode = function () {
|
|
453
519
|
var result = getBooleanHashCode(this.fixElevation_1);
|
|
@@ -455,6 +521,7 @@
|
|
|
455
521
|
result = imul(result, 31) + getBooleanHashCode(this.virtualizeTrack_1) | 0;
|
|
456
522
|
result = imul(result, 31) + getBooleanHashCode(this.computeOnePointPerSecond_1) | 0;
|
|
457
523
|
result = imul(result, 31) + this.simplifyPath_1.hashCode() | 0;
|
|
524
|
+
result = imul(result, 31) + this.wPrimeBalance_1.hashCode() | 0;
|
|
458
525
|
return result;
|
|
459
526
|
};
|
|
460
527
|
protoOf(EnhanceOptions).equals = function (other) {
|
|
@@ -472,6 +539,8 @@
|
|
|
472
539
|
return false;
|
|
473
540
|
if (!this.simplifyPath_1.equals(other.simplifyPath_1))
|
|
474
541
|
return false;
|
|
542
|
+
if (!this.wPrimeBalance_1.equals(other.wPrimeBalance_1))
|
|
543
|
+
return false;
|
|
475
544
|
return true;
|
|
476
545
|
};
|
|
477
546
|
function $enhanceCourseCOROUTINE$(_this__u8e3s4, course, options, elevationProvider, resultContinuation) {
|
|
@@ -529,6 +598,10 @@
|
|
|
529
598
|
this.path0__1 = PointPerSecond_instance.computeOnePointPerSecond_7sah9a_k$(this.path0__1);
|
|
530
599
|
}
|
|
531
600
|
|
|
601
|
+
if (this.options_1.wPrimeBalance_1.enabled_1) {
|
|
602
|
+
WPrimeBalanceComputer_instance.compute_ewvoaz_k$(this.path0__1, this.options_1.wPrimeBalance_1);
|
|
603
|
+
}
|
|
604
|
+
|
|
532
605
|
if (this.options_1.simplifyPath_1.enabled_1) {
|
|
533
606
|
this.path0__1 = PathSimplifier_instance.simplify_gxhj7b_k$(this.path0__1, this.options_1.simplifyPath_1.toleranceM_1, this.options_1.simplifyPath_1.zExaggeration_1);
|
|
534
607
|
}
|
|
@@ -554,7 +627,7 @@
|
|
|
554
627
|
return new CoursePhysics(new Course(path), RhoProviderEstimate_instance, AeroProviderConstant_instance, WindProviderNone_instance, new PowerProviderConstant(280.0));
|
|
555
628
|
};
|
|
556
629
|
protoOf(Enhancer).enhanceCourseDefault_jm937y_k$ = function (path, elevationProvider, options, $completion) {
|
|
557
|
-
return this.enhanceCourse_mout3j_k$(this.getDefaultCourse_gqi1xw_k$(path), options.copy$
|
|
630
|
+
return this.enhanceCourse_mout3j_k$(this.getDefaultCourse_gqi1xw_k$(path), options.copy$default_2rfmrp_k$(options.fixElevation_1 && !(elevationProvider == null)), elevationProvider, $completion);
|
|
558
631
|
};
|
|
559
632
|
protoOf(Enhancer).enhanceCourse_mout3j_k$ = function (course, options, elevationProvider, $completion) {
|
|
560
633
|
var tmp = new $enhanceCourseCOROUTINE$(this, course, options, elevationProvider, $completion);
|
|
@@ -1309,7 +1382,7 @@
|
|
|
1309
1382
|
var m = course.get_cyclist_lkc0de_k$().massKg_1;
|
|
1310
1383
|
var grade = path.grade_c4yjz5_k$(pointIndex);
|
|
1311
1384
|
var speed = path.speed_npav2n_k$(pointIndex);
|
|
1312
|
-
var tmp = -m * 9.
|
|
1385
|
+
var tmp = -m * 9.80665 * speed;
|
|
1313
1386
|
// Inline function 'kotlin.math.atan' call
|
|
1314
1387
|
// Inline function 'kotlin.math.sin' call
|
|
1315
1388
|
var x = Math.atan(grade);
|
|
@@ -1351,9 +1424,15 @@
|
|
|
1351
1424
|
function computeCorneringLimit($this, course, currentIndex, window_0) {
|
|
1352
1425
|
var path = course.path_1;
|
|
1353
1426
|
var radius = computeRadiusWindowed($this, path, currentIndex, window_0);
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1427
|
+
var tmp;
|
|
1428
|
+
if (radius >= 200.0) {
|
|
1429
|
+
tmp = course.cyclist_1.get_maxSpeedMS_xz2r7y_k$();
|
|
1430
|
+
} else {
|
|
1431
|
+
// Inline function 'kotlin.math.sqrt' call
|
|
1432
|
+
var x = 9.80665 * radius * course.cyclist_1.get_tanMaxLeanAngle_qqiag1_k$();
|
|
1433
|
+
tmp = Math.sqrt(x);
|
|
1434
|
+
}
|
|
1435
|
+
var vMax = tmp;
|
|
1357
1436
|
// Inline function 'kotlin.math.min' call
|
|
1358
1437
|
var a = course.cyclist_1.get_maxSpeedMS_xz2r7y_k$();
|
|
1359
1438
|
var result = Math.min(a, vMax);
|
|
@@ -1384,14 +1463,46 @@
|
|
|
1384
1463
|
path.setRadius_p1cueq_k$(i, clamped);
|
|
1385
1464
|
return clamped;
|
|
1386
1465
|
}
|
|
1387
|
-
function computeBrakingLimit($this, course, currentIndex, nextIndex) {
|
|
1466
|
+
function computeBrakingLimit($this, course, currentIndex, nextIndex, corneringLimit) {
|
|
1388
1467
|
var path = course.path_1;
|
|
1389
1468
|
var vf = path.speedMax_mjo2cl_k$(nextIndex);
|
|
1390
|
-
var
|
|
1469
|
+
var aXMax = course.cyclist_1.get_maxBrakeMS2_nzouxw_k$();
|
|
1391
1470
|
var d = path.distance_5s4s77_k$(nextIndex) - path.distance_5s4s77_k$(currentIndex);
|
|
1471
|
+
var radius = path.radius_84q0sm_k$(currentIndex);
|
|
1472
|
+
if (radius >= 200.0 || !isFinite(radius) || radius <= 0.0) {
|
|
1473
|
+
// Inline function 'kotlin.math.sqrt' call
|
|
1474
|
+
var x = vf * vf + 2.0 * aXMax * d;
|
|
1475
|
+
// Inline function 'kotlin.math.min' call
|
|
1476
|
+
var b = Math.sqrt(x);
|
|
1477
|
+
return Math.min(corneringLimit, b);
|
|
1478
|
+
}
|
|
1479
|
+
var aYMax = 9.80665 * course.cyclist_1.get_tanMaxLeanAngle_qqiag1_k$();
|
|
1480
|
+
if (computeBrakingLimit$slack(radius, aYMax, aXMax, vf, d, corneringLimit) >= 0.0)
|
|
1481
|
+
return corneringLimit;
|
|
1482
|
+
// Inline function 'kotlin.math.min' call
|
|
1483
|
+
var low = Math.min(vf, corneringLimit);
|
|
1484
|
+
var high = corneringLimit;
|
|
1485
|
+
// Inline function 'kotlin.repeat' call
|
|
1486
|
+
var inductionVariable = 0;
|
|
1487
|
+
if (inductionVariable < 24)
|
|
1488
|
+
do {
|
|
1489
|
+
var index = inductionVariable;
|
|
1490
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1491
|
+
var mid = (low + high) / 2.0;
|
|
1492
|
+
if (computeBrakingLimit$slack(radius, aYMax, aXMax, vf, d, mid) >= 0.0)
|
|
1493
|
+
low = mid;
|
|
1494
|
+
else
|
|
1495
|
+
high = mid;
|
|
1496
|
+
}
|
|
1497
|
+
while (inductionVariable < 24);
|
|
1498
|
+
return low;
|
|
1499
|
+
}
|
|
1500
|
+
function computeBrakingLimit$slack(radius, aYMax, aXMax, vf, d, v) {
|
|
1501
|
+
var lateralFraction = coerceIn(v * v / radius / aYMax, 0.0, 1.0);
|
|
1392
1502
|
// Inline function 'kotlin.math.sqrt' call
|
|
1393
|
-
var x =
|
|
1394
|
-
|
|
1503
|
+
var x = 1.0 - lateralFraction * lateralFraction;
|
|
1504
|
+
var aX = aXMax * Math.sqrt(x);
|
|
1505
|
+
return vf * vf + 2.0 * aX * d - v * v;
|
|
1395
1506
|
}
|
|
1396
1507
|
function MaxSpeedComputer() {
|
|
1397
1508
|
this.MAX_RADIUS_M_1 = 200.0;
|
|
@@ -1399,6 +1510,7 @@
|
|
|
1399
1510
|
this.END_SPEED_MS_1 = 2.0;
|
|
1400
1511
|
this.BEARING_THRESHOLD_1 = 0.001;
|
|
1401
1512
|
this.DEFAULT_WINDOW_1 = 10;
|
|
1513
|
+
this.ELLIPSE_ITERATIONS_1 = 24;
|
|
1402
1514
|
}
|
|
1403
1515
|
protoOf(MaxSpeedComputer).computeMaxSpeeds_jc4v4o_k$ = function (course) {
|
|
1404
1516
|
var path = course.path_1;
|
|
@@ -1412,10 +1524,7 @@
|
|
|
1412
1524
|
path.setSpeedMax_7xvqir_k$(i, 2.0);
|
|
1413
1525
|
} else {
|
|
1414
1526
|
var cornering = computeCorneringLimit(this, course, i, 10);
|
|
1415
|
-
|
|
1416
|
-
// Inline function 'kotlin.math.min' call
|
|
1417
|
-
var tmp$ret$0 = Math.min(cornering, braking);
|
|
1418
|
-
path.setSpeedMax_7xvqir_k$(i, tmp$ret$0);
|
|
1527
|
+
path.setSpeedMax_7xvqir_k$(i, computeBrakingLimit(this, course, i, i + 1 | 0, cornering));
|
|
1419
1528
|
}
|
|
1420
1529
|
}
|
|
1421
1530
|
while (0 <= inductionVariable);
|
|
@@ -1436,12 +1545,23 @@
|
|
|
1436
1545
|
function MuscularPowerProvider() {
|
|
1437
1546
|
}
|
|
1438
1547
|
protoOf(MuscularPowerProvider).powerAt_ejucaq_k$ = function (course, path, pointIndex) {
|
|
1439
|
-
var
|
|
1548
|
+
var intent = course.cyclistPowerProvider_1.powerAt_ejucaq_k$(course, path, pointIndex);
|
|
1549
|
+
var muscular = this.pedalsClear_b5t5mh_k$(course, path, pointIndex) ? intent : 0.0;
|
|
1440
1550
|
path.setPCyclistProvidedMuscular_aori9q_k$(pointIndex, muscular);
|
|
1441
1551
|
var wheel = muscular * course.get_bike_wojgoa_k$().efficiency_1;
|
|
1442
1552
|
path.setPCyclistProvidedWheel_ofsihz_k$(pointIndex, wheel);
|
|
1443
1553
|
return wheel;
|
|
1444
1554
|
};
|
|
1555
|
+
protoOf(MuscularPowerProvider).pedalsClear_b5t5mh_k$ = function (course, path, pointIndex) {
|
|
1556
|
+
var radius = path.radius_84q0sm_k$(pointIndex);
|
|
1557
|
+
if (!isFinite(radius) || radius <= 0.0)
|
|
1558
|
+
return true;
|
|
1559
|
+
var speed = path.speed_npav2n_k$(pointIndex);
|
|
1560
|
+
if (!isFinite(speed))
|
|
1561
|
+
return true;
|
|
1562
|
+
var tanLean = speed * speed / (9.80665 * radius);
|
|
1563
|
+
return tanLean <= course.get_bike_wojgoa_k$().get_tanMaxPedalingLeanAngle_nft7tz_k$();
|
|
1564
|
+
};
|
|
1445
1565
|
var MuscularPowerProvider_instance;
|
|
1446
1566
|
function MuscularPowerProvider_getInstance() {
|
|
1447
1567
|
return MuscularPowerProvider_instance;
|
|
@@ -1449,7 +1569,9 @@
|
|
|
1449
1569
|
function getDtInner($this, pSum, equivalentMass, currentSpeed, dx, dt1Init, dt2Init) {
|
|
1450
1570
|
var dt1 = dt1Init;
|
|
1451
1571
|
var dt2 = dt2Init;
|
|
1452
|
-
|
|
1572
|
+
// Inline function 'kotlin.math.max' call
|
|
1573
|
+
var a = dx / 1.0E7;
|
|
1574
|
+
var tol = Math.max(a, 1.0E-12);
|
|
1453
1575
|
while (dt2 - dt1 >= tol) {
|
|
1454
1576
|
var dtMid = (dt1 + dt2) / 2.0;
|
|
1455
1577
|
var dxMid = $this.getDx_xtszre_k$(pSum, equivalentMass, currentSpeed, dtMid);
|
|
@@ -1461,6 +1583,7 @@
|
|
|
1461
1583
|
return (dt1 + dt2) / 2.0;
|
|
1462
1584
|
}
|
|
1463
1585
|
function PowerComputer() {
|
|
1586
|
+
this.MIN_DT_TOLERANCE_1 = 1.0E-12;
|
|
1464
1587
|
}
|
|
1465
1588
|
protoOf(PowerComputer).getNewPower_puvq9i_k$ = function (course, path, pointIndex, withCyclist) {
|
|
1466
1589
|
var pSum = 0.0;
|
|
@@ -1474,12 +1597,14 @@
|
|
|
1474
1597
|
return pSum;
|
|
1475
1598
|
};
|
|
1476
1599
|
protoOf(PowerComputer).getDx_xtszre_k$ = function (pSum, equivalentMass, currentSpeed, dt) {
|
|
1600
|
+
// Inline function 'kotlin.math.max' call
|
|
1601
|
+
var b = dt * pSum / (0.5 * equivalentMass) + currentSpeed * currentSpeed;
|
|
1477
1602
|
// Inline function 'kotlin.math.sqrt' call
|
|
1478
|
-
var x =
|
|
1603
|
+
var x = Math.max(0.0, b);
|
|
1479
1604
|
var tmp0 = Math.sqrt(x);
|
|
1480
1605
|
// Inline function 'kotlin.math.max' call
|
|
1481
|
-
var
|
|
1482
|
-
var newSpeed = Math.max(tmp0,
|
|
1606
|
+
var b_0 = 0.5555555555555556;
|
|
1607
|
+
var newSpeed = Math.max(tmp0, b_0);
|
|
1483
1608
|
return (currentSpeed + newSpeed) * dt / 2.0;
|
|
1484
1609
|
};
|
|
1485
1610
|
protoOf(PowerComputer).getTotPower_kfbciq_k$ = function (equivalentMass, s1, s2, dt) {
|
|
@@ -1494,17 +1619,28 @@
|
|
|
1494
1619
|
};
|
|
1495
1620
|
protoOf(PowerComputer).computeCyclistPower_kgcsa3_k$ = function (course, path, equivalentMass, i) {
|
|
1496
1621
|
if (i === 0) {
|
|
1622
|
+
path.setPComputedPower_c3m6yw_k$(i, 0.0);
|
|
1623
|
+
path.setPBrake_iza4qj_k$(i, 0.0);
|
|
1624
|
+
return Unit_instance;
|
|
1625
|
+
}
|
|
1626
|
+
var dtSeconds = path.dt_17uzp4_k$(i) / 1000.0;
|
|
1627
|
+
if (dtSeconds <= 0.0) {
|
|
1628
|
+
path.setPComputedTotalPower_wm6di_k$(i, 0.0);
|
|
1629
|
+
path.setPComputedWheelPower_qplog3_k$(i, 0.0);
|
|
1630
|
+
path.setPBrake_iza4qj_k$(i, 0.0);
|
|
1497
1631
|
path.setPComputedPower_c3m6yw_k$(i, 0.0);
|
|
1498
1632
|
return Unit_instance;
|
|
1499
1633
|
}
|
|
1500
1634
|
var resistive = this.getNewPower_puvq9i_k$(course, path, i - 1 | 0, false);
|
|
1501
1635
|
var s1 = path.speed_npav2n_k$(i - 1 | 0);
|
|
1502
1636
|
var s2 = path.speed_npav2n_k$(i);
|
|
1503
|
-
var dtSeconds = path.dt_17uzp4_k$(i) / 1000.0;
|
|
1504
1637
|
var totPower = this.getTotPower_kfbciq_k$(equivalentMass, s1, s2, dtSeconds);
|
|
1505
1638
|
path.setPComputedTotalPower_wm6di_k$(i, totPower);
|
|
1506
1639
|
var powerWheel = totPower - resistive;
|
|
1507
1640
|
path.setPComputedWheelPower_qplog3_k$(i, powerWheel);
|
|
1641
|
+
// Inline function 'kotlin.math.min' call
|
|
1642
|
+
var tmp$ret$0 = Math.min(0.0, powerWheel);
|
|
1643
|
+
path.setPBrake_iza4qj_k$(i, tmp$ret$0);
|
|
1508
1644
|
// Inline function 'kotlin.math.max' call
|
|
1509
1645
|
var computed = Math.max(0.0, powerWheel) / course.get_bike_wojgoa_k$().efficiency_1;
|
|
1510
1646
|
path.setPComputedPower_c3m6yw_k$(i, computed);
|
|
@@ -1530,24 +1666,86 @@
|
|
|
1530
1666
|
protoOf(PowerProviderConstant).optimalPower_36kg19_k$ = function (course, path, pointIndex) {
|
|
1531
1667
|
return this.power_1;
|
|
1532
1668
|
};
|
|
1533
|
-
function
|
|
1669
|
+
function Companion_6() {
|
|
1670
|
+
this.DEFAULT_DECLINE_PER_KJ_PER_KG_1 = 0.006666666666666667;
|
|
1671
|
+
this.DEFAULT_MAX_DECLINE_1 = 0.2;
|
|
1672
|
+
}
|
|
1673
|
+
var Companion_instance_6;
|
|
1674
|
+
function Companion_getInstance_9() {
|
|
1675
|
+
return Companion_instance_6;
|
|
1676
|
+
}
|
|
1677
|
+
function PowerProviderDurability(powerW, criticalPowerW, declinePerKjPerKg, maxDecline, useHarmonics, random) {
|
|
1678
|
+
criticalPowerW = criticalPowerW === VOID ? 250.0 : criticalPowerW;
|
|
1679
|
+
declinePerKjPerKg = declinePerKjPerKg === VOID ? 0.006666666666666667 : declinePerKjPerKg;
|
|
1680
|
+
maxDecline = maxDecline === VOID ? 0.2 : maxDecline;
|
|
1534
1681
|
useHarmonics = useHarmonics === VOID ? false : useHarmonics;
|
|
1535
1682
|
random = random === VOID ? Default_getInstance() : random;
|
|
1536
1683
|
CyclistPowerProviderBase.call(this, useHarmonics, random);
|
|
1537
|
-
this.
|
|
1538
|
-
this.
|
|
1684
|
+
this.powerW_1 = powerW;
|
|
1685
|
+
this.criticalPowerW_1 = criticalPowerW;
|
|
1686
|
+
this.declinePerKjPerKg_1 = declinePerKjPerKg;
|
|
1687
|
+
this.maxDecline_1 = maxDecline;
|
|
1539
1688
|
// Inline function 'kotlin.require' call
|
|
1540
|
-
if (!(this.
|
|
1541
|
-
var message = '
|
|
1689
|
+
if (!(this.powerW_1 > 0.0)) {
|
|
1690
|
+
var message = 'powerW must be > 0, got ' + this.powerW_1;
|
|
1542
1691
|
throw IllegalArgumentException_init_$Create$(toString(message));
|
|
1543
1692
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1693
|
+
// Inline function 'kotlin.require' call
|
|
1694
|
+
if (!(this.criticalPowerW_1 > 0.0)) {
|
|
1695
|
+
var message_0 = 'criticalPowerW must be > 0, got ' + this.criticalPowerW_1;
|
|
1696
|
+
throw IllegalArgumentException_init_$Create$(toString(message_0));
|
|
1697
|
+
}
|
|
1698
|
+
// Inline function 'kotlin.require' call
|
|
1699
|
+
if (!(this.declinePerKjPerKg_1 >= 0.0)) {
|
|
1700
|
+
var message_1 = 'declinePerKjPerKg must be >= 0, got ' + this.declinePerKjPerKg_1;
|
|
1701
|
+
throw IllegalArgumentException_init_$Create$(toString(message_1));
|
|
1702
|
+
}
|
|
1703
|
+
var containsArg = this.maxDecline_1;
|
|
1704
|
+
// Inline function 'kotlin.require' call
|
|
1705
|
+
if (!(0.0 <= containsArg ? containsArg <= 1.0 : false)) {
|
|
1706
|
+
var message_2 = 'maxDecline must be in [0, 1], got ' + this.maxDecline_1;
|
|
1707
|
+
throw IllegalArgumentException_init_$Create$(toString(message_2));
|
|
1708
|
+
}
|
|
1709
|
+
this.lastIndex_1 = -1;
|
|
1710
|
+
this.lastElapsedS_1 = 0.0;
|
|
1711
|
+
this.lastPowerW_1 = 0.0;
|
|
1712
|
+
this.supraCriticalWorkJ_1 = 0.0;
|
|
1713
|
+
this.massKgForDose_1 = 80.0;
|
|
1714
|
+
}
|
|
1715
|
+
protoOf(PowerProviderDurability).get_decline_qrtukt_k$ = function () {
|
|
1716
|
+
var tmp0 = this.maxDecline_1;
|
|
1717
|
+
// Inline function 'kotlin.math.min' call
|
|
1718
|
+
var b = this.declinePerKjPerKg_1 * this.supraCriticalWorkJ_1 / 1000.0 / this.massKgForDose_1;
|
|
1719
|
+
return Math.min(tmp0, b);
|
|
1720
|
+
};
|
|
1721
|
+
protoOf(PowerProviderDurability).optimalPower_36kg19_k$ = function (course, path, pointIndex) {
|
|
1722
|
+
this.massKgForDose_1 = course.get_cyclist_lkc0de_k$().massKg_1;
|
|
1723
|
+
if (pointIndex < this.lastIndex_1) {
|
|
1724
|
+
this.reset_5u6xz3_k$();
|
|
1725
|
+
}
|
|
1726
|
+
if (pointIndex > this.lastIndex_1) {
|
|
1727
|
+
var elapsedS = path.elapsed_7307rw_k$(pointIndex) / 1000.0;
|
|
1728
|
+
var dtS = elapsedS - this.lastElapsedS_1;
|
|
1729
|
+
if (dtS > 0.0 && isFinite(dtS)) {
|
|
1730
|
+
var tmp = this;
|
|
1731
|
+
var tmp_0 = this.supraCriticalWorkJ_1;
|
|
1732
|
+
// Inline function 'kotlin.math.max' call
|
|
1733
|
+
var b = this.lastPowerW_1 - this.criticalPowerW_1;
|
|
1734
|
+
tmp.supraCriticalWorkJ_1 = tmp_0 + Math.max(0.0, b) * dtS;
|
|
1735
|
+
}
|
|
1736
|
+
if (isFinite(elapsedS))
|
|
1737
|
+
this.lastElapsedS_1 = elapsedS;
|
|
1738
|
+
this.lastIndex_1 = pointIndex;
|
|
1739
|
+
}
|
|
1740
|
+
var faded = this.powerW_1 * (1.0 - this.get_decline_qrtukt_k$());
|
|
1741
|
+
this.lastPowerW_1 = faded;
|
|
1742
|
+
return faded;
|
|
1743
|
+
};
|
|
1744
|
+
protoOf(PowerProviderDurability).reset_5u6xz3_k$ = function () {
|
|
1745
|
+
this.lastIndex_1 = -1;
|
|
1746
|
+
this.lastElapsedS_1 = 0.0;
|
|
1747
|
+
this.lastPowerW_1 = 0.0;
|
|
1748
|
+
this.supraCriticalWorkJ_1 = 0.0;
|
|
1551
1749
|
};
|
|
1552
1750
|
function PowerProviderFromData() {
|
|
1553
1751
|
}
|
|
@@ -1601,7 +1799,7 @@
|
|
|
1601
1799
|
// Inline function 'kotlin.math.cos' call
|
|
1602
1800
|
var x = Math.atan(grade);
|
|
1603
1801
|
var coef = Math.cos(x);
|
|
1604
|
-
var p = -coef * m * 9.
|
|
1802
|
+
var p = -coef * m * 9.80665 * speed * crr;
|
|
1605
1803
|
path.setPRollingResistance_h04uz6_k$(pointIndex, p);
|
|
1606
1804
|
return p;
|
|
1607
1805
|
};
|
|
@@ -1641,8 +1839,19 @@
|
|
|
1641
1839
|
out.setVirtSpeedCurrent_kvg8yv_k$(0, speed);
|
|
1642
1840
|
var i = 1;
|
|
1643
1841
|
var iter = 0;
|
|
1644
|
-
$l$
|
|
1842
|
+
$l$loop_0: while (i < n) {
|
|
1645
1843
|
var dx = input.distance_5s4s77_k$(i) - input.distance_5s4s77_k$(i - 1 | 0);
|
|
1844
|
+
if (dx <= 0.0) {
|
|
1845
|
+
copyAllFields(this, input, i, out, i);
|
|
1846
|
+
out.setTime_rfmvcd_k$(i, timeMs);
|
|
1847
|
+
out.setElapsed_916ug_k$(i, timeMs - startTimeMs);
|
|
1848
|
+
out.setDx_uk0ky4_k$(i, 0.0);
|
|
1849
|
+
out.setDt_sgarxs_k$(i, 0.0);
|
|
1850
|
+
out.setSpeed_1slan1_k$(i, speed);
|
|
1851
|
+
out.setVirtSpeedCurrent_kvg8yv_k$(i, speed);
|
|
1852
|
+
i = i + 1 | 0;
|
|
1853
|
+
continue $l$loop_0;
|
|
1854
|
+
}
|
|
1646
1855
|
var pSum = PowerComputer_instance.getNewPower_puvq9i_k$(course, out, i - 1 | 0, true);
|
|
1647
1856
|
var dt = PowerComputer_instance.getDt_t0pcee_k$(pSum, mEq, speed, dx);
|
|
1648
1857
|
var speedNew = 2.0 * dx / dt - speed;
|
|
@@ -1664,7 +1873,7 @@
|
|
|
1664
1873
|
var _unary__edvuaz = iter;
|
|
1665
1874
|
iter = _unary__edvuaz + 1 | 0;
|
|
1666
1875
|
if (_unary__edvuaz > 100000)
|
|
1667
|
-
break $l$
|
|
1876
|
+
break $l$loop_0;
|
|
1668
1877
|
}
|
|
1669
1878
|
var progression = out.get_indices_xelk8u_k$();
|
|
1670
1879
|
var inductionVariable = progression.first_1;
|
|
@@ -1695,18 +1904,18 @@
|
|
|
1695
1904
|
function WheelBearingsPowerProvider_getInstance() {
|
|
1696
1905
|
return WheelBearingsPowerProvider_instance;
|
|
1697
1906
|
}
|
|
1698
|
-
function
|
|
1699
|
-
|
|
1907
|
+
function Companion_7() {
|
|
1908
|
+
Companion_instance_7 = this;
|
|
1700
1909
|
this.NONE_1 = new Wind(0.0, 0.0);
|
|
1701
1910
|
}
|
|
1702
|
-
var
|
|
1703
|
-
function
|
|
1704
|
-
if (
|
|
1705
|
-
new
|
|
1706
|
-
return
|
|
1911
|
+
var Companion_instance_7;
|
|
1912
|
+
function Companion_getInstance_10() {
|
|
1913
|
+
if (Companion_instance_7 == null)
|
|
1914
|
+
new Companion_7();
|
|
1915
|
+
return Companion_instance_7;
|
|
1707
1916
|
}
|
|
1708
1917
|
function Wind(speedMS, directionRad) {
|
|
1709
|
-
|
|
1918
|
+
Companion_getInstance_10();
|
|
1710
1919
|
this.speedMS_1 = speedMS;
|
|
1711
1920
|
this.directionRad_1 = directionRad;
|
|
1712
1921
|
}
|
|
@@ -1732,7 +1941,7 @@
|
|
|
1732
1941
|
function WindProviderNone() {
|
|
1733
1942
|
}
|
|
1734
1943
|
protoOf(WindProviderNone).wind_umf2tf_k$ = function (course, path, pointIndex) {
|
|
1735
|
-
return
|
|
1944
|
+
return Companion_getInstance_10().NONE_1;
|
|
1736
1945
|
};
|
|
1737
1946
|
var WindProviderNone_instance;
|
|
1738
1947
|
function WindProviderNone_getInstance() {
|
|
@@ -1744,6 +1953,50 @@
|
|
|
1744
1953
|
protoOf(WindProviderConstant).wind_umf2tf_k$ = function (course, path, pointIndex) {
|
|
1745
1954
|
return this.wind_1;
|
|
1746
1955
|
};
|
|
1956
|
+
function WPrimeBalanceComputer() {
|
|
1957
|
+
}
|
|
1958
|
+
protoOf(WPrimeBalanceComputer).compute_ewvoaz_k$ = function (path, options) {
|
|
1959
|
+
if (path.size_1 === 0)
|
|
1960
|
+
return Unit_instance;
|
|
1961
|
+
var cp = options.criticalPowerW_1;
|
|
1962
|
+
var wPrime = options.wPrimeJ_1;
|
|
1963
|
+
var balance = wPrime;
|
|
1964
|
+
path.setWPrimeBalance_stwqkw_k$(0, balance);
|
|
1965
|
+
var inductionVariable = 1;
|
|
1966
|
+
var last = path.size_1;
|
|
1967
|
+
if (inductionVariable < last)
|
|
1968
|
+
do {
|
|
1969
|
+
var i = inductionVariable;
|
|
1970
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1971
|
+
var dtSeconds = (path.time_ryc845_k$(i) - path.time_ryc845_k$(i - 1 | 0)) / 1000.0;
|
|
1972
|
+
var power = path.pComputedPower_g6dnn4_k$(i);
|
|
1973
|
+
if (isFinite(dtSeconds) && dtSeconds > 0.0 && isFinite(power)) {
|
|
1974
|
+
balance = this.step_447nu7_k$(balance, power, cp, wPrime, dtSeconds);
|
|
1975
|
+
}
|
|
1976
|
+
path.setWPrimeBalance_stwqkw_k$(i, balance);
|
|
1977
|
+
}
|
|
1978
|
+
while (inductionVariable < last);
|
|
1979
|
+
};
|
|
1980
|
+
protoOf(WPrimeBalanceComputer).step_447nu7_k$ = function (balance, power, cp, wPrime, dtSeconds) {
|
|
1981
|
+
var tmp;
|
|
1982
|
+
if (power >= cp) {
|
|
1983
|
+
tmp = balance - (power - cp) * dtSeconds;
|
|
1984
|
+
} else {
|
|
1985
|
+
var tmp_0 = wPrime - balance;
|
|
1986
|
+
// Inline function 'kotlin.math.exp' call
|
|
1987
|
+
var x = -(cp - power) * dtSeconds / wPrime;
|
|
1988
|
+
tmp = wPrime - tmp_0 * Math.exp(x);
|
|
1989
|
+
}
|
|
1990
|
+
var next = tmp;
|
|
1991
|
+
// Inline function 'kotlin.math.max' call
|
|
1992
|
+
// Inline function 'kotlin.math.min' call
|
|
1993
|
+
var b = Math.max(0.0, next);
|
|
1994
|
+
return Math.min(wPrime, b);
|
|
1995
|
+
};
|
|
1996
|
+
var WPrimeBalanceComputer_instance;
|
|
1997
|
+
function WPrimeBalanceComputer_getInstance() {
|
|
1998
|
+
return WPrimeBalanceComputer_instance;
|
|
1999
|
+
}
|
|
1747
2000
|
function parseGpxWaypoints(xml) {
|
|
1748
2001
|
// Inline function 'kotlin.collections.map' call
|
|
1749
2002
|
var this_0 = GpxParser_instance.parse$default_ez0f31_k$(xml).waypoints_1;
|
|
@@ -2010,7 +2263,13 @@
|
|
|
2010
2263
|
function toBike(_this__u8e3s4) {
|
|
2011
2264
|
if (_this__u8e3s4 == null)
|
|
2012
2265
|
return new Bike();
|
|
2013
|
-
|
|
2266
|
+
var tmp = _this__u8e3s4.crr;
|
|
2267
|
+
var tmp_0 = _this__u8e3s4.inertiaFront;
|
|
2268
|
+
var tmp_1 = _this__u8e3s4.inertiaRear;
|
|
2269
|
+
var tmp_2 = _this__u8e3s4.wheelRadiusM;
|
|
2270
|
+
var tmp_3 = _this__u8e3s4.efficiency;
|
|
2271
|
+
var tmp0_elvis_lhs = _this__u8e3s4.maxPedalingLeanAngleDeg;
|
|
2272
|
+
return new Bike(tmp, tmp_0, tmp_1, tmp_2, tmp_3, tmp0_elvis_lhs == null ? 20.0 : tmp0_elvis_lhs);
|
|
2014
2273
|
}
|
|
2015
2274
|
function toWindProvider(_this__u8e3s4) {
|
|
2016
2275
|
if (_this__u8e3s4 == null)
|
|
@@ -2028,13 +2287,13 @@
|
|
|
2028
2287
|
var tmp2_elvis_lhs = _this__u8e3s4.useHarmonics;
|
|
2029
2288
|
tmp = new PowerProviderConstant(tmp_0, tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs);
|
|
2030
2289
|
break;
|
|
2031
|
-
case '
|
|
2290
|
+
case 'durability':
|
|
2032
2291
|
var tmp3_elvis_lhs = _this__u8e3s4.power;
|
|
2033
2292
|
var tmp_1 = tmp3_elvis_lhs == null ? 250.0 : tmp3_elvis_lhs;
|
|
2034
|
-
var tmp4_elvis_lhs = _this__u8e3s4.
|
|
2035
|
-
var tmp_2 = tmp4_elvis_lhs == null ?
|
|
2036
|
-
var tmp5_elvis_lhs = _this__u8e3s4.
|
|
2037
|
-
tmp = new
|
|
2293
|
+
var tmp4_elvis_lhs = _this__u8e3s4.criticalPower;
|
|
2294
|
+
var tmp_2 = tmp4_elvis_lhs == null ? 250.0 : tmp4_elvis_lhs;
|
|
2295
|
+
var tmp5_elvis_lhs = _this__u8e3s4.useHarmonics;
|
|
2296
|
+
tmp = new PowerProviderDurability(tmp_1, tmp_2, VOID, VOID, tmp5_elvis_lhs == null ? false : tmp5_elvis_lhs);
|
|
2038
2297
|
break;
|
|
2039
2298
|
case 'from_data':
|
|
2040
2299
|
tmp = PowerProviderFromData_instance;
|
|
@@ -2220,6 +2479,7 @@
|
|
|
2220
2479
|
MaxSpeedComputer_instance = new MaxSpeedComputer();
|
|
2221
2480
|
MuscularPowerProvider_instance = new MuscularPowerProvider();
|
|
2222
2481
|
PowerComputer_instance = new PowerComputer();
|
|
2482
|
+
Companion_instance_6 = new Companion_6();
|
|
2223
2483
|
PowerProviderFromData_instance = new PowerProviderFromData();
|
|
2224
2484
|
RhoProviderDefault_instance = new RhoProviderDefault();
|
|
2225
2485
|
RhoProviderEstimate_instance = new RhoProviderEstimate();
|
|
@@ -2227,6 +2487,7 @@
|
|
|
2227
2487
|
VirtualizeService_instance = new VirtualizeService();
|
|
2228
2488
|
WheelBearingsPowerProvider_instance = new WheelBearingsPowerProvider();
|
|
2229
2489
|
WindProviderNone_instance = new WindProviderNone();
|
|
2490
|
+
WPrimeBalanceComputer_instance = new WPrimeBalanceComputer();
|
|
2230
2491
|
//endregion
|
|
2231
2492
|
//region block: exports
|
|
2232
2493
|
function $jsExportAll$(_) {
|
|
@@ -2266,6 +2527,7 @@
|
|
|
2266
2527
|
}
|
|
2267
2528
|
$jsExportAll$(_);
|
|
2268
2529
|
kotlin_io_github_glandais_elevation.$jsExportAll$(_);
|
|
2530
|
+
kotlin_io_github_glandais_fit_kotlin_sdk.$jsExportAll$(_);
|
|
2269
2531
|
//endregion
|
|
2270
2532
|
return _;
|
|
2271
2533
|
}));
|