@idm-plugin/vessel 1.5.3 → 1.5.5
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/dist/ais/src/index.d.ts +4 -0
- package/dist/index.js +320 -297
- package/dist/index.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var st = Object.defineProperty;
|
|
2
|
-
var at = (
|
|
3
|
-
var Z = (
|
|
4
|
-
import
|
|
2
|
+
var at = (k, s, t) => s in k ? st(k, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : k[s] = t;
|
|
3
|
+
var Z = (k, s, t) => (at(k, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
|
+
import O from "got";
|
|
5
5
|
import z from "@log4js-node/log4js-api";
|
|
6
6
|
import v from "moment";
|
|
7
7
|
import { LngLatHelper as B, LaneHelper as V } from "@idm-plugin/geo";
|
|
8
8
|
import { MeteoHelper2 as ot, MeteoHelper as nt } from "@idm-plugin/meteo2";
|
|
9
9
|
import { Meteo2Assist as tt } from "@idm-plugin/meteo";
|
|
10
|
-
let
|
|
10
|
+
let u;
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
u = z.getLogger("vessel");
|
|
13
13
|
} catch {
|
|
14
14
|
} finally {
|
|
15
15
|
}
|
|
@@ -19,79 +19,79 @@ class K {
|
|
|
19
19
|
* @param status
|
|
20
20
|
*/
|
|
21
21
|
parseStatus(s) {
|
|
22
|
-
let t,
|
|
22
|
+
let t, i;
|
|
23
23
|
switch (s) {
|
|
24
24
|
case 0:
|
|
25
|
-
t = "在航(主机推动)",
|
|
25
|
+
t = "在航(主机推动)", i = "The engine is in use";
|
|
26
26
|
break;
|
|
27
27
|
case 1:
|
|
28
|
-
t = "锚泊",
|
|
28
|
+
t = "锚泊", i = "Anchored";
|
|
29
29
|
break;
|
|
30
30
|
case 2:
|
|
31
|
-
t = "失控",
|
|
31
|
+
t = "失控", i = "Not operated";
|
|
32
32
|
break;
|
|
33
33
|
case 3:
|
|
34
|
-
t = "操纵受限",
|
|
34
|
+
t = "操纵受限", i = "Limited airworthiness";
|
|
35
35
|
break;
|
|
36
36
|
case 4:
|
|
37
|
-
t = "吃水受限",
|
|
37
|
+
t = "吃水受限", i = "Limited by ship's draft";
|
|
38
38
|
break;
|
|
39
39
|
case 5:
|
|
40
|
-
t = "靠泊",
|
|
40
|
+
t = "靠泊", i = "Mooring";
|
|
41
41
|
break;
|
|
42
42
|
case 6:
|
|
43
|
-
t = "搁浅",
|
|
43
|
+
t = "搁浅", i = "Stranded";
|
|
44
44
|
break;
|
|
45
45
|
case 7:
|
|
46
|
-
t = "捕捞作业",
|
|
46
|
+
t = "捕捞作业", i = "Engaged in fishing";
|
|
47
47
|
break;
|
|
48
48
|
case 8:
|
|
49
|
-
t = "靠帆船提供动力",
|
|
49
|
+
t = "靠帆船提供动力", i = "Sailing";
|
|
50
50
|
break;
|
|
51
51
|
default:
|
|
52
|
-
t = "未定义",
|
|
52
|
+
t = "未定义", i = "Undefined";
|
|
53
53
|
}
|
|
54
|
-
return { labelCn: t, labelEn:
|
|
54
|
+
return { labelCn: t, labelEn: i };
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
class bt extends K {
|
|
58
|
-
constructor(t,
|
|
58
|
+
constructor(t, i) {
|
|
59
59
|
super();
|
|
60
60
|
Z(this, "clientId");
|
|
61
61
|
Z(this, "clientSecret");
|
|
62
62
|
Z(this, "token");
|
|
63
|
-
this.clientId = t, this.clientSecret =
|
|
63
|
+
this.clientId = t, this.clientSecret = i;
|
|
64
64
|
}
|
|
65
65
|
async authToken(t = {}) {
|
|
66
|
-
const
|
|
66
|
+
const i = "https://svc.data.myvessel.cn/ada/oauth/token", o = {
|
|
67
67
|
searchParams: {
|
|
68
68
|
client_id: this.clientId,
|
|
69
69
|
client_secret: this.clientSecret,
|
|
70
70
|
grant_type: "client_credentials"
|
|
71
71
|
}
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
accessToken:
|
|
75
|
-
tokenType:
|
|
76
|
-
expiresIn:
|
|
77
|
-
scope:
|
|
78
|
-
jti:
|
|
72
|
+
}, n = await O.post(i, o).json();
|
|
73
|
+
u == null || u.info("[%s] fetch access token from: %s - %j", t.requestId, i, n), n.error || (this.token = {
|
|
74
|
+
accessToken: n.access_token,
|
|
75
|
+
tokenType: n.token_type,
|
|
76
|
+
expiresIn: n.expires_in,
|
|
77
|
+
scope: n.scope,
|
|
78
|
+
jti: n.jti,
|
|
79
79
|
issuedAt: v().utc().format()
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
async realTimePosition(t,
|
|
82
|
+
async realTimePosition(t, i = {}) {
|
|
83
83
|
var d, f, M;
|
|
84
|
-
(!this.token || v().diff(v(this.token.issuedAt), "seconds") > ((d = this.token) == null ? void 0 : d.expiresIn) - 300) && await this.authToken(
|
|
85
|
-
const
|
|
84
|
+
(!this.token || v().diff(v(this.token.issuedAt), "seconds") > ((d = this.token) == null ? void 0 : d.expiresIn) - 300) && await this.authToken(i);
|
|
85
|
+
const o = "https://svc.data.myvessel.cn/sdc/v1/vessels/status/location/unit", n = {
|
|
86
86
|
headers: {
|
|
87
87
|
Authorization: `${(f = this.token) == null ? void 0 : f.tokenType} ${(M = this.token) == null ? void 0 : M.accessToken}`
|
|
88
88
|
},
|
|
89
89
|
searchParams: { mmsi: t }
|
|
90
90
|
};
|
|
91
|
-
|
|
92
|
-
const a = await
|
|
91
|
+
u == null || u.info("[%s] fetch realtime position from: %s - %j", i.requestId, o, n);
|
|
92
|
+
const a = await O.get(o, n).json();
|
|
93
93
|
if (a.code)
|
|
94
|
-
return
|
|
94
|
+
return u == null || u.warn("[%s] fetch realtime position failed: %j", i.requestId, o, { message: a.message, status: a.status, code: a.code }), a;
|
|
95
95
|
const e = a.data;
|
|
96
96
|
for (const m in e)
|
|
97
97
|
!isNaN(e[m]) && Number(e[m]) !== 1 / 0 && (e[m] = Number(e[m]));
|
|
@@ -121,54 +121,54 @@ class bt extends K {
|
|
|
121
121
|
utc: c.utc().format()
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
async trajectory(t, o, n,
|
|
124
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
125
125
|
(!this.token || v().diff(v(this.token.issuedAt), "seconds") > this.token.expiresIn - 300) && await this.authToken(e);
|
|
126
|
-
const c = await this.realTimePosition(t, e), r = v(
|
|
126
|
+
const c = await this.realTimePosition(t, e), r = v(i), d = v(o), f = [];
|
|
127
127
|
for (; d.diff(r, "day", !0) > 30; )
|
|
128
|
-
await this.trajectoryIn30Day(t, r, r.clone().add(30, "day"), c,
|
|
129
|
-
return await this.trajectoryIn30Day(t, r, d, c,
|
|
128
|
+
await this.trajectoryIn30Day(t, r, r.clone().add(30, "day"), c, n, f, e), r.add(30, "day");
|
|
129
|
+
return await this.trajectoryIn30Day(t, r, d, c, n, f, e), f;
|
|
130
130
|
}
|
|
131
|
-
async trajectoryIn30Day(t, o, n,
|
|
132
|
-
var
|
|
131
|
+
async trajectoryIn30Day(t, i, o, n, a, e, c = {}) {
|
|
132
|
+
var h, w, I, b, p;
|
|
133
133
|
const r = "https://svc.data.myvessel.cn/sdc/v1/vessels/status/track", d = {
|
|
134
134
|
headers: {
|
|
135
|
-
Authorization: `${(
|
|
135
|
+
Authorization: `${(h = this.token) == null ? void 0 : h.tokenType} ${(w = this.token) == null ? void 0 : w.accessToken}`
|
|
136
136
|
},
|
|
137
137
|
json: {
|
|
138
138
|
mmsi: t,
|
|
139
|
-
startTime:
|
|
140
|
-
endTime:
|
|
139
|
+
startTime: i.utcOffset(8).format("YYYY-MM-DD HH:mm:ss"),
|
|
140
|
+
endTime: o.utcOffset(8).format("YYYY-MM-DD HH:mm:ss")
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
|
|
144
|
-
const f = await
|
|
143
|
+
u == null || u.info("[%s] fetch trajectory from: %s - %j", c.requestId, r, d);
|
|
144
|
+
const f = await O.post(r, d).json();
|
|
145
145
|
if (f.code)
|
|
146
|
-
return
|
|
146
|
+
return u == null || u.warn("[%s] fetch trajectory failed: %j", c.requestId, r, { message: f.message, status: f.status, code: f.code }), f;
|
|
147
147
|
let M = -1;
|
|
148
|
-
const m = v(`${(b = (
|
|
148
|
+
const m = v(`${(b = (I = f.data) == null ? void 0 : I[0]) == null ? void 0 : b.postime} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
149
149
|
return (p = f.data) == null || p.forEach((l) => {
|
|
150
|
-
for (const
|
|
151
|
-
!isNaN(l[
|
|
152
|
-
const
|
|
150
|
+
for (const R in l)
|
|
151
|
+
!isNaN(l[R]) && Number(l[R]) !== 1 / 0 && (l[R] = Number(l[R]));
|
|
152
|
+
const Y = v(`${l.postime} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00"), j = l.status, { labelCn: y, labelEn: g } = this.parseStatus(j), D = {
|
|
153
153
|
mmsi: l.mmsi,
|
|
154
|
-
imo:
|
|
154
|
+
imo: n == null ? void 0 : n.imo,
|
|
155
155
|
lat: l.lat,
|
|
156
156
|
lng: l.lon,
|
|
157
157
|
sog: l.sog,
|
|
158
158
|
cog: l.cog,
|
|
159
159
|
hdg: l.hdg,
|
|
160
160
|
draught: l.draught,
|
|
161
|
-
status:
|
|
161
|
+
status: j,
|
|
162
162
|
eta: /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(l.eta) ? v(`${l.eta} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00").utc().format() : void 0,
|
|
163
163
|
destination: l.dest,
|
|
164
|
-
positionTime:
|
|
164
|
+
positionTime: Y.unix(),
|
|
165
165
|
labelCn: y,
|
|
166
166
|
labelEn: g,
|
|
167
167
|
method: "trajectory",
|
|
168
168
|
vendor: "myVessel",
|
|
169
|
-
utc:
|
|
170
|
-
}, F = Math.floor(
|
|
171
|
-
F !== M && (M = F, e.push(
|
|
169
|
+
utc: Y.utc().format()
|
|
170
|
+
}, F = Math.floor(Y.diff(m, "minute", !0) / (a || 1));
|
|
171
|
+
F !== M && (M = F, e.push(D));
|
|
172
172
|
}), e;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -178,17 +178,17 @@ class vt extends K {
|
|
|
178
178
|
Z(this, "token");
|
|
179
179
|
this.token = t;
|
|
180
180
|
}
|
|
181
|
-
async realTimePosition(t,
|
|
182
|
-
const
|
|
181
|
+
async realTimePosition(t, i = {}) {
|
|
182
|
+
const o = "https://api.hifleet.com/position/position/get/token", n = {
|
|
183
183
|
searchParams: {
|
|
184
184
|
mmsi: t,
|
|
185
185
|
usertoken: this.token
|
|
186
186
|
}
|
|
187
|
-
}, a = await
|
|
188
|
-
|
|
187
|
+
}, a = await O.post(o, n).json();
|
|
188
|
+
u == null || u.info("[%s] fetch realtime position from: %s - %j", i.requestId, o, n);
|
|
189
189
|
const e = a == null ? void 0 : a.list;
|
|
190
190
|
if (!e)
|
|
191
|
-
return
|
|
191
|
+
return u == null || u.warn("[%s] fetch realtime position failed: %j", i.requestId, o, a), a;
|
|
192
192
|
for (const m in e)
|
|
193
193
|
!isNaN(e[m]) && Number(e[m]) !== 1 / 0 && (e[m] = Number(e[m]));
|
|
194
194
|
e.status = e.sp > 3 ? 0 : 1;
|
|
@@ -218,9 +218,9 @@ class vt extends K {
|
|
|
218
218
|
vendor: "hifleet"
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
async search(t,
|
|
222
|
-
let
|
|
223
|
-
const
|
|
221
|
+
async search(t, i = {}) {
|
|
222
|
+
let o = "https://www.hifleet.com/hifleetapi/searchVesselOL.do";
|
|
223
|
+
const n = {
|
|
224
224
|
searchParams: {
|
|
225
225
|
keyword: t
|
|
226
226
|
},
|
|
@@ -230,8 +230,8 @@ class vt extends K {
|
|
|
230
230
|
Host: "www.hifleet.com"
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
let a = await
|
|
234
|
-
|
|
233
|
+
let a = await O.post(o, n).json();
|
|
234
|
+
u == null || u.info("[%s] fetch vessel props from: %s - %j", i.requestId, o, n), a instanceof Array && (a = a[0]);
|
|
235
235
|
for (const c in a)
|
|
236
236
|
!isNaN(a[c]) && Number(a[c]) !== 1 / 0 && (a[c] = Number(a[c]));
|
|
237
237
|
const e = {
|
|
@@ -243,13 +243,36 @@ class vt extends K {
|
|
|
243
243
|
breadth: a.b,
|
|
244
244
|
draught: a.dr
|
|
245
245
|
};
|
|
246
|
-
return
|
|
246
|
+
return o = "https://www.hifleet.com/hifleetapi/sameShipSearch.do", a = await O.post(o, n).json(), u == null || u.info("[%s] search vessel dead weight from: %s - %j", i.requestId, o, n), a instanceof Array && (a = a[0]), a && (e.deadweight = Number(a.dwt)), e;
|
|
247
|
+
}
|
|
248
|
+
async suggest(t, i = {}) {
|
|
249
|
+
const o = "https://www.hifleet.com/hifleetapi/getShipSuggest.do", n = {
|
|
250
|
+
searchParams: {
|
|
251
|
+
q: t
|
|
252
|
+
},
|
|
253
|
+
headers: {
|
|
254
|
+
Referer: "https://www.hifleet.com",
|
|
255
|
+
Origin: "https://www.hifleet.com",
|
|
256
|
+
Host: "www.hifleet.com"
|
|
257
|
+
}
|
|
258
|
+
}, a = await O.post(o, n).json();
|
|
259
|
+
u == null || u.info("[%s] suggest vessel props from: %s - %j", i.requestId, o, n);
|
|
260
|
+
const e = [];
|
|
261
|
+
for (const c of a)
|
|
262
|
+
e.push({
|
|
263
|
+
mmsi: !c.mmsi || isNaN(c.mmsi) ? null : Number(c.mmsi),
|
|
264
|
+
name: c.name,
|
|
265
|
+
callSign: c.callsign,
|
|
266
|
+
imo: !c.imo || isNaN(c.imo) ? null : Number(c.imo),
|
|
267
|
+
score: c._score
|
|
268
|
+
});
|
|
269
|
+
return e.sort((c, r) => r.score - c.score), e;
|
|
247
270
|
}
|
|
248
|
-
async trajectory(t, o, n,
|
|
249
|
-
var l,
|
|
271
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
272
|
+
var l, Y, j;
|
|
250
273
|
const c = await this.realTimePosition(t, e);
|
|
251
|
-
let r = v(
|
|
252
|
-
const d = v(
|
|
274
|
+
let r = v(i);
|
|
275
|
+
const d = v(o), f = v();
|
|
253
276
|
if (a) {
|
|
254
277
|
let y = d.diff(r, "d", !0);
|
|
255
278
|
y < 0 ? r = d.clone().subtract(40, "d") : y < 30 ? r.subtract(10, "d") : y < 60 ? r.subtract(5, "d") : r = d.clone().subtract(80, "d"), y = f.diff(d, "d", !0), d.add(y > 10 ? 240 : y * 24, "h");
|
|
@@ -261,19 +284,19 @@ class vt extends K {
|
|
|
261
284
|
mmsi: t,
|
|
262
285
|
usertoken: this.token
|
|
263
286
|
}
|
|
264
|
-
}, m = "https://api.hifleet.com/position/trajectory/nocompressed/withstatic/token",
|
|
265
|
-
|
|
266
|
-
let
|
|
267
|
-
|
|
268
|
-
const
|
|
287
|
+
}, m = "https://api.hifleet.com/position/trajectory/nocompressed/withstatic/token", h = await O.get(m, M).json();
|
|
288
|
+
u == null || u.info("[%s] fetch trajectory from: %s - %j", e.requestId, m, M);
|
|
289
|
+
let w;
|
|
290
|
+
h && (w = ((Y = (l = h.ships) == null ? void 0 : l.offors) == null ? void 0 : Y.ship) || [], w.length || u == null || u.warn("[%s] fetch trajectory failed: %j", e.requestId, h));
|
|
291
|
+
const I = [];
|
|
269
292
|
let b = -1;
|
|
270
|
-
const p = v(`${(
|
|
271
|
-
for (const y of
|
|
293
|
+
const p = v(`${(j = w == null ? void 0 : w[0]) == null ? void 0 : j.ti} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
294
|
+
for (const y of w) {
|
|
272
295
|
for (const L in y)
|
|
273
296
|
!isNaN(y[L]) && Number(y[L]) !== 1 / 0 && (y[L] = Number(y[L]));
|
|
274
297
|
const g = v(`${y.ti} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
275
298
|
y.status = y.sp > 4 ? 0 : 1;
|
|
276
|
-
const { labelEn:
|
|
299
|
+
const { labelEn: D, labelCn: F } = this.parseStatus(y.status), R = {
|
|
277
300
|
mmsi: y.m,
|
|
278
301
|
name: y.n,
|
|
279
302
|
imo: c == null ? void 0 : c.imo,
|
|
@@ -287,30 +310,30 @@ class vt extends K {
|
|
|
287
310
|
utc: g.utc().format(),
|
|
288
311
|
status: y.status,
|
|
289
312
|
labelCn: F,
|
|
290
|
-
labelEn:
|
|
313
|
+
labelEn: D,
|
|
291
314
|
method: "trajectory",
|
|
292
315
|
vendor: "hifleet"
|
|
293
|
-
},
|
|
294
|
-
|
|
316
|
+
}, H = Math.floor(g.diff(p, "minute", !0) / (n || 1));
|
|
317
|
+
H !== b && (b = H, I.push(R));
|
|
295
318
|
}
|
|
296
|
-
return
|
|
319
|
+
return I;
|
|
297
320
|
}
|
|
298
321
|
}
|
|
299
|
-
class
|
|
322
|
+
class wt extends K {
|
|
300
323
|
constructor(t) {
|
|
301
324
|
super();
|
|
302
325
|
Z(this, "token");
|
|
303
326
|
this.token = t;
|
|
304
327
|
}
|
|
305
|
-
async realTimePosition(t,
|
|
306
|
-
const
|
|
328
|
+
async realTimePosition(t, i = {}) {
|
|
329
|
+
const o = {
|
|
307
330
|
searchParams: {
|
|
308
331
|
id: t,
|
|
309
332
|
k: this.token,
|
|
310
333
|
enc: 1
|
|
311
334
|
}
|
|
312
|
-
},
|
|
313
|
-
if (
|
|
335
|
+
}, n = "https://api.shipxy.com/apicall/GetSingleShip", a = await O.get(n, o).json();
|
|
336
|
+
if (u == null || u.info("[%s] fetch realtime position from: %s - %j", i.requestId, n, o), (a == null ? void 0 : a.status) !== 0)
|
|
314
337
|
return a;
|
|
315
338
|
const e = a.data[0];
|
|
316
339
|
for (const M in e)
|
|
@@ -339,9 +362,9 @@ class Yt extends K {
|
|
|
339
362
|
vendor: "shipxy"
|
|
340
363
|
};
|
|
341
364
|
}
|
|
342
|
-
async trajectory(t, o, n,
|
|
365
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
343
366
|
var p;
|
|
344
|
-
const c = await this.realTimePosition(t, e), r = v(
|
|
367
|
+
const c = await this.realTimePosition(t, e), r = v(i), d = v(o), f = "https://api.shipxy.com/apicall/GetShipTrack", M = {
|
|
345
368
|
searchParams: {
|
|
346
369
|
id: t,
|
|
347
370
|
k: this.token,
|
|
@@ -350,60 +373,60 @@ class Yt extends K {
|
|
|
350
373
|
btm: r.unix(),
|
|
351
374
|
etm: d.unix()
|
|
352
375
|
}
|
|
353
|
-
}, m = await
|
|
354
|
-
if (
|
|
376
|
+
}, m = await O.get(f, M).json();
|
|
377
|
+
if (u == null || u.info("[%s] fetch trajectory from: %s - %j", e.requestId, f, M), (m == null ? void 0 : m.status) !== 0)
|
|
355
378
|
return m;
|
|
356
|
-
const
|
|
379
|
+
const h = m == null ? void 0 : m.points, w = [], I = v.unix((p = h[0]) == null ? void 0 : p.utc);
|
|
357
380
|
let b = -1;
|
|
358
|
-
for (const l of
|
|
359
|
-
const
|
|
381
|
+
for (const l of h) {
|
|
382
|
+
const Y = v.unix(l.utc), j = {
|
|
360
383
|
imo: c == null ? void 0 : c.imo,
|
|
361
384
|
mmsi: t,
|
|
362
385
|
sog: Math.round(l.sog * 3600 / 1e3 / 1852 * 100) / 100,
|
|
363
386
|
cog: Math.round(l.cog / 100 * 100) / 100,
|
|
364
387
|
lat: Math.round(l.lat / 1e6 * 1e5) / 1e5,
|
|
365
388
|
lng: Math.round(l.lon / 1e6 * 1e5) / 1e5,
|
|
366
|
-
positionTime:
|
|
367
|
-
utc:
|
|
389
|
+
positionTime: Y.unix(),
|
|
390
|
+
utc: Y.utc().format(),
|
|
368
391
|
method: "trajectory",
|
|
369
392
|
vendor: "shipxy"
|
|
370
|
-
}, y = Math.floor(
|
|
371
|
-
y !== b && (b = y,
|
|
393
|
+
}, y = Math.floor(Y.diff(I, "minute", !0) / (n || 1));
|
|
394
|
+
y !== b && (b = y, w.push(j));
|
|
372
395
|
}
|
|
373
|
-
return
|
|
396
|
+
return w;
|
|
374
397
|
}
|
|
375
398
|
}
|
|
376
|
-
class
|
|
399
|
+
class Yt extends K {
|
|
377
400
|
constructor(t) {
|
|
378
401
|
super();
|
|
379
402
|
Z(this, "token");
|
|
380
403
|
this.token = t;
|
|
381
404
|
}
|
|
382
|
-
async getShipId(t,
|
|
383
|
-
const
|
|
405
|
+
async getShipId(t, i = {}) {
|
|
406
|
+
const o = {
|
|
384
407
|
headers: {
|
|
385
408
|
appKey: this.token
|
|
386
409
|
},
|
|
387
410
|
json: {
|
|
388
411
|
mmsiList: t
|
|
389
412
|
}
|
|
390
|
-
},
|
|
391
|
-
return
|
|
413
|
+
}, n = "https://api3.myships.com/sp/ships/getShipIdByMMSI", a = await O.post(n, o).json();
|
|
414
|
+
return u == null || u.info("[%s] fetch ship id from: %s - %j", i.requestId, n, o), a.code !== "0" ? a : a.data[0].shipId;
|
|
392
415
|
}
|
|
393
|
-
async getShipInfo(t,
|
|
394
|
-
const
|
|
416
|
+
async getShipInfo(t, i = {}) {
|
|
417
|
+
const o = {
|
|
395
418
|
headers: {
|
|
396
419
|
appKey: this.token
|
|
397
420
|
},
|
|
398
421
|
json: {
|
|
399
422
|
shipId: t
|
|
400
423
|
}
|
|
401
|
-
},
|
|
402
|
-
if (
|
|
424
|
+
}, n = "https://api3.myships.com/sp/ships/aissta", a = await O.post(n, o).json();
|
|
425
|
+
if (u == null || u.info("[%s] fetch ship info from: %s - %j", i.requestId, n, o), a.code !== "0")
|
|
403
426
|
return a;
|
|
404
427
|
const e = a.data;
|
|
405
428
|
let c = e.imo;
|
|
406
|
-
return t === "407170" && (c = "9198379",
|
|
429
|
+
return t === "407170" && (c = "9198379", u == null || u.warn("[%s] ship(%s) imo error: %s, should be %s", i.requestId, t, e.imo, c)), {
|
|
407
430
|
mmsi: e.mmsi,
|
|
408
431
|
name: e.shipnameEn,
|
|
409
432
|
imo: c,
|
|
@@ -413,22 +436,22 @@ class kt extends K {
|
|
|
413
436
|
draught: (e.draught || 100) / 10
|
|
414
437
|
};
|
|
415
438
|
}
|
|
416
|
-
async realTimePosition(t,
|
|
417
|
-
const
|
|
439
|
+
async realTimePosition(t, i = {}) {
|
|
440
|
+
const o = await this.getShipId(t, i), n = await this.getShipInfo(o, i), a = {
|
|
418
441
|
headers: {
|
|
419
442
|
appKey: this.token
|
|
420
443
|
},
|
|
421
444
|
json: {
|
|
422
|
-
shipId:
|
|
445
|
+
shipId: o
|
|
423
446
|
}
|
|
424
|
-
}, e = "https://api3.myships.com/sp/ships/position/latest", c = await
|
|
425
|
-
|
|
447
|
+
}, e = "https://api3.myships.com/sp/ships/position/latest", c = await O.post(e, a).json();
|
|
448
|
+
u == null || u.info("[%s] fetch realtime position from: %s - %j", i.requestId, e, a);
|
|
426
449
|
const r = c.data[0];
|
|
427
|
-
for (const
|
|
428
|
-
!isNaN(r[
|
|
450
|
+
for (const h in r)
|
|
451
|
+
!isNaN(r[h]) && Number(r[h]) !== 1 / 0 && (r[h] = Number(r[h]));
|
|
429
452
|
const { labelCn: d, labelEn: f } = await this.parseStatus(r.aisNavStatus), M = v.unix(r.posTime);
|
|
430
453
|
return {
|
|
431
|
-
...
|
|
454
|
+
...n,
|
|
432
455
|
mmsi: t,
|
|
433
456
|
lat: Math.round(r.lat / 1e4 / 60 * 1e5) / 1e5,
|
|
434
457
|
lng: Math.round(r.lon / 1e4 / 60 * 1e5) / 1e5,
|
|
@@ -445,34 +468,34 @@ class kt extends K {
|
|
|
445
468
|
vendor: "myship"
|
|
446
469
|
};
|
|
447
470
|
}
|
|
448
|
-
async trajectory(t, o, n,
|
|
449
|
-
const c = v(
|
|
471
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
472
|
+
const c = v(i), r = v(o), d = await this.getShipId(t), f = await this.getShipInfo(d), M = [];
|
|
450
473
|
for (; r.diff(c, "day", !0) > 30; )
|
|
451
|
-
await this.trajectoryIn30Day(d, c.unix(), c.add(30, "day").unix(), f, t,
|
|
452
|
-
return await this.trajectoryIn30Day(d, c.unix(), r.unix(), f, t,
|
|
474
|
+
await this.trajectoryIn30Day(d, c.unix(), c.add(30, "day").unix(), f, t, n, M);
|
|
475
|
+
return await this.trajectoryIn30Day(d, c.unix(), r.unix(), f, t, n, M), M;
|
|
453
476
|
}
|
|
454
|
-
async trajectoryIn30Day(t, o, n,
|
|
455
|
-
var
|
|
477
|
+
async trajectoryIn30Day(t, i, o, n, a, e, c, r = {}) {
|
|
478
|
+
var I;
|
|
456
479
|
const d = {
|
|
457
480
|
headers: {
|
|
458
481
|
appKey: this.token
|
|
459
482
|
},
|
|
460
483
|
json: {
|
|
461
484
|
shipId: t,
|
|
462
|
-
startTime:
|
|
463
|
-
endTime:
|
|
485
|
+
startTime: i,
|
|
486
|
+
endTime: o
|
|
464
487
|
}
|
|
465
|
-
}, f = "https://api3.myships.com/sp/ships/position/history", M = await
|
|
466
|
-
if (
|
|
467
|
-
return
|
|
488
|
+
}, f = "https://api3.myships.com/sp/ships/position/history", M = await O.post(f, d).json();
|
|
489
|
+
if (u == null || u.info("[%s] fetch trajectory from: %s - %j", r.requestId, f, d), M.code !== "0")
|
|
490
|
+
return u == null || u.warn("[%s] invoke myship trajectory failed: %j", r.requestId, M), M;
|
|
468
491
|
const m = M.data;
|
|
469
492
|
for (const b in m)
|
|
470
493
|
!isNaN(m[b]) && Number(m[b]) !== 1 / 0 && (m[b] = Number(m[b]));
|
|
471
|
-
const
|
|
472
|
-
let
|
|
494
|
+
const h = v.unix((I = m[0]) == null ? void 0 : I.posTime);
|
|
495
|
+
let w = -1;
|
|
473
496
|
for (const b of m) {
|
|
474
497
|
const p = v.unix(b.posTime), l = {
|
|
475
|
-
imo:
|
|
498
|
+
imo: n == null ? void 0 : n.imo,
|
|
476
499
|
mmsi: a,
|
|
477
500
|
lat: Math.round(b.lat / 1e4 / 60 * 1e5) / 1e5,
|
|
478
501
|
lng: Math.round(b.lon / 1e4 / 60 * 1e5) / 1e5,
|
|
@@ -484,19 +507,19 @@ class kt extends K {
|
|
|
484
507
|
utc: p.utc().format(),
|
|
485
508
|
method: "trajectory",
|
|
486
509
|
vendor: "myship"
|
|
487
|
-
},
|
|
488
|
-
|
|
510
|
+
}, Y = Math.floor(p.diff(h, "minute", !0) / (e || 1));
|
|
511
|
+
Y !== w && (w = Y, c.push(l));
|
|
489
512
|
}
|
|
490
513
|
return c;
|
|
491
514
|
}
|
|
492
515
|
}
|
|
493
|
-
let
|
|
516
|
+
let A;
|
|
494
517
|
try {
|
|
495
|
-
|
|
518
|
+
A = z.getLogger("vessel");
|
|
496
519
|
} catch {
|
|
497
520
|
} finally {
|
|
498
521
|
}
|
|
499
|
-
var it = /* @__PURE__ */ ((
|
|
522
|
+
var it = /* @__PURE__ */ ((k) => (k.NOTICE = "NOTICE", k.WARN = "WARN", k.HEAVY = "HEAVY", k.SEVERE = "SEVERE", k.ERROR = "ERROR", k.FATAL = "FATAL", k))(it || {});
|
|
500
523
|
class rt {
|
|
501
524
|
/**
|
|
502
525
|
* 解析告警规则, 多规则场景
|
|
@@ -508,19 +531,19 @@ class rt {
|
|
|
508
531
|
*/
|
|
509
532
|
parsePrinciple(s, t = {}) {
|
|
510
533
|
var e, c, r;
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
534
|
+
A == null || A.info("[%s] parse rule: %s", t.requestId, s);
|
|
535
|
+
const i = new RegExp("(?<=\\[)(.+)(?=])", "g"), o = s.match(i) ? (e = s.match(i)) == null ? void 0 : e[0] : void 0, n = o == null ? void 0 : o.split(";");
|
|
536
|
+
if (!n)
|
|
514
537
|
return;
|
|
515
538
|
const a = {};
|
|
516
|
-
for (let d = 0; d < (
|
|
517
|
-
const f = (r = (c =
|
|
539
|
+
for (let d = 0; d < (n == null ? void 0 : n.length); d++) {
|
|
540
|
+
const f = (r = (c = n[d].match(i)) == null ? void 0 : c[0]) == null ? void 0 : r.split("],");
|
|
518
541
|
if (d === 0 && !f)
|
|
519
|
-
a.scope =
|
|
542
|
+
a.scope = n[0];
|
|
520
543
|
else if (f)
|
|
521
544
|
for (let M = 0, m = f.length; M < m; M++) {
|
|
522
|
-
const
|
|
523
|
-
|
|
545
|
+
const h = this.parseRule(f[M]);
|
|
546
|
+
h && (a[h.level] ? h.key ? a[h.level][h == null ? void 0 : h.key] = h : a[h.level] = h : h.key ? a[h.level] = { [h == null ? void 0 : h.key]: h } : a[h.level] = h);
|
|
524
547
|
}
|
|
525
548
|
}
|
|
526
549
|
return a;
|
|
@@ -533,15 +556,15 @@ class rt {
|
|
|
533
556
|
*/
|
|
534
557
|
parseRule(s, t = {}) {
|
|
535
558
|
var a;
|
|
536
|
-
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
559
|
+
A == null || A.info("[%s] parse rule: %s", t.requestId, s), s = s.startsWith("[") ? s : `[${s}`, s = s.endsWith("]") ? s : `${s}]`;
|
|
560
|
+
const i = new RegExp("(?<=\\[)(.+?)(?=])", "g"), o = (a = s == null ? void 0 : s.match(i)) == null ? void 0 : a[0], n = o == null ? void 0 : o.split(",");
|
|
561
|
+
if (n)
|
|
539
562
|
return {
|
|
540
|
-
operator:
|
|
541
|
-
number: Number.isNaN(Number(
|
|
542
|
-
level:
|
|
543
|
-
time: Number(
|
|
544
|
-
key:
|
|
563
|
+
operator: n[0],
|
|
564
|
+
number: Number.isNaN(Number(n[1])) ? n[1] : Number(n[1]),
|
|
565
|
+
level: n[2],
|
|
566
|
+
time: Number(n[3]),
|
|
567
|
+
key: n[4]
|
|
545
568
|
};
|
|
546
569
|
}
|
|
547
570
|
/**
|
|
@@ -550,26 +573,26 @@ class rt {
|
|
|
550
573
|
* @param principle 告警规则
|
|
551
574
|
* @param options
|
|
552
575
|
*/
|
|
553
|
-
checkWeather(s, t,
|
|
554
|
-
var
|
|
555
|
-
let
|
|
556
|
-
const c = Math.round(((
|
|
576
|
+
checkWeather(s, t, i = {}) {
|
|
577
|
+
var h, w, I, b, p, l, Y, j, y, g, D, F, R, H, L;
|
|
578
|
+
let o = 0, n = 0, a = 0, e = 0;
|
|
579
|
+
const c = Math.round(((w = (h = t == null ? void 0 : t.SEVERE) == null ? void 0 : h.sigWave) == null ? void 0 : w.number) * 1.6 * 100) / 100, r = (b = (I = t == null ? void 0 : t.SEVERE) == null ? void 0 : I.sigWave) == null ? void 0 : b.number, d = (l = (p = t == null ? void 0 : t.HEAVY) == null ? void 0 : p.sigWave) == null ? void 0 : l.number, f = Math.round((((j = (Y = t == null ? void 0 : t.SEVERE) == null ? void 0 : Y.wind) == null ? void 0 : j.number) + 2) * 100) / 100, M = (g = (y = t == null ? void 0 : t.SEVERE) == null ? void 0 : y.wind) == null ? void 0 : g.number, m = (F = (D = t == null ? void 0 : t.HEAVY) == null ? void 0 : D.wind) == null ? void 0 : F.number;
|
|
557
580
|
for (let W = 0; W < (s == null ? void 0 : s.length); W++) {
|
|
558
|
-
const
|
|
559
|
-
e = E > e ? E : e,
|
|
581
|
+
const S = s[W], P = (H = (R = S == null ? void 0 : S.meteo) == null ? void 0 : R.wave) == null ? void 0 : H.sig, N = (L = S == null ? void 0 : S.meteo) == null ? void 0 : L.wind, E = W ? v(S.eta).diff(v(s[W - 1].eta), "hour", !0) : 0;
|
|
582
|
+
e = E > e ? E : e, A == null || A.info("[%s] check sig.wave: %j", i.requestId, { ...P, dgThd4Wv: c, svThd4Wv: r, hvThd4Wv: d }), (P == null ? void 0 : P.height) >= c ? S.isDangerous = !0 : (P == null ? void 0 : P.height) >= r ? S.isSevere = !0 : (P == null ? void 0 : P.height) >= d && (S.isHeavy = !0), A == null || A.info("[%s] check wind: %j", i.requestId, { ...N, dgThd4Wd: f, svThd4Wd: M, hvThd4Wd: m }), (N == null ? void 0 : N.scale) >= f ? (S.isDangerous = !0, delete S.isSevere, delete S.isHeavy) : (N == null ? void 0 : N.scale) > M ? (S.isDangerous || (S.isSevere = !0), delete S.isHeavy) : (N == null ? void 0 : N.scale) === m && !S.isDangerous && !S.isSevere && (S.isHeavy = !0), o += S.isDangerous ? E : 0, n += S.isSevere ? E : 0, a += S.isHeavy ? E : 0;
|
|
560
583
|
}
|
|
561
|
-
return
|
|
584
|
+
return o = Math.round(o * 100) / 100, n = Math.round(n * 100) / 100, a = Math.round(a * 100) / 100, e = Math.round(e), { sample: s, dangerous: o, severe: n, heavy: a, step: e < 3 ? 3 : e, wind: { dgThd4Wd: f, svThd4Wd: M, hvThd4Wd: m }, sig: { dgThd4Wv: c, svThd4Wv: r, hvThd4Wv: d } };
|
|
562
585
|
}
|
|
563
586
|
}
|
|
564
|
-
const
|
|
565
|
-
let
|
|
587
|
+
const kt = new rt();
|
|
588
|
+
let T;
|
|
566
589
|
try {
|
|
567
|
-
|
|
590
|
+
T = z.getLogger("vessel");
|
|
568
591
|
} catch {
|
|
569
592
|
} finally {
|
|
570
593
|
}
|
|
571
594
|
const ct = new ot("", !0);
|
|
572
|
-
var dt = /* @__PURE__ */ ((
|
|
595
|
+
var dt = /* @__PURE__ */ ((k) => (k.common = "common", k.container = "container", k.tugs = "tugs", k))(dt || {}), ut = /* @__PURE__ */ ((k) => (k.Ballast = "Ballast", k.Laden = "Laden", k))(ut || {}), ht = /* @__PURE__ */ ((k) => (k.Cp = "CP", k.Perf = "Basis", k.Instruct = "Other", k))(ht || {});
|
|
573
596
|
class C {
|
|
574
597
|
/**
|
|
575
598
|
* @see https://baike.baidu.com/item/%E6%96%B9%E5%BD%A2%E7%B3%BB%E6%95%B0/4965568?fr=aladdin
|
|
@@ -583,10 +606,10 @@ class C {
|
|
|
583
606
|
* @param draught 吃水 m
|
|
584
607
|
* @return [0.55, 0.85]
|
|
585
608
|
*/
|
|
586
|
-
static blockCoefficient(s, t,
|
|
587
|
-
let
|
|
588
|
-
|
|
589
|
-
const a = [0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85], e = a.map((c) => Math.abs(c -
|
|
609
|
+
static blockCoefficient(s, t, i, o) {
|
|
610
|
+
let n = Math.round(s / (t * i * o) * 100) / 100;
|
|
611
|
+
n = n < 0.55 ? 0.55 : n > 0.85 ? 0.85 : n;
|
|
612
|
+
const a = [0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85], e = a.map((c) => Math.abs(c - n));
|
|
590
613
|
return a[e.indexOf(Math.min(...e))];
|
|
591
614
|
}
|
|
592
615
|
/**
|
|
@@ -600,9 +623,9 @@ class C {
|
|
|
600
623
|
* @param g 重力加速度 9.80 m/s^2
|
|
601
624
|
* @return [0.05, 0.30]
|
|
602
625
|
*/
|
|
603
|
-
static froudeNumber(s, t,
|
|
604
|
-
let
|
|
605
|
-
return
|
|
626
|
+
static froudeNumber(s, t, i = 9.8) {
|
|
627
|
+
let o = Math.round(Math.sqrt(s * s / (i * t)) * 100) / 100;
|
|
628
|
+
return o = o < 0.05 ? 0.05 : o > 0.3 ? 0.3 : o, o;
|
|
606
629
|
}
|
|
607
630
|
/**
|
|
608
631
|
* 失速修正系數
|
|
@@ -611,8 +634,8 @@ class C {
|
|
|
611
634
|
* @param loadCondition
|
|
612
635
|
* @private
|
|
613
636
|
*/
|
|
614
|
-
static amendFactor(s, t,
|
|
615
|
-
const
|
|
637
|
+
static amendFactor(s, t, i) {
|
|
638
|
+
const o = {
|
|
616
639
|
0.55: [1.7, -1.4, -7.4],
|
|
617
640
|
0.6: [2.2, -2.5, -9.7],
|
|
618
641
|
0.65: [2.6, -3.7, -11.6],
|
|
@@ -630,7 +653,7 @@ class C {
|
|
|
630
653
|
0.8: [3, -16.3, -21.6],
|
|
631
654
|
0.85: [3.4, -20.9, 31.8]
|
|
632
655
|
}[s];
|
|
633
|
-
return
|
|
656
|
+
return i === "Laden" && (a = o[s]), a[0] + a[1] * t + a[2] * Math.pow(t, 2);
|
|
634
657
|
}
|
|
635
658
|
/**
|
|
636
659
|
* 失速方向因子
|
|
@@ -644,8 +667,8 @@ class C {
|
|
|
644
667
|
* @private
|
|
645
668
|
*/
|
|
646
669
|
static directionFactor(s, t = 0) {
|
|
647
|
-
let
|
|
648
|
-
return s > 30 && s <= 60 ?
|
|
670
|
+
let i;
|
|
671
|
+
return s > 30 && s <= 60 ? i = (1.7 - 0.03 * Math.pow(t - 4, 2)) / 2 : s > 60 && s <= 150 ? i = (0.9 - 0.06 * Math.pow(t - 6, 2)) / 2 : s > 150 && s <= 180 ? i = (0.4 - 0.03 * Math.pow(t - 8, 2)) / 2 : i = 1, Math.round(i * 1e5) / 1e5;
|
|
649
672
|
}
|
|
650
673
|
/**
|
|
651
674
|
* 失速船型因子
|
|
@@ -658,10 +681,10 @@ class C {
|
|
|
658
681
|
* @param bn
|
|
659
682
|
* @private
|
|
660
683
|
*/
|
|
661
|
-
static vesselTagFactor(s, t,
|
|
662
|
-
|
|
663
|
-
let
|
|
664
|
-
return
|
|
684
|
+
static vesselTagFactor(s, t, i, o = 0) {
|
|
685
|
+
o = o > 6 ? o - 0.9 * (o - 6) : o;
|
|
686
|
+
let n;
|
|
687
|
+
return i === "container" ? n = 0.7 * o + Math.pow(o, 6.5) / (22 * Math.pow(s, 2 / 3)) : t === "Ballast" ? n = 0.7 * o + Math.pow(o, 6.5) / (2.7 * Math.pow(s, 2 / 3)) : n = 0.5 * o + Math.pow(o, 6.5) / (2.7 * Math.pow(s, 2 / 3)), n;
|
|
665
688
|
}
|
|
666
689
|
/**
|
|
667
690
|
* 浪高影响因子
|
|
@@ -670,8 +693,8 @@ class C {
|
|
|
670
693
|
*/
|
|
671
694
|
static waveHeightFactor(s, t) {
|
|
672
695
|
s = s < 0 ? 0.2 : s, s = s > 6 ? s - 0.9 * (s - 6) : s, s = s > 9 ? 9 : s;
|
|
673
|
-
let
|
|
674
|
-
return t > 30 && t <= 60 ?
|
|
696
|
+
let i;
|
|
697
|
+
return t > 30 && t <= 60 ? i = -0.6 : t > 60 && t <= 90 ? i = -0.4 : t > 90 && t <= 120 ? i = s < 3 ? 0.4 : -0.3 : t > 120 && t <= 150 ? i = s < 3 ? 0.6 : -0.5 : t > 150 && t <= 180 ? i = s < 3 ? 0.7 : -0.6 : i = -0.7, Math.round(i * (0.144 * Math.pow(s, 2) + 0.178 * s) * 1e4) / 1e4;
|
|
675
698
|
}
|
|
676
699
|
/**
|
|
677
700
|
* 组装船舶运行参数
|
|
@@ -681,21 +704,21 @@ class C {
|
|
|
681
704
|
* @param bearing 方位角
|
|
682
705
|
* @private
|
|
683
706
|
*/
|
|
684
|
-
static assembleProperties(s, t,
|
|
707
|
+
static assembleProperties(s, t, i, o) {
|
|
685
708
|
var M;
|
|
686
|
-
const
|
|
709
|
+
const n = s.lbp ?? s.length ?? s.lengthOverall ?? 198.9642, a = s.draught ?? 8, e = s.breadthMoulded ?? s.breadth ?? s.breadthExtreme ?? 32.4572, c = s.deadweight ?? 67035.7773, r = ((M = s == null ? void 0 : s.type) == null ? void 0 : M.toLowerCase()) || "common";
|
|
687
710
|
return {
|
|
688
711
|
tag: r.indexOf("container") > -1 ? "container" : r.indexOf("tugs") > -1 ? "tugs" : "common",
|
|
689
|
-
lbp:
|
|
712
|
+
lbp: n,
|
|
690
713
|
loadCondition: t,
|
|
691
714
|
draught: a,
|
|
692
715
|
breadthMoulded: e,
|
|
693
716
|
// 排水量(吨)= 载重量(吨)/ 1.025 + 吃水(米)× 船舶型宽(米)× 船舶型长(米)× 0.7
|
|
694
717
|
// 其中,1.025是指海水的密度,吨是指公吨,吃水是指船舶的最大吃水深度。船舶型宽是指船舶的最大型宽,船舶型长是指船舶的设计型长。上述公式是针对常规船舶适用的,不同类型的船舶可能会有一些差异。
|
|
695
|
-
displacement: Math.round((c / 1.025 + a * e *
|
|
718
|
+
displacement: Math.round((c / 1.025 + a * e * n * 0.7) * 1e4) / 1e4,
|
|
696
719
|
// 换算为m/s
|
|
697
|
-
speed: Math.round((
|
|
698
|
-
bearing:
|
|
720
|
+
speed: Math.round((i ?? 14.1382) * 1852 / 3600 * 1e4) / 1e4,
|
|
721
|
+
bearing: o || 90
|
|
699
722
|
};
|
|
700
723
|
}
|
|
701
724
|
/**
|
|
@@ -708,35 +731,35 @@ class C {
|
|
|
708
731
|
* @param useMeteo true 启用气象分析
|
|
709
732
|
* @param useRouteParam true 启用设置速度
|
|
710
733
|
*/
|
|
711
|
-
static async speedLoseAt(s, t,
|
|
734
|
+
static async speedLoseAt(s, t, i, o = "", n = 2, a = !0, e = !1, c = {}) {
|
|
712
735
|
let r;
|
|
713
736
|
if (t.velocity && e && (s.speed = B.roundPrecision(t.velocity * 1852 / 3600, 6)), a) {
|
|
714
737
|
let d;
|
|
715
738
|
if (c.meteo2)
|
|
716
739
|
try {
|
|
717
|
-
const
|
|
718
|
-
d = tt.toLegacy(
|
|
719
|
-
} catch (
|
|
720
|
-
|
|
740
|
+
const h = await ct.spotForecast(t.lat, t.lng, i.utc().format(), !1, !1, !0, c), [w] = tt.pickHourly(h, i);
|
|
741
|
+
d = tt.toLegacy(w);
|
|
742
|
+
} catch (h) {
|
|
743
|
+
T.warn("[%s] meteo2 spot(%j) forecast failed: %s", c.requestId, { ...t, eta: i.utc().format() }, h);
|
|
721
744
|
}
|
|
722
745
|
else
|
|
723
|
-
d = await nt.queryPointFactor(t.lng, t.lat,
|
|
724
|
-
const f = C.weatherFactor(s, d), M = C.currentFactor(s.bearing, d == null ? void 0 : d.current,
|
|
746
|
+
d = await nt.queryPointFactor(t.lng, t.lat, i.valueOf(), "wind,wave,current,watertemp", o, c);
|
|
747
|
+
const f = C.weatherFactor(s, d), M = C.currentFactor(s.bearing, d == null ? void 0 : d.current, n), m = Math.round((s.speed * 1.943844 + f + M) * 100) / 100;
|
|
725
748
|
r = {
|
|
726
749
|
meteo: { ...d },
|
|
727
750
|
wxFactor: f,
|
|
728
751
|
cFactor: M,
|
|
729
752
|
speed: t.velocity && e ? t.velocity : m < 0 ? 1 : m,
|
|
730
|
-
eta:
|
|
731
|
-
etd:
|
|
753
|
+
eta: i.utc().format("YYYY-MM-DDTHH:mm[Z]"),
|
|
754
|
+
etd: i.utc().format("YYYY-MM-DDTHH:mm[Z]")
|
|
732
755
|
};
|
|
733
756
|
} else
|
|
734
757
|
r = {
|
|
735
758
|
wxFactor: 0,
|
|
736
759
|
cFactor: 0,
|
|
737
760
|
speed: t.velocity && e ? t.velocity : Math.round((s.speed * 1.943844 + 0 + 0) * 100) / 100,
|
|
738
|
-
eta:
|
|
739
|
-
etd:
|
|
761
|
+
eta: i.utc().format("YYYY-MM-DDTHH:mm[Z]"),
|
|
762
|
+
etd: i.utc().format("YYYY-MM-DDTHH:mm[Z]")
|
|
740
763
|
};
|
|
741
764
|
return delete t.meteo, delete t.wxFactor, delete t.cFactor, delete t.speed, delete t.etd, { ...r, ...t };
|
|
742
765
|
}
|
|
@@ -753,53 +776,53 @@ class C {
|
|
|
753
776
|
* @param useRouteParam true 启用航线上设置的参数 { suspend: 停留时长(小时), velocity: 速度(kts)}
|
|
754
777
|
* @private
|
|
755
778
|
*/
|
|
756
|
-
static async speedLoseInHoursStep(s, t, o, n,
|
|
779
|
+
static async speedLoseInHoursStep(s, t, i, o, n, a, e = "", c = !0, r = !1, d = {}) {
|
|
757
780
|
t.utc();
|
|
758
781
|
const f = [], M = [];
|
|
759
|
-
let m = 0,
|
|
782
|
+
let m = 0, h = 0, w, I;
|
|
760
783
|
for (let b = 0; b < a.length - 1; b++) {
|
|
761
784
|
let p = a[b];
|
|
762
|
-
p.distanceFromStart =
|
|
785
|
+
p.distanceFromStart = n + h;
|
|
763
786
|
const l = a[b + 1];
|
|
764
787
|
if (s.bearing = V.calculateBearing(p, l, !l.gcToPrevious), p.bearing = s.bearing, p.suspend && r) {
|
|
765
788
|
p.eta = p.eta || t.format("YYYY-MM-DDTHH:mm[Z]"), p.elapsed = p.elapsed ?? 0;
|
|
766
789
|
const y = p.suspend - p.elapsed;
|
|
767
|
-
if (
|
|
768
|
-
|
|
790
|
+
if (o - m > y)
|
|
791
|
+
o = o - m - y, t.add(y, "hour"), p.elapsed = p.suspend;
|
|
769
792
|
else {
|
|
770
|
-
const g =
|
|
771
|
-
p.elapsed += g, t.add(g, "hour"),
|
|
793
|
+
const g = o - m;
|
|
794
|
+
p.elapsed += g, t.add(g, "hour"), o = 0;
|
|
772
795
|
}
|
|
773
|
-
if (
|
|
774
|
-
return p.distanceFromPrevious =
|
|
796
|
+
if (T == null || T.info(`[%s] suspend ${p.elapsed} hours at %j, and remain ${o} hours need to go...`, d.requestId, p), o === 0)
|
|
797
|
+
return p.distanceFromPrevious = h, { etd: t, from: I || p, to: p, next: a.filter((g) => g), wps: f, days: M };
|
|
775
798
|
} else
|
|
776
799
|
p.suspend = 0;
|
|
777
|
-
p = await C.speedLoseAt(s, p, t, e, 0, c, r, d),
|
|
778
|
-
const
|
|
779
|
-
let
|
|
780
|
-
if (m +
|
|
781
|
-
if (m +=
|
|
782
|
-
`[%s] go to %j from %j with ${
|
|
800
|
+
p = await C.speedLoseAt(s, p, t, e, 0, c, r, d), I = I || p, p.important && f.push(p), t.isSameOrAfter(i) && (M.push(p), i.add(24, "hour"));
|
|
801
|
+
const Y = V.calculateDistance(p, l, !l.gcToPrevious);
|
|
802
|
+
let j = Math.ceil(Y / I.speed * 1e4) / 1e4;
|
|
803
|
+
if (m + j < o) {
|
|
804
|
+
if (m += j, t.add(j, "hour"), delete a[b], T == null || T.info(
|
|
805
|
+
`[%s] go to %j from %j with ${Y}nm, and cost ${j} hours`,
|
|
783
806
|
d.requestId,
|
|
784
807
|
{ lat: l.lat, lng: l.lng },
|
|
785
|
-
{ lat:
|
|
786
|
-
),
|
|
787
|
-
|
|
808
|
+
{ lat: I.lat, lng: I.lng, etd: I.etd }
|
|
809
|
+
), h += Y, a.filter((y) => y).length <= 1) {
|
|
810
|
+
w = l, w.eta = t.format("YYYY-MM-DDTHH:mm[Z]"), w.distanceFromPrevious = Y, w.distanceFromStart = n + h, f.push(w), delete a[b + 1];
|
|
788
811
|
break;
|
|
789
812
|
}
|
|
790
813
|
} else {
|
|
791
|
-
|
|
792
|
-
const y = B.roundPrecision(
|
|
793
|
-
|
|
794
|
-
`[%s] go to %j from %j with ${y}nm, and cost ${
|
|
814
|
+
j = o - m, t.add(j, "hour");
|
|
815
|
+
const y = B.roundPrecision(I.speed * j, 4);
|
|
816
|
+
w = V.calculateCoordinate(p, s.bearing, y, "nauticalmiles", !l.gcToPrevious), w.eta = t.format("YYYY-MM-DDTHH:mm[Z]"), a[b] = w, T == null || T.info(
|
|
817
|
+
`[%s] go to %j from %j with ${y}nm, and cost ${j} hours`,
|
|
795
818
|
d.requestId,
|
|
796
|
-
{ lat:
|
|
819
|
+
{ lat: w.lat, lng: w.lng },
|
|
797
820
|
{ lat: p.lat, lng: p.lng, etd: p.etd }
|
|
798
|
-
),
|
|
821
|
+
), h += y, w.distanceFromPrevious = h, w.distanceFromStart = n + h;
|
|
799
822
|
break;
|
|
800
823
|
}
|
|
801
824
|
}
|
|
802
|
-
return { etd: t, from:
|
|
825
|
+
return { etd: t, from: I, to: w, next: a.filter((b) => b), wps: f, days: M };
|
|
803
826
|
}
|
|
804
827
|
/**
|
|
805
828
|
* 洋流影响因子
|
|
@@ -807,12 +830,12 @@ class C {
|
|
|
807
830
|
* @param current 洋流要素
|
|
808
831
|
* @param role 1: 船东, 2: 租家, 0: 未知
|
|
809
832
|
*/
|
|
810
|
-
static currentFactor(s, t,
|
|
811
|
-
const
|
|
812
|
-
if (Math.abs(
|
|
833
|
+
static currentFactor(s, t, i = 0) {
|
|
834
|
+
const o = (s - (t == null ? void 0 : t.degree) || 0) / 180 * Math.PI;
|
|
835
|
+
if (Math.abs(o) === Math.PI / 2)
|
|
813
836
|
return 0;
|
|
814
|
-
let
|
|
815
|
-
return
|
|
837
|
+
let n = ((t == null ? void 0 : t.kts) || 0) * Math.cos(o);
|
|
838
|
+
return i & 2 ? n = Math.ceil(n * 100) / 100 : i & 1 ? n = Math.floor(n * 100) / 100 : n = Math.round(n * 100) / 100, Math.abs(n) > 5 ? 0 : n;
|
|
816
839
|
}
|
|
817
840
|
/**
|
|
818
841
|
* 风浪影响因子
|
|
@@ -820,16 +843,16 @@ class C {
|
|
|
820
843
|
* @param wwc 气象要素
|
|
821
844
|
*/
|
|
822
845
|
static weatherFactor(s, t) {
|
|
823
|
-
var f, M, m,
|
|
824
|
-
|
|
825
|
-
const
|
|
846
|
+
var f, M, m, h, w, I, b;
|
|
847
|
+
T == null || T.debug("calculate weather factor via: %j", { ...s, ...t });
|
|
848
|
+
const i = C.blockCoefficient(s.displacement, s.lbp, s.breadthMoulded, s.draught), o = C.froudeNumber(s.speed, s.lbp), n = C.amendFactor(i, o, s.loadCondition);
|
|
826
849
|
let a = Math.abs(s.bearing % 360 - (((f = t == null ? void 0 : t.wind) == null ? void 0 : f.degree) % 360 || 0));
|
|
827
850
|
a = a > 180 ? 360 - a : a;
|
|
828
851
|
const e = C.directionFactor(a, (M = t == null ? void 0 : t.wind) == null ? void 0 : M.scale), c = C.vesselTagFactor(s.displacement, s.loadCondition, s.tag, (m = t == null ? void 0 : t.wind) == null ? void 0 : m.scale);
|
|
829
|
-
let r = e *
|
|
830
|
-
r = Math.round(r * 1.943844 * 1e4) / 1e4 * -1, s.tag === "tugs" && Math.abs(r) > 1 && (r = r / (Math.abs(Math.round(r)) + 1)),
|
|
831
|
-
const d = C.waveHeightFactor(((b = (
|
|
832
|
-
return
|
|
852
|
+
let r = e * n * c / 100 * s.speed;
|
|
853
|
+
r = Math.round(r * 1.943844 * 1e4) / 1e4 * -1, s.tag === "tugs" && Math.abs(r) > 1 && (r = r / (Math.abs(Math.round(r)) + 1)), T == null || T.debug("wind wx factor = %d", r), a = Math.abs(s.bearing % 360 - (((w = (h = t == null ? void 0 : t.wave) == null ? void 0 : h.sig) == null ? void 0 : w.degree) % 360 || 0));
|
|
854
|
+
const d = C.waveHeightFactor(((b = (I = t == null ? void 0 : t.wave) == null ? void 0 : I.sig) == null ? void 0 : b.height) ?? 1, a);
|
|
855
|
+
return T == null || T.debug("wave wx factor = %d", d), r = r * 0.4 + d, T == null || T.debug("weather factor = %d", r), r = Math.abs(r) > 4 ? 4 * (Math.abs(r) / r) + Math.abs(r) / r * (Math.abs(r) - 4) * 0.1 : r, Math.round((r || 0) * 100) / 100;
|
|
833
856
|
}
|
|
834
857
|
/**
|
|
835
858
|
* 全程失速分析(走完航程)
|
|
@@ -843,61 +866,61 @@ class C {
|
|
|
843
866
|
* @param useMeteo true 启用气象分析
|
|
844
867
|
* @param useRouteParam
|
|
845
868
|
*/
|
|
846
|
-
static async analyseInstant(s, t, o, n,
|
|
869
|
+
static async analyseInstant(s, t, i, o, n, a = "", e = 0, c = !0, r = !1, d = {}) {
|
|
847
870
|
var E, G, U, J, Q;
|
|
848
871
|
const f = v().valueOf();
|
|
849
872
|
s.lng = B.convertToStdLng(s.lng);
|
|
850
|
-
const { route: M, waypoints: m } =
|
|
851
|
-
if (((E =
|
|
873
|
+
const { route: M, waypoints: m } = n.points, h = V.calculateSubRoute(s, M);
|
|
874
|
+
if (((E = h[0]) == null ? void 0 : E.length) <= 1)
|
|
852
875
|
return;
|
|
853
|
-
const { v0:
|
|
876
|
+
const { v0: w, label: I } = s.sog ? {
|
|
854
877
|
v0: s.sog,
|
|
855
878
|
label: "Other"
|
|
856
879
|
/* Instruct */
|
|
857
880
|
} : {
|
|
858
|
-
v0:
|
|
881
|
+
v0: o.speed,
|
|
859
882
|
label: "CP"
|
|
860
883
|
/* Cp */
|
|
861
|
-
}, b = C.assembleProperties(
|
|
884
|
+
}, b = C.assembleProperties(i, o.loadCondition, w, 0), p = m.length ? V.calculateSubWaypoints(s, m) : [];
|
|
862
885
|
p.forEach((x) => x.important = !0);
|
|
863
886
|
const l = {
|
|
864
887
|
from: { ...s },
|
|
865
|
-
route:
|
|
888
|
+
route: h,
|
|
866
889
|
waypoints: p,
|
|
867
|
-
v0:
|
|
868
|
-
label:
|
|
869
|
-
},
|
|
890
|
+
v0: w,
|
|
891
|
+
label: I
|
|
892
|
+
}, Y = {
|
|
870
893
|
hours: [],
|
|
871
894
|
days: [],
|
|
872
895
|
wps: []
|
|
873
896
|
};
|
|
874
|
-
e || (V.calculateRouteDistance(
|
|
875
|
-
let
|
|
897
|
+
e || (V.calculateRouteDistance(h) / o.speed <= 72 ? e = 3 : e = 6);
|
|
898
|
+
let j = V.simplifyRouteToCoordinates(h, p, 0), y = 0, g = 0, D = 0, F = 0;
|
|
876
899
|
t = v(t).utc();
|
|
877
|
-
const
|
|
878
|
-
for (;
|
|
900
|
+
const R = t.clone();
|
|
901
|
+
for (; j.length > 0; ) {
|
|
879
902
|
const x = e - t.hour() % e, _ = Math.ceil(t.clone().add(x, "h").set({ minute: 0, second: 0, millisecond: 0 }).diff(t, "h", !0) * 1e4) / 1e4, q = await C.speedLoseInHoursStep(
|
|
880
903
|
b,
|
|
881
904
|
t,
|
|
882
|
-
|
|
905
|
+
R,
|
|
883
906
|
_,
|
|
884
907
|
y,
|
|
885
|
-
|
|
908
|
+
j,
|
|
886
909
|
a,
|
|
887
910
|
c,
|
|
888
911
|
r,
|
|
889
912
|
d
|
|
890
913
|
);
|
|
891
|
-
(G = q.from) != null && G.speed && (
|
|
914
|
+
(G = q.from) != null && G.speed && (Y.hours.push(q.from), Y.wps.push(...q.wps), Y.days.push(...q.days)), j = q == null ? void 0 : q.next, j.length || Y.hours.push(q == null ? void 0 : q.to), y += ((U = q == null ? void 0 : q.to) == null ? void 0 : U.distanceFromPrevious) ?? 0;
|
|
892
915
|
}
|
|
893
|
-
const
|
|
894
|
-
for (let x = 0; x <
|
|
895
|
-
const _ = v(
|
|
896
|
-
g += (
|
|
916
|
+
const H = Y.hours;
|
|
917
|
+
for (let x = 0; x < H.length - 1; x++) {
|
|
918
|
+
const _ = v(H[x + 1].eta).diff(H[x].etd, "hour", !0) || 1;
|
|
919
|
+
g += (H[x].wxFactor || 0) * _, D += (H[x].cFactor || 0) * _, F += _;
|
|
897
920
|
}
|
|
898
|
-
(J =
|
|
921
|
+
(J = Y.wps) == null || J.forEach((x, _) => {
|
|
899
922
|
if (_) {
|
|
900
|
-
const q =
|
|
923
|
+
const q = Y.wps[_ - 1], et = x.distanceFromStart - q.distanceFromStart, X = v(x.eta).diff(v(q.etd), "h", !0);
|
|
901
924
|
if (X < 1)
|
|
902
925
|
x.avgSpd = q.speed;
|
|
903
926
|
else {
|
|
@@ -906,11 +929,11 @@ class C {
|
|
|
906
929
|
x.avgSpd = x.avgSpd > $ ? $ : x.avgSpd;
|
|
907
930
|
}
|
|
908
931
|
}
|
|
909
|
-
}), l.sample =
|
|
910
|
-
const L =
|
|
911
|
-
l.distance = Math.round(W.distanceFromStart * 1e4) / 1e4, l.etd = v(L.eta).utc().format(), l.eta = v(W.eta).utc().format(), l.wxFactor = Math.round(g / F * 1e4) / 1e4, l.cFactor = Math.round(
|
|
912
|
-
const P = v().valueOf() - f,
|
|
913
|
-
return
|
|
932
|
+
}), l.sample = Y;
|
|
933
|
+
const L = Y.hours.at(0), W = Y.hours.at(-1);
|
|
934
|
+
l.distance = Math.round(W.distanceFromStart * 1e4) / 1e4, l.etd = v(L.eta).utc().format(), l.eta = v(W.eta).utc().format(), l.wxFactor = Math.round(g / F * 1e4) / 1e4, l.cFactor = Math.round(D / F * 1e4) / 1e4, l.avgSpeed = Math.round(W.distanceFromStart / F * 1e4) / 1e4, l.totalHrs = Math.round(F * 1e4) / 1e4, l.totalFoCons = Math.round((o == null ? void 0 : o.fo) / 24 * l.totalHrs * 1e3) / 1e3, l.totalDgoCons = Math.round((o == null ? void 0 : o.dgo) / 24 * l.totalHrs * 1e3) / 1e3;
|
|
935
|
+
const P = v().valueOf() - f, N = ((Q = Y == null ? void 0 : Y.hours) == null ? void 0 : Q.length) || 1;
|
|
936
|
+
return T == null || T.info("[%s] each hour-sample speed analyse cost: (%d / %d = %d) ms", d == null ? void 0 : d.requestId, P, N, Math.round(P / N * 1e3) / 1e3), l;
|
|
914
937
|
}
|
|
915
938
|
/**
|
|
916
939
|
* 分段失速分析(最多走hours 小时)
|
|
@@ -925,36 +948,36 @@ class C {
|
|
|
925
948
|
* @param useMeteo true 启用气象分析
|
|
926
949
|
* @param useRouteParam
|
|
927
950
|
*/
|
|
928
|
-
static async analyseInstantWithThreshed(s, t, o, n,
|
|
929
|
-
var W,
|
|
951
|
+
static async analyseInstantWithThreshed(s, t, i, o, n, a, e, c = "", r = 3, d = !0, f = !1, M = {}) {
|
|
952
|
+
var W, S, P;
|
|
930
953
|
s.lng = B.convertToStdLng(s.lng);
|
|
931
|
-
const { v0: m, label:
|
|
954
|
+
const { v0: m, label: h } = s.sog ? {
|
|
932
955
|
v0: s.sog,
|
|
933
956
|
label: "Other"
|
|
934
957
|
/* Instruct */
|
|
935
958
|
} : {
|
|
936
|
-
v0:
|
|
959
|
+
v0: n.speed,
|
|
937
960
|
label: "CP"
|
|
938
961
|
/* Cp */
|
|
939
|
-
},
|
|
940
|
-
if (((W =
|
|
962
|
+
}, w = C.assembleProperties(o, n.loadCondition, m, 0), I = V.calculateSubRoute(s, a);
|
|
963
|
+
if (((W = I[0]) == null ? void 0 : W.length) <= 1)
|
|
941
964
|
return;
|
|
942
965
|
const b = e.length ? V.calculateSubWaypoints(s, e) : [];
|
|
943
|
-
b.forEach((
|
|
944
|
-
let p = V.simplifyRouteToCoordinates(
|
|
945
|
-
const
|
|
966
|
+
b.forEach((N) => N.important = !0);
|
|
967
|
+
let p = V.simplifyRouteToCoordinates(I, b, 0), l = 0, Y = 0, j = 0, y = 0, g;
|
|
968
|
+
const D = {
|
|
946
969
|
hours: [],
|
|
947
970
|
wps: [],
|
|
948
971
|
days: []
|
|
949
972
|
};
|
|
950
973
|
for (t = v(t).utc(); p.length > 0; ) {
|
|
951
|
-
const
|
|
952
|
-
let E = Math.ceil(t.clone().add(
|
|
953
|
-
if (E = t.clone().add(E, "h").isAfter(
|
|
974
|
+
const N = r - t.hour() % r;
|
|
975
|
+
let E = Math.ceil(t.clone().add(N, "h").set({ minute: 0, second: 0, millisecond: 0 }).diff(t, "h", !0) * 1e4) / 1e4;
|
|
976
|
+
if (E = t.clone().add(E, "h").isAfter(i) ? i.diff(t, "h", !0) * 1e4 / 1e4 : E, E)
|
|
954
977
|
g = await C.speedLoseInHoursStep(
|
|
955
|
-
|
|
978
|
+
w,
|
|
956
979
|
t,
|
|
957
|
-
|
|
980
|
+
i.clone(),
|
|
958
981
|
E,
|
|
959
982
|
l,
|
|
960
983
|
p,
|
|
@@ -962,34 +985,34 @@ class C {
|
|
|
962
985
|
d,
|
|
963
986
|
f,
|
|
964
987
|
M
|
|
965
|
-
), (
|
|
988
|
+
), (S = g.from) != null && S.speed && (D.hours.push(g.from), g != null && g.wps && D.wps.push(...g.wps), D.days.push(...g.days)), p = g == null ? void 0 : g.next, p.length || (D.hours.push(g == null ? void 0 : g.to), g != null && g.wps && D.wps.push(...g.wps), D.days.push(g == null ? void 0 : g.to)), l += ((P = g == null ? void 0 : g.to) == null ? void 0 : P.distanceFromPrevious) ?? 0;
|
|
966
989
|
else {
|
|
967
|
-
g && (
|
|
990
|
+
g && (D.hours.push(g.to), g != null && g.wps && D.wps.push(...g.wps), D.days.push(g.to));
|
|
968
991
|
break;
|
|
969
992
|
}
|
|
970
993
|
}
|
|
971
|
-
const F =
|
|
972
|
-
for (let
|
|
973
|
-
const E = v(F[
|
|
974
|
-
|
|
994
|
+
const F = D.hours;
|
|
995
|
+
for (let N = 0; N < F.length - 1; N++) {
|
|
996
|
+
const E = v(F[N + 1].eta).diff(F[N].etd, "hour", !0);
|
|
997
|
+
Y += F[N].wxFactor * E, j += F[N].cFactor * E, y += E;
|
|
975
998
|
}
|
|
976
|
-
const
|
|
999
|
+
const R = D.hours.at(0), H = D.hours.at(-1);
|
|
977
1000
|
return {
|
|
978
|
-
sample:
|
|
979
|
-
distance: Math.round(((
|
|
1001
|
+
sample: D,
|
|
1002
|
+
distance: Math.round(((H == null ? void 0 : H.distanceFromStart) || 0) * 1e4) / 1e4,
|
|
980
1003
|
// 注意,可能会在first节点Drift,所有采用eta做为初始出发时间
|
|
981
|
-
etd: v(
|
|
982
|
-
eta: v(
|
|
983
|
-
wxFactor: Math.round(
|
|
984
|
-
cFactor: Math.round(
|
|
985
|
-
avgSpeed: Math.round(((
|
|
1004
|
+
etd: v(R.eta).utc().format(),
|
|
1005
|
+
eta: v(H == null ? void 0 : H.eta).utc().format(),
|
|
1006
|
+
wxFactor: Math.round(Y / y * 1e4) / 1e4,
|
|
1007
|
+
cFactor: Math.round(j / y * 1e4) / 1e4,
|
|
1008
|
+
avgSpeed: Math.round(((H == null ? void 0 : H.distanceFromStart) || 0) / y * 1e4) / 1e4,
|
|
986
1009
|
totalHrs: Math.round(y * 1e4) / 1e4,
|
|
987
1010
|
from: s,
|
|
988
|
-
to:
|
|
989
|
-
route:
|
|
1011
|
+
to: H,
|
|
1012
|
+
route: I,
|
|
990
1013
|
waypoints: b,
|
|
991
1014
|
v0: m,
|
|
992
|
-
label:
|
|
1015
|
+
label: h
|
|
993
1016
|
};
|
|
994
1017
|
}
|
|
995
1018
|
}
|
|
@@ -999,11 +1022,11 @@ export {
|
|
|
999
1022
|
it as AlertLevel,
|
|
1000
1023
|
vt as HifleetImpl,
|
|
1001
1024
|
ut as LoadCondition,
|
|
1002
|
-
|
|
1025
|
+
Yt as MyShipImpl,
|
|
1003
1026
|
bt as MyVesselImpl,
|
|
1004
|
-
|
|
1027
|
+
wt as ShipxyImpl,
|
|
1005
1028
|
C as SpeedHelper,
|
|
1006
1029
|
ht as SpeedLabel,
|
|
1007
1030
|
dt as VesselTag,
|
|
1008
|
-
|
|
1031
|
+
kt as alertHelper
|
|
1009
1032
|
};
|