@idm-plugin/vessel 1.5.4 → 1.5.6
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 +5 -0
- package/dist/index.js +322 -298
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
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 = {
|
|
@@ -241,15 +241,39 @@ class vt extends K {
|
|
|
241
241
|
callSign: a.c,
|
|
242
242
|
length: a.l,
|
|
243
243
|
breadth: a.b,
|
|
244
|
-
draught: a.dr
|
|
244
|
+
draught: a.dr,
|
|
245
|
+
type: a.t
|
|
245
246
|
};
|
|
246
|
-
return
|
|
247
|
+
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;
|
|
248
|
+
}
|
|
249
|
+
async suggest(t, i = {}) {
|
|
250
|
+
const o = "https://www.hifleet.com/hifleetapi/getShipSuggest.do", n = {
|
|
251
|
+
searchParams: {
|
|
252
|
+
q: t
|
|
253
|
+
},
|
|
254
|
+
headers: {
|
|
255
|
+
Referer: "https://www.hifleet.com",
|
|
256
|
+
Origin: "https://www.hifleet.com",
|
|
257
|
+
Host: "www.hifleet.com"
|
|
258
|
+
}
|
|
259
|
+
}, a = await O.post(o, n).json();
|
|
260
|
+
u == null || u.info("[%s] suggest vessel props from: %s - %j", i.requestId, o, n);
|
|
261
|
+
const e = [];
|
|
262
|
+
for (const c of a)
|
|
263
|
+
e.push({
|
|
264
|
+
mmsi: !c.mmsi || isNaN(c.mmsi) ? null : Number(c.mmsi),
|
|
265
|
+
name: c.name,
|
|
266
|
+
callSign: c.callsign,
|
|
267
|
+
imo: !c.imo || isNaN(c.imo) ? null : Number(c.imo),
|
|
268
|
+
score: c._score
|
|
269
|
+
});
|
|
270
|
+
return e.sort((c, r) => r.score - c.score), e;
|
|
247
271
|
}
|
|
248
|
-
async trajectory(t, o, n,
|
|
249
|
-
var l,
|
|
272
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
273
|
+
var l, Y, j;
|
|
250
274
|
const c = await this.realTimePosition(t, e);
|
|
251
|
-
let r = v(
|
|
252
|
-
const d = v(
|
|
275
|
+
let r = v(i);
|
|
276
|
+
const d = v(o), f = v();
|
|
253
277
|
if (a) {
|
|
254
278
|
let y = d.diff(r, "d", !0);
|
|
255
279
|
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 +285,19 @@ class vt extends K {
|
|
|
261
285
|
mmsi: t,
|
|
262
286
|
usertoken: this.token
|
|
263
287
|
}
|
|
264
|
-
}, m = "https://api.hifleet.com/position/trajectory/nocompressed/withstatic/token",
|
|
265
|
-
|
|
266
|
-
let
|
|
267
|
-
|
|
268
|
-
const
|
|
288
|
+
}, m = "https://api.hifleet.com/position/trajectory/nocompressed/withstatic/token", h = await O.get(m, M).json();
|
|
289
|
+
u == null || u.info("[%s] fetch trajectory from: %s - %j", e.requestId, m, M);
|
|
290
|
+
let w;
|
|
291
|
+
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));
|
|
292
|
+
const I = [];
|
|
269
293
|
let b = -1;
|
|
270
|
-
const p = v(`${(
|
|
271
|
-
for (const y of
|
|
294
|
+
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");
|
|
295
|
+
for (const y of w) {
|
|
272
296
|
for (const L in y)
|
|
273
297
|
!isNaN(y[L]) && Number(y[L]) !== 1 / 0 && (y[L] = Number(y[L]));
|
|
274
298
|
const g = v(`${y.ti} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
275
299
|
y.status = y.sp > 4 ? 0 : 1;
|
|
276
|
-
const { labelEn:
|
|
300
|
+
const { labelEn: D, labelCn: F } = this.parseStatus(y.status), R = {
|
|
277
301
|
mmsi: y.m,
|
|
278
302
|
name: y.n,
|
|
279
303
|
imo: c == null ? void 0 : c.imo,
|
|
@@ -287,30 +311,30 @@ class vt extends K {
|
|
|
287
311
|
utc: g.utc().format(),
|
|
288
312
|
status: y.status,
|
|
289
313
|
labelCn: F,
|
|
290
|
-
labelEn:
|
|
314
|
+
labelEn: D,
|
|
291
315
|
method: "trajectory",
|
|
292
316
|
vendor: "hifleet"
|
|
293
|
-
},
|
|
294
|
-
|
|
317
|
+
}, H = Math.floor(g.diff(p, "minute", !0) / (n || 1));
|
|
318
|
+
H !== b && (b = H, I.push(R));
|
|
295
319
|
}
|
|
296
|
-
return
|
|
320
|
+
return I;
|
|
297
321
|
}
|
|
298
322
|
}
|
|
299
|
-
class
|
|
323
|
+
class wt extends K {
|
|
300
324
|
constructor(t) {
|
|
301
325
|
super();
|
|
302
326
|
Z(this, "token");
|
|
303
327
|
this.token = t;
|
|
304
328
|
}
|
|
305
|
-
async realTimePosition(t,
|
|
306
|
-
const
|
|
329
|
+
async realTimePosition(t, i = {}) {
|
|
330
|
+
const o = {
|
|
307
331
|
searchParams: {
|
|
308
332
|
id: t,
|
|
309
333
|
k: this.token,
|
|
310
334
|
enc: 1
|
|
311
335
|
}
|
|
312
|
-
},
|
|
313
|
-
if (
|
|
336
|
+
}, n = "https://api.shipxy.com/apicall/GetSingleShip", a = await O.get(n, o).json();
|
|
337
|
+
if (u == null || u.info("[%s] fetch realtime position from: %s - %j", i.requestId, n, o), (a == null ? void 0 : a.status) !== 0)
|
|
314
338
|
return a;
|
|
315
339
|
const e = a.data[0];
|
|
316
340
|
for (const M in e)
|
|
@@ -339,9 +363,9 @@ class Yt extends K {
|
|
|
339
363
|
vendor: "shipxy"
|
|
340
364
|
};
|
|
341
365
|
}
|
|
342
|
-
async trajectory(t, o, n,
|
|
366
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
343
367
|
var p;
|
|
344
|
-
const c = await this.realTimePosition(t, e), r = v(
|
|
368
|
+
const c = await this.realTimePosition(t, e), r = v(i), d = v(o), f = "https://api.shipxy.com/apicall/GetShipTrack", M = {
|
|
345
369
|
searchParams: {
|
|
346
370
|
id: t,
|
|
347
371
|
k: this.token,
|
|
@@ -350,60 +374,60 @@ class Yt extends K {
|
|
|
350
374
|
btm: r.unix(),
|
|
351
375
|
etm: d.unix()
|
|
352
376
|
}
|
|
353
|
-
}, m = await
|
|
354
|
-
if (
|
|
377
|
+
}, m = await O.get(f, M).json();
|
|
378
|
+
if (u == null || u.info("[%s] fetch trajectory from: %s - %j", e.requestId, f, M), (m == null ? void 0 : m.status) !== 0)
|
|
355
379
|
return m;
|
|
356
|
-
const
|
|
380
|
+
const h = m == null ? void 0 : m.points, w = [], I = v.unix((p = h[0]) == null ? void 0 : p.utc);
|
|
357
381
|
let b = -1;
|
|
358
|
-
for (const l of
|
|
359
|
-
const
|
|
382
|
+
for (const l of h) {
|
|
383
|
+
const Y = v.unix(l.utc), j = {
|
|
360
384
|
imo: c == null ? void 0 : c.imo,
|
|
361
385
|
mmsi: t,
|
|
362
386
|
sog: Math.round(l.sog * 3600 / 1e3 / 1852 * 100) / 100,
|
|
363
387
|
cog: Math.round(l.cog / 100 * 100) / 100,
|
|
364
388
|
lat: Math.round(l.lat / 1e6 * 1e5) / 1e5,
|
|
365
389
|
lng: Math.round(l.lon / 1e6 * 1e5) / 1e5,
|
|
366
|
-
positionTime:
|
|
367
|
-
utc:
|
|
390
|
+
positionTime: Y.unix(),
|
|
391
|
+
utc: Y.utc().format(),
|
|
368
392
|
method: "trajectory",
|
|
369
393
|
vendor: "shipxy"
|
|
370
|
-
}, y = Math.floor(
|
|
371
|
-
y !== b && (b = y,
|
|
394
|
+
}, y = Math.floor(Y.diff(I, "minute", !0) / (n || 1));
|
|
395
|
+
y !== b && (b = y, w.push(j));
|
|
372
396
|
}
|
|
373
|
-
return
|
|
397
|
+
return w;
|
|
374
398
|
}
|
|
375
399
|
}
|
|
376
|
-
class
|
|
400
|
+
class Yt extends K {
|
|
377
401
|
constructor(t) {
|
|
378
402
|
super();
|
|
379
403
|
Z(this, "token");
|
|
380
404
|
this.token = t;
|
|
381
405
|
}
|
|
382
|
-
async getShipId(t,
|
|
383
|
-
const
|
|
406
|
+
async getShipId(t, i = {}) {
|
|
407
|
+
const o = {
|
|
384
408
|
headers: {
|
|
385
409
|
appKey: this.token
|
|
386
410
|
},
|
|
387
411
|
json: {
|
|
388
412
|
mmsiList: t
|
|
389
413
|
}
|
|
390
|
-
},
|
|
391
|
-
return
|
|
414
|
+
}, n = "https://api3.myships.com/sp/ships/getShipIdByMMSI", a = await O.post(n, o).json();
|
|
415
|
+
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
416
|
}
|
|
393
|
-
async getShipInfo(t,
|
|
394
|
-
const
|
|
417
|
+
async getShipInfo(t, i = {}) {
|
|
418
|
+
const o = {
|
|
395
419
|
headers: {
|
|
396
420
|
appKey: this.token
|
|
397
421
|
},
|
|
398
422
|
json: {
|
|
399
423
|
shipId: t
|
|
400
424
|
}
|
|
401
|
-
},
|
|
402
|
-
if (
|
|
425
|
+
}, n = "https://api3.myships.com/sp/ships/aissta", a = await O.post(n, o).json();
|
|
426
|
+
if (u == null || u.info("[%s] fetch ship info from: %s - %j", i.requestId, n, o), a.code !== "0")
|
|
403
427
|
return a;
|
|
404
428
|
const e = a.data;
|
|
405
429
|
let c = e.imo;
|
|
406
|
-
return t === "407170" && (c = "9198379",
|
|
430
|
+
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
431
|
mmsi: e.mmsi,
|
|
408
432
|
name: e.shipnameEn,
|
|
409
433
|
imo: c,
|
|
@@ -413,22 +437,22 @@ class kt extends K {
|
|
|
413
437
|
draught: (e.draught || 100) / 10
|
|
414
438
|
};
|
|
415
439
|
}
|
|
416
|
-
async realTimePosition(t,
|
|
417
|
-
const
|
|
440
|
+
async realTimePosition(t, i = {}) {
|
|
441
|
+
const o = await this.getShipId(t, i), n = await this.getShipInfo(o, i), a = {
|
|
418
442
|
headers: {
|
|
419
443
|
appKey: this.token
|
|
420
444
|
},
|
|
421
445
|
json: {
|
|
422
|
-
shipId:
|
|
446
|
+
shipId: o
|
|
423
447
|
}
|
|
424
|
-
}, e = "https://api3.myships.com/sp/ships/position/latest", c = await
|
|
425
|
-
|
|
448
|
+
}, e = "https://api3.myships.com/sp/ships/position/latest", c = await O.post(e, a).json();
|
|
449
|
+
u == null || u.info("[%s] fetch realtime position from: %s - %j", i.requestId, e, a);
|
|
426
450
|
const r = c.data[0];
|
|
427
|
-
for (const
|
|
428
|
-
!isNaN(r[
|
|
451
|
+
for (const h in r)
|
|
452
|
+
!isNaN(r[h]) && Number(r[h]) !== 1 / 0 && (r[h] = Number(r[h]));
|
|
429
453
|
const { labelCn: d, labelEn: f } = await this.parseStatus(r.aisNavStatus), M = v.unix(r.posTime);
|
|
430
454
|
return {
|
|
431
|
-
...
|
|
455
|
+
...n,
|
|
432
456
|
mmsi: t,
|
|
433
457
|
lat: Math.round(r.lat / 1e4 / 60 * 1e5) / 1e5,
|
|
434
458
|
lng: Math.round(r.lon / 1e4 / 60 * 1e5) / 1e5,
|
|
@@ -445,34 +469,34 @@ class kt extends K {
|
|
|
445
469
|
vendor: "myship"
|
|
446
470
|
};
|
|
447
471
|
}
|
|
448
|
-
async trajectory(t, o, n,
|
|
449
|
-
const c = v(
|
|
472
|
+
async trajectory(t, i, o, n, a = !0, e = {}) {
|
|
473
|
+
const c = v(i), r = v(o), d = await this.getShipId(t), f = await this.getShipInfo(d), M = [];
|
|
450
474
|
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,
|
|
475
|
+
await this.trajectoryIn30Day(d, c.unix(), c.add(30, "day").unix(), f, t, n, M);
|
|
476
|
+
return await this.trajectoryIn30Day(d, c.unix(), r.unix(), f, t, n, M), M;
|
|
453
477
|
}
|
|
454
|
-
async trajectoryIn30Day(t, o, n,
|
|
455
|
-
var
|
|
478
|
+
async trajectoryIn30Day(t, i, o, n, a, e, c, r = {}) {
|
|
479
|
+
var I;
|
|
456
480
|
const d = {
|
|
457
481
|
headers: {
|
|
458
482
|
appKey: this.token
|
|
459
483
|
},
|
|
460
484
|
json: {
|
|
461
485
|
shipId: t,
|
|
462
|
-
startTime:
|
|
463
|
-
endTime:
|
|
486
|
+
startTime: i,
|
|
487
|
+
endTime: o
|
|
464
488
|
}
|
|
465
|
-
}, f = "https://api3.myships.com/sp/ships/position/history", M = await
|
|
466
|
-
if (
|
|
467
|
-
return
|
|
489
|
+
}, f = "https://api3.myships.com/sp/ships/position/history", M = await O.post(f, d).json();
|
|
490
|
+
if (u == null || u.info("[%s] fetch trajectory from: %s - %j", r.requestId, f, d), M.code !== "0")
|
|
491
|
+
return u == null || u.warn("[%s] invoke myship trajectory failed: %j", r.requestId, M), M;
|
|
468
492
|
const m = M.data;
|
|
469
493
|
for (const b in m)
|
|
470
494
|
!isNaN(m[b]) && Number(m[b]) !== 1 / 0 && (m[b] = Number(m[b]));
|
|
471
|
-
const
|
|
472
|
-
let
|
|
495
|
+
const h = v.unix((I = m[0]) == null ? void 0 : I.posTime);
|
|
496
|
+
let w = -1;
|
|
473
497
|
for (const b of m) {
|
|
474
498
|
const p = v.unix(b.posTime), l = {
|
|
475
|
-
imo:
|
|
499
|
+
imo: n == null ? void 0 : n.imo,
|
|
476
500
|
mmsi: a,
|
|
477
501
|
lat: Math.round(b.lat / 1e4 / 60 * 1e5) / 1e5,
|
|
478
502
|
lng: Math.round(b.lon / 1e4 / 60 * 1e5) / 1e5,
|
|
@@ -484,19 +508,19 @@ class kt extends K {
|
|
|
484
508
|
utc: p.utc().format(),
|
|
485
509
|
method: "trajectory",
|
|
486
510
|
vendor: "myship"
|
|
487
|
-
},
|
|
488
|
-
|
|
511
|
+
}, Y = Math.floor(p.diff(h, "minute", !0) / (e || 1));
|
|
512
|
+
Y !== w && (w = Y, c.push(l));
|
|
489
513
|
}
|
|
490
514
|
return c;
|
|
491
515
|
}
|
|
492
516
|
}
|
|
493
|
-
let
|
|
517
|
+
let A;
|
|
494
518
|
try {
|
|
495
|
-
|
|
519
|
+
A = z.getLogger("vessel");
|
|
496
520
|
} catch {
|
|
497
521
|
} finally {
|
|
498
522
|
}
|
|
499
|
-
var it = /* @__PURE__ */ ((
|
|
523
|
+
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
524
|
class rt {
|
|
501
525
|
/**
|
|
502
526
|
* 解析告警规则, 多规则场景
|
|
@@ -508,19 +532,19 @@ class rt {
|
|
|
508
532
|
*/
|
|
509
533
|
parsePrinciple(s, t = {}) {
|
|
510
534
|
var e, c, r;
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
535
|
+
A == null || A.info("[%s] parse rule: %s", t.requestId, s);
|
|
536
|
+
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(";");
|
|
537
|
+
if (!n)
|
|
514
538
|
return;
|
|
515
539
|
const a = {};
|
|
516
|
-
for (let d = 0; d < (
|
|
517
|
-
const f = (r = (c =
|
|
540
|
+
for (let d = 0; d < (n == null ? void 0 : n.length); d++) {
|
|
541
|
+
const f = (r = (c = n[d].match(i)) == null ? void 0 : c[0]) == null ? void 0 : r.split("],");
|
|
518
542
|
if (d === 0 && !f)
|
|
519
|
-
a.scope =
|
|
543
|
+
a.scope = n[0];
|
|
520
544
|
else if (f)
|
|
521
545
|
for (let M = 0, m = f.length; M < m; M++) {
|
|
522
|
-
const
|
|
523
|
-
|
|
546
|
+
const h = this.parseRule(f[M]);
|
|
547
|
+
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
548
|
}
|
|
525
549
|
}
|
|
526
550
|
return a;
|
|
@@ -533,15 +557,15 @@ class rt {
|
|
|
533
557
|
*/
|
|
534
558
|
parseRule(s, t = {}) {
|
|
535
559
|
var a;
|
|
536
|
-
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
560
|
+
A == null || A.info("[%s] parse rule: %s", t.requestId, s), s = s.startsWith("[") ? s : `[${s}`, s = s.endsWith("]") ? s : `${s}]`;
|
|
561
|
+
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(",");
|
|
562
|
+
if (n)
|
|
539
563
|
return {
|
|
540
|
-
operator:
|
|
541
|
-
number: Number.isNaN(Number(
|
|
542
|
-
level:
|
|
543
|
-
time: Number(
|
|
544
|
-
key:
|
|
564
|
+
operator: n[0],
|
|
565
|
+
number: Number.isNaN(Number(n[1])) ? n[1] : Number(n[1]),
|
|
566
|
+
level: n[2],
|
|
567
|
+
time: Number(n[3]),
|
|
568
|
+
key: n[4]
|
|
545
569
|
};
|
|
546
570
|
}
|
|
547
571
|
/**
|
|
@@ -550,26 +574,26 @@ class rt {
|
|
|
550
574
|
* @param principle 告警规则
|
|
551
575
|
* @param options
|
|
552
576
|
*/
|
|
553
|
-
checkWeather(s, t,
|
|
554
|
-
var
|
|
555
|
-
let
|
|
556
|
-
const c = Math.round(((
|
|
577
|
+
checkWeather(s, t, i = {}) {
|
|
578
|
+
var h, w, I, b, p, l, Y, j, y, g, D, F, R, H, L;
|
|
579
|
+
let o = 0, n = 0, a = 0, e = 0;
|
|
580
|
+
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
581
|
for (let W = 0; W < (s == null ? void 0 : s.length); W++) {
|
|
558
|
-
const
|
|
559
|
-
e = E > e ? E : e,
|
|
582
|
+
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;
|
|
583
|
+
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
584
|
}
|
|
561
|
-
return
|
|
585
|
+
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
586
|
}
|
|
563
587
|
}
|
|
564
|
-
const
|
|
565
|
-
let
|
|
588
|
+
const kt = new rt();
|
|
589
|
+
let T;
|
|
566
590
|
try {
|
|
567
|
-
|
|
591
|
+
T = z.getLogger("vessel");
|
|
568
592
|
} catch {
|
|
569
593
|
} finally {
|
|
570
594
|
}
|
|
571
595
|
const ct = new ot("", !0);
|
|
572
|
-
var dt = /* @__PURE__ */ ((
|
|
596
|
+
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
597
|
class C {
|
|
574
598
|
/**
|
|
575
599
|
* @see https://baike.baidu.com/item/%E6%96%B9%E5%BD%A2%E7%B3%BB%E6%95%B0/4965568?fr=aladdin
|
|
@@ -583,10 +607,10 @@ class C {
|
|
|
583
607
|
* @param draught 吃水 m
|
|
584
608
|
* @return [0.55, 0.85]
|
|
585
609
|
*/
|
|
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 -
|
|
610
|
+
static blockCoefficient(s, t, i, o) {
|
|
611
|
+
let n = Math.round(s / (t * i * o) * 100) / 100;
|
|
612
|
+
n = n < 0.55 ? 0.55 : n > 0.85 ? 0.85 : n;
|
|
613
|
+
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
614
|
return a[e.indexOf(Math.min(...e))];
|
|
591
615
|
}
|
|
592
616
|
/**
|
|
@@ -600,9 +624,9 @@ class C {
|
|
|
600
624
|
* @param g 重力加速度 9.80 m/s^2
|
|
601
625
|
* @return [0.05, 0.30]
|
|
602
626
|
*/
|
|
603
|
-
static froudeNumber(s, t,
|
|
604
|
-
let
|
|
605
|
-
return
|
|
627
|
+
static froudeNumber(s, t, i = 9.8) {
|
|
628
|
+
let o = Math.round(Math.sqrt(s * s / (i * t)) * 100) / 100;
|
|
629
|
+
return o = o < 0.05 ? 0.05 : o > 0.3 ? 0.3 : o, o;
|
|
606
630
|
}
|
|
607
631
|
/**
|
|
608
632
|
* 失速修正系數
|
|
@@ -611,8 +635,8 @@ class C {
|
|
|
611
635
|
* @param loadCondition
|
|
612
636
|
* @private
|
|
613
637
|
*/
|
|
614
|
-
static amendFactor(s, t,
|
|
615
|
-
const
|
|
638
|
+
static amendFactor(s, t, i) {
|
|
639
|
+
const o = {
|
|
616
640
|
0.55: [1.7, -1.4, -7.4],
|
|
617
641
|
0.6: [2.2, -2.5, -9.7],
|
|
618
642
|
0.65: [2.6, -3.7, -11.6],
|
|
@@ -630,7 +654,7 @@ class C {
|
|
|
630
654
|
0.8: [3, -16.3, -21.6],
|
|
631
655
|
0.85: [3.4, -20.9, 31.8]
|
|
632
656
|
}[s];
|
|
633
|
-
return
|
|
657
|
+
return i === "Laden" && (a = o[s]), a[0] + a[1] * t + a[2] * Math.pow(t, 2);
|
|
634
658
|
}
|
|
635
659
|
/**
|
|
636
660
|
* 失速方向因子
|
|
@@ -644,8 +668,8 @@ class C {
|
|
|
644
668
|
* @private
|
|
645
669
|
*/
|
|
646
670
|
static directionFactor(s, t = 0) {
|
|
647
|
-
let
|
|
648
|
-
return s > 30 && s <= 60 ?
|
|
671
|
+
let i;
|
|
672
|
+
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
673
|
}
|
|
650
674
|
/**
|
|
651
675
|
* 失速船型因子
|
|
@@ -658,10 +682,10 @@ class C {
|
|
|
658
682
|
* @param bn
|
|
659
683
|
* @private
|
|
660
684
|
*/
|
|
661
|
-
static vesselTagFactor(s, t,
|
|
662
|
-
|
|
663
|
-
let
|
|
664
|
-
return
|
|
685
|
+
static vesselTagFactor(s, t, i, o = 0) {
|
|
686
|
+
o = o > 6 ? o - 0.9 * (o - 6) : o;
|
|
687
|
+
let n;
|
|
688
|
+
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
689
|
}
|
|
666
690
|
/**
|
|
667
691
|
* 浪高影响因子
|
|
@@ -670,8 +694,8 @@ class C {
|
|
|
670
694
|
*/
|
|
671
695
|
static waveHeightFactor(s, t) {
|
|
672
696
|
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 ?
|
|
697
|
+
let i;
|
|
698
|
+
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
699
|
}
|
|
676
700
|
/**
|
|
677
701
|
* 组装船舶运行参数
|
|
@@ -681,21 +705,21 @@ class C {
|
|
|
681
705
|
* @param bearing 方位角
|
|
682
706
|
* @private
|
|
683
707
|
*/
|
|
684
|
-
static assembleProperties(s, t,
|
|
708
|
+
static assembleProperties(s, t, i, o) {
|
|
685
709
|
var M;
|
|
686
|
-
const
|
|
710
|
+
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
711
|
return {
|
|
688
712
|
tag: r.indexOf("container") > -1 ? "container" : r.indexOf("tugs") > -1 ? "tugs" : "common",
|
|
689
|
-
lbp:
|
|
713
|
+
lbp: n,
|
|
690
714
|
loadCondition: t,
|
|
691
715
|
draught: a,
|
|
692
716
|
breadthMoulded: e,
|
|
693
717
|
// 排水量(吨)= 载重量(吨)/ 1.025 + 吃水(米)× 船舶型宽(米)× 船舶型长(米)× 0.7
|
|
694
718
|
// 其中,1.025是指海水的密度,吨是指公吨,吃水是指船舶的最大吃水深度。船舶型宽是指船舶的最大型宽,船舶型长是指船舶的设计型长。上述公式是针对常规船舶适用的,不同类型的船舶可能会有一些差异。
|
|
695
|
-
displacement: Math.round((c / 1.025 + a * e *
|
|
719
|
+
displacement: Math.round((c / 1.025 + a * e * n * 0.7) * 1e4) / 1e4,
|
|
696
720
|
// 换算为m/s
|
|
697
|
-
speed: Math.round((
|
|
698
|
-
bearing:
|
|
721
|
+
speed: Math.round((i ?? 14.1382) * 1852 / 3600 * 1e4) / 1e4,
|
|
722
|
+
bearing: o || 90
|
|
699
723
|
};
|
|
700
724
|
}
|
|
701
725
|
/**
|
|
@@ -708,35 +732,35 @@ class C {
|
|
|
708
732
|
* @param useMeteo true 启用气象分析
|
|
709
733
|
* @param useRouteParam true 启用设置速度
|
|
710
734
|
*/
|
|
711
|
-
static async speedLoseAt(s, t,
|
|
735
|
+
static async speedLoseAt(s, t, i, o = "", n = 2, a = !0, e = !1, c = {}) {
|
|
712
736
|
let r;
|
|
713
737
|
if (t.velocity && e && (s.speed = B.roundPrecision(t.velocity * 1852 / 3600, 6)), a) {
|
|
714
738
|
let d;
|
|
715
739
|
if (c.meteo2)
|
|
716
740
|
try {
|
|
717
|
-
const
|
|
718
|
-
d = tt.toLegacy(
|
|
719
|
-
} catch (
|
|
720
|
-
|
|
741
|
+
const h = await ct.spotForecast(t.lat, t.lng, i.utc().format(), !1, !1, !0, c), [w] = tt.pickHourly(h, i);
|
|
742
|
+
d = tt.toLegacy(w);
|
|
743
|
+
} catch (h) {
|
|
744
|
+
T.warn("[%s] meteo2 spot(%j) forecast failed: %s", c.requestId, { ...t, eta: i.utc().format() }, h);
|
|
721
745
|
}
|
|
722
746
|
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,
|
|
747
|
+
d = await nt.queryPointFactor(t.lng, t.lat, i.valueOf(), "wind,wave,current,watertemp", o, c);
|
|
748
|
+
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
749
|
r = {
|
|
726
750
|
meteo: { ...d },
|
|
727
751
|
wxFactor: f,
|
|
728
752
|
cFactor: M,
|
|
729
753
|
speed: t.velocity && e ? t.velocity : m < 0 ? 1 : m,
|
|
730
|
-
eta:
|
|
731
|
-
etd:
|
|
754
|
+
eta: i.utc().format("YYYY-MM-DDTHH:mm[Z]"),
|
|
755
|
+
etd: i.utc().format("YYYY-MM-DDTHH:mm[Z]")
|
|
732
756
|
};
|
|
733
757
|
} else
|
|
734
758
|
r = {
|
|
735
759
|
wxFactor: 0,
|
|
736
760
|
cFactor: 0,
|
|
737
761
|
speed: t.velocity && e ? t.velocity : Math.round((s.speed * 1.943844 + 0 + 0) * 100) / 100,
|
|
738
|
-
eta:
|
|
739
|
-
etd:
|
|
762
|
+
eta: i.utc().format("YYYY-MM-DDTHH:mm[Z]"),
|
|
763
|
+
etd: i.utc().format("YYYY-MM-DDTHH:mm[Z]")
|
|
740
764
|
};
|
|
741
765
|
return delete t.meteo, delete t.wxFactor, delete t.cFactor, delete t.speed, delete t.etd, { ...r, ...t };
|
|
742
766
|
}
|
|
@@ -753,53 +777,53 @@ class C {
|
|
|
753
777
|
* @param useRouteParam true 启用航线上设置的参数 { suspend: 停留时长(小时), velocity: 速度(kts)}
|
|
754
778
|
* @private
|
|
755
779
|
*/
|
|
756
|
-
static async speedLoseInHoursStep(s, t, o, n,
|
|
780
|
+
static async speedLoseInHoursStep(s, t, i, o, n, a, e = "", c = !0, r = !1, d = {}) {
|
|
757
781
|
t.utc();
|
|
758
782
|
const f = [], M = [];
|
|
759
|
-
let m = 0,
|
|
783
|
+
let m = 0, h = 0, w, I;
|
|
760
784
|
for (let b = 0; b < a.length - 1; b++) {
|
|
761
785
|
let p = a[b];
|
|
762
|
-
p.distanceFromStart =
|
|
786
|
+
p.distanceFromStart = n + h;
|
|
763
787
|
const l = a[b + 1];
|
|
764
788
|
if (s.bearing = V.calculateBearing(p, l, !l.gcToPrevious), p.bearing = s.bearing, p.suspend && r) {
|
|
765
789
|
p.eta = p.eta || t.format("YYYY-MM-DDTHH:mm[Z]"), p.elapsed = p.elapsed ?? 0;
|
|
766
790
|
const y = p.suspend - p.elapsed;
|
|
767
|
-
if (
|
|
768
|
-
|
|
791
|
+
if (o - m > y)
|
|
792
|
+
o = o - m - y, t.add(y, "hour"), p.elapsed = p.suspend;
|
|
769
793
|
else {
|
|
770
|
-
const g =
|
|
771
|
-
p.elapsed += g, t.add(g, "hour"),
|
|
794
|
+
const g = o - m;
|
|
795
|
+
p.elapsed += g, t.add(g, "hour"), o = 0;
|
|
772
796
|
}
|
|
773
|
-
if (
|
|
774
|
-
return p.distanceFromPrevious =
|
|
797
|
+
if (T == null || T.info(`[%s] suspend ${p.elapsed} hours at %j, and remain ${o} hours need to go...`, d.requestId, p), o === 0)
|
|
798
|
+
return p.distanceFromPrevious = h, { etd: t, from: I || p, to: p, next: a.filter((g) => g), wps: f, days: M };
|
|
775
799
|
} else
|
|
776
800
|
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 ${
|
|
801
|
+
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"));
|
|
802
|
+
const Y = V.calculateDistance(p, l, !l.gcToPrevious);
|
|
803
|
+
let j = Math.ceil(Y / I.speed * 1e4) / 1e4;
|
|
804
|
+
if (m + j < o) {
|
|
805
|
+
if (m += j, t.add(j, "hour"), delete a[b], T == null || T.info(
|
|
806
|
+
`[%s] go to %j from %j with ${Y}nm, and cost ${j} hours`,
|
|
783
807
|
d.requestId,
|
|
784
808
|
{ lat: l.lat, lng: l.lng },
|
|
785
|
-
{ lat:
|
|
786
|
-
),
|
|
787
|
-
|
|
809
|
+
{ lat: I.lat, lng: I.lng, etd: I.etd }
|
|
810
|
+
), h += Y, a.filter((y) => y).length <= 1) {
|
|
811
|
+
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
812
|
break;
|
|
789
813
|
}
|
|
790
814
|
} else {
|
|
791
|
-
|
|
792
|
-
const y = B.roundPrecision(
|
|
793
|
-
|
|
794
|
-
`[%s] go to %j from %j with ${y}nm, and cost ${
|
|
815
|
+
j = o - m, t.add(j, "hour");
|
|
816
|
+
const y = B.roundPrecision(I.speed * j, 4);
|
|
817
|
+
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(
|
|
818
|
+
`[%s] go to %j from %j with ${y}nm, and cost ${j} hours`,
|
|
795
819
|
d.requestId,
|
|
796
|
-
{ lat:
|
|
820
|
+
{ lat: w.lat, lng: w.lng },
|
|
797
821
|
{ lat: p.lat, lng: p.lng, etd: p.etd }
|
|
798
|
-
),
|
|
822
|
+
), h += y, w.distanceFromPrevious = h, w.distanceFromStart = n + h;
|
|
799
823
|
break;
|
|
800
824
|
}
|
|
801
825
|
}
|
|
802
|
-
return { etd: t, from:
|
|
826
|
+
return { etd: t, from: I, to: w, next: a.filter((b) => b), wps: f, days: M };
|
|
803
827
|
}
|
|
804
828
|
/**
|
|
805
829
|
* 洋流影响因子
|
|
@@ -807,12 +831,12 @@ class C {
|
|
|
807
831
|
* @param current 洋流要素
|
|
808
832
|
* @param role 1: 船东, 2: 租家, 0: 未知
|
|
809
833
|
*/
|
|
810
|
-
static currentFactor(s, t,
|
|
811
|
-
const
|
|
812
|
-
if (Math.abs(
|
|
834
|
+
static currentFactor(s, t, i = 0) {
|
|
835
|
+
const o = (s - (t == null ? void 0 : t.degree) || 0) / 180 * Math.PI;
|
|
836
|
+
if (Math.abs(o) === Math.PI / 2)
|
|
813
837
|
return 0;
|
|
814
|
-
let
|
|
815
|
-
return
|
|
838
|
+
let n = ((t == null ? void 0 : t.kts) || 0) * Math.cos(o);
|
|
839
|
+
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
840
|
}
|
|
817
841
|
/**
|
|
818
842
|
* 风浪影响因子
|
|
@@ -820,16 +844,16 @@ class C {
|
|
|
820
844
|
* @param wwc 气象要素
|
|
821
845
|
*/
|
|
822
846
|
static weatherFactor(s, t) {
|
|
823
|
-
var f, M, m,
|
|
824
|
-
|
|
825
|
-
const
|
|
847
|
+
var f, M, m, h, w, I, b;
|
|
848
|
+
T == null || T.debug("calculate weather factor via: %j", { ...s, ...t });
|
|
849
|
+
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
850
|
let a = Math.abs(s.bearing % 360 - (((f = t == null ? void 0 : t.wind) == null ? void 0 : f.degree) % 360 || 0));
|
|
827
851
|
a = a > 180 ? 360 - a : a;
|
|
828
852
|
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
|
|
853
|
+
let r = e * n * c / 100 * s.speed;
|
|
854
|
+
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));
|
|
855
|
+
const d = C.waveHeightFactor(((b = (I = t == null ? void 0 : t.wave) == null ? void 0 : I.sig) == null ? void 0 : b.height) ?? 1, a);
|
|
856
|
+
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
857
|
}
|
|
834
858
|
/**
|
|
835
859
|
* 全程失速分析(走完航程)
|
|
@@ -843,61 +867,61 @@ class C {
|
|
|
843
867
|
* @param useMeteo true 启用气象分析
|
|
844
868
|
* @param useRouteParam
|
|
845
869
|
*/
|
|
846
|
-
static async analyseInstant(s, t, o, n,
|
|
870
|
+
static async analyseInstant(s, t, i, o, n, a = "", e = 0, c = !0, r = !1, d = {}) {
|
|
847
871
|
var E, G, U, J, Q;
|
|
848
872
|
const f = v().valueOf();
|
|
849
873
|
s.lng = B.convertToStdLng(s.lng);
|
|
850
|
-
const { route: M, waypoints: m } =
|
|
851
|
-
if (((E =
|
|
874
|
+
const { route: M, waypoints: m } = n.points, h = V.calculateSubRoute(s, M);
|
|
875
|
+
if (((E = h[0]) == null ? void 0 : E.length) <= 1)
|
|
852
876
|
return;
|
|
853
|
-
const { v0:
|
|
877
|
+
const { v0: w, label: I } = s.sog ? {
|
|
854
878
|
v0: s.sog,
|
|
855
879
|
label: "Other"
|
|
856
880
|
/* Instruct */
|
|
857
881
|
} : {
|
|
858
|
-
v0:
|
|
882
|
+
v0: o.speed,
|
|
859
883
|
label: "CP"
|
|
860
884
|
/* Cp */
|
|
861
|
-
}, b = C.assembleProperties(
|
|
885
|
+
}, b = C.assembleProperties(i, o.loadCondition, w, 0), p = m.length ? V.calculateSubWaypoints(s, m) : [];
|
|
862
886
|
p.forEach((x) => x.important = !0);
|
|
863
887
|
const l = {
|
|
864
888
|
from: { ...s },
|
|
865
|
-
route:
|
|
889
|
+
route: h,
|
|
866
890
|
waypoints: p,
|
|
867
|
-
v0:
|
|
868
|
-
label:
|
|
869
|
-
},
|
|
891
|
+
v0: w,
|
|
892
|
+
label: I
|
|
893
|
+
}, Y = {
|
|
870
894
|
hours: [],
|
|
871
895
|
days: [],
|
|
872
896
|
wps: []
|
|
873
897
|
};
|
|
874
|
-
e || (V.calculateRouteDistance(
|
|
875
|
-
let
|
|
898
|
+
e || (V.calculateRouteDistance(h) / o.speed <= 72 ? e = 3 : e = 6);
|
|
899
|
+
let j = V.simplifyRouteToCoordinates(h, p, 0), y = 0, g = 0, D = 0, F = 0;
|
|
876
900
|
t = v(t).utc();
|
|
877
|
-
const
|
|
878
|
-
for (;
|
|
901
|
+
const R = t.clone();
|
|
902
|
+
for (; j.length > 0; ) {
|
|
879
903
|
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
904
|
b,
|
|
881
905
|
t,
|
|
882
|
-
|
|
906
|
+
R,
|
|
883
907
|
_,
|
|
884
908
|
y,
|
|
885
|
-
|
|
909
|
+
j,
|
|
886
910
|
a,
|
|
887
911
|
c,
|
|
888
912
|
r,
|
|
889
913
|
d
|
|
890
914
|
);
|
|
891
|
-
(G = q.from) != null && G.speed && (
|
|
915
|
+
(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
916
|
}
|
|
893
|
-
const
|
|
894
|
-
for (let x = 0; x <
|
|
895
|
-
const _ = v(
|
|
896
|
-
g += (
|
|
917
|
+
const H = Y.hours;
|
|
918
|
+
for (let x = 0; x < H.length - 1; x++) {
|
|
919
|
+
const _ = v(H[x + 1].eta).diff(H[x].etd, "hour", !0) || 1;
|
|
920
|
+
g += (H[x].wxFactor || 0) * _, D += (H[x].cFactor || 0) * _, F += _;
|
|
897
921
|
}
|
|
898
|
-
(J =
|
|
922
|
+
(J = Y.wps) == null || J.forEach((x, _) => {
|
|
899
923
|
if (_) {
|
|
900
|
-
const q =
|
|
924
|
+
const q = Y.wps[_ - 1], et = x.distanceFromStart - q.distanceFromStart, X = v(x.eta).diff(v(q.etd), "h", !0);
|
|
901
925
|
if (X < 1)
|
|
902
926
|
x.avgSpd = q.speed;
|
|
903
927
|
else {
|
|
@@ -906,11 +930,11 @@ class C {
|
|
|
906
930
|
x.avgSpd = x.avgSpd > $ ? $ : x.avgSpd;
|
|
907
931
|
}
|
|
908
932
|
}
|
|
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
|
|
933
|
+
}), l.sample = Y;
|
|
934
|
+
const L = Y.hours.at(0), W = Y.hours.at(-1);
|
|
935
|
+
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;
|
|
936
|
+
const P = v().valueOf() - f, N = ((Q = Y == null ? void 0 : Y.hours) == null ? void 0 : Q.length) || 1;
|
|
937
|
+
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
938
|
}
|
|
915
939
|
/**
|
|
916
940
|
* 分段失速分析(最多走hours 小时)
|
|
@@ -925,36 +949,36 @@ class C {
|
|
|
925
949
|
* @param useMeteo true 启用气象分析
|
|
926
950
|
* @param useRouteParam
|
|
927
951
|
*/
|
|
928
|
-
static async analyseInstantWithThreshed(s, t, o, n,
|
|
929
|
-
var W,
|
|
952
|
+
static async analyseInstantWithThreshed(s, t, i, o, n, a, e, c = "", r = 3, d = !0, f = !1, M = {}) {
|
|
953
|
+
var W, S, P;
|
|
930
954
|
s.lng = B.convertToStdLng(s.lng);
|
|
931
|
-
const { v0: m, label:
|
|
955
|
+
const { v0: m, label: h } = s.sog ? {
|
|
932
956
|
v0: s.sog,
|
|
933
957
|
label: "Other"
|
|
934
958
|
/* Instruct */
|
|
935
959
|
} : {
|
|
936
|
-
v0:
|
|
960
|
+
v0: n.speed,
|
|
937
961
|
label: "CP"
|
|
938
962
|
/* Cp */
|
|
939
|
-
},
|
|
940
|
-
if (((W =
|
|
963
|
+
}, w = C.assembleProperties(o, n.loadCondition, m, 0), I = V.calculateSubRoute(s, a);
|
|
964
|
+
if (((W = I[0]) == null ? void 0 : W.length) <= 1)
|
|
941
965
|
return;
|
|
942
966
|
const b = e.length ? V.calculateSubWaypoints(s, e) : [];
|
|
943
|
-
b.forEach((
|
|
944
|
-
let p = V.simplifyRouteToCoordinates(
|
|
945
|
-
const
|
|
967
|
+
b.forEach((N) => N.important = !0);
|
|
968
|
+
let p = V.simplifyRouteToCoordinates(I, b, 0), l = 0, Y = 0, j = 0, y = 0, g;
|
|
969
|
+
const D = {
|
|
946
970
|
hours: [],
|
|
947
971
|
wps: [],
|
|
948
972
|
days: []
|
|
949
973
|
};
|
|
950
974
|
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(
|
|
975
|
+
const N = r - t.hour() % r;
|
|
976
|
+
let E = Math.ceil(t.clone().add(N, "h").set({ minute: 0, second: 0, millisecond: 0 }).diff(t, "h", !0) * 1e4) / 1e4;
|
|
977
|
+
if (E = t.clone().add(E, "h").isAfter(i) ? i.diff(t, "h", !0) * 1e4 / 1e4 : E, E)
|
|
954
978
|
g = await C.speedLoseInHoursStep(
|
|
955
|
-
|
|
979
|
+
w,
|
|
956
980
|
t,
|
|
957
|
-
|
|
981
|
+
i.clone(),
|
|
958
982
|
E,
|
|
959
983
|
l,
|
|
960
984
|
p,
|
|
@@ -962,34 +986,34 @@ class C {
|
|
|
962
986
|
d,
|
|
963
987
|
f,
|
|
964
988
|
M
|
|
965
|
-
), (
|
|
989
|
+
), (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
990
|
else {
|
|
967
|
-
g && (
|
|
991
|
+
g && (D.hours.push(g.to), g != null && g.wps && D.wps.push(...g.wps), D.days.push(g.to));
|
|
968
992
|
break;
|
|
969
993
|
}
|
|
970
994
|
}
|
|
971
|
-
const F =
|
|
972
|
-
for (let
|
|
973
|
-
const E = v(F[
|
|
974
|
-
|
|
995
|
+
const F = D.hours;
|
|
996
|
+
for (let N = 0; N < F.length - 1; N++) {
|
|
997
|
+
const E = v(F[N + 1].eta).diff(F[N].etd, "hour", !0);
|
|
998
|
+
Y += F[N].wxFactor * E, j += F[N].cFactor * E, y += E;
|
|
975
999
|
}
|
|
976
|
-
const
|
|
1000
|
+
const R = D.hours.at(0), H = D.hours.at(-1);
|
|
977
1001
|
return {
|
|
978
|
-
sample:
|
|
979
|
-
distance: Math.round(((
|
|
1002
|
+
sample: D,
|
|
1003
|
+
distance: Math.round(((H == null ? void 0 : H.distanceFromStart) || 0) * 1e4) / 1e4,
|
|
980
1004
|
// 注意,可能会在first节点Drift,所有采用eta做为初始出发时间
|
|
981
|
-
etd: v(
|
|
982
|
-
eta: v(
|
|
983
|
-
wxFactor: Math.round(
|
|
984
|
-
cFactor: Math.round(
|
|
985
|
-
avgSpeed: Math.round(((
|
|
1005
|
+
etd: v(R.eta).utc().format(),
|
|
1006
|
+
eta: v(H == null ? void 0 : H.eta).utc().format(),
|
|
1007
|
+
wxFactor: Math.round(Y / y * 1e4) / 1e4,
|
|
1008
|
+
cFactor: Math.round(j / y * 1e4) / 1e4,
|
|
1009
|
+
avgSpeed: Math.round(((H == null ? void 0 : H.distanceFromStart) || 0) / y * 1e4) / 1e4,
|
|
986
1010
|
totalHrs: Math.round(y * 1e4) / 1e4,
|
|
987
1011
|
from: s,
|
|
988
|
-
to:
|
|
989
|
-
route:
|
|
1012
|
+
to: H,
|
|
1013
|
+
route: I,
|
|
990
1014
|
waypoints: b,
|
|
991
1015
|
v0: m,
|
|
992
|
-
label:
|
|
1016
|
+
label: h
|
|
993
1017
|
};
|
|
994
1018
|
}
|
|
995
1019
|
}
|
|
@@ -999,11 +1023,11 @@ export {
|
|
|
999
1023
|
it as AlertLevel,
|
|
1000
1024
|
vt as HifleetImpl,
|
|
1001
1025
|
ut as LoadCondition,
|
|
1002
|
-
|
|
1026
|
+
Yt as MyShipImpl,
|
|
1003
1027
|
bt as MyVesselImpl,
|
|
1004
|
-
|
|
1028
|
+
wt as ShipxyImpl,
|
|
1005
1029
|
C as SpeedHelper,
|
|
1006
1030
|
ht as SpeedLabel,
|
|
1007
1031
|
dt as VesselTag,
|
|
1008
|
-
|
|
1032
|
+
kt as alertHelper
|
|
1009
1033
|
};
|