import { Current, Meteo } from '@idm-plugin/meteo2';
import moment from 'moment';
/**
 * 船舶标签，不同标签适用不同分析模型
 */
export declare enum VesselTag {
    common = "common",
    container = "container",
    tugs = "tugs"
}
/**
 * 船舶加载状态，laden/ ballast
 */
export declare enum LoadCondition {
    Ballast = "Ballast",
    Laden = "Laden"
}
/**
 * 速度标签
 */
export declare enum SpeedLabel {
    Cp = "CP",
    Perf = "Basis",
    Instruct = "Other"
}
/**
 * 船舶基础档案
 */
export interface VesselAssemble {
    imo?: number;
    lbp?: number;
    length?: number | null;
    lengthOverall?: number | null;
    draught?: number | null;
    breadthMoulded?: number | null;
    breadth?: number | null;
    breadthExtreme?: number | null;
    type?: string | null;
    deadweight: number;
}
/**
 * 船舶运行参数，用于分析船舶失速、油耗、性能、碳排等
 */
export interface VesselProperties {
    tag: VesselTag;
    loadCondition: LoadCondition | string;
    draught: number;
    displacement: number;
    breadthMoulded: number;
    lbp: number;
    speed: number;
    bearing: number;
}
/**
 * 成本参数
 */
export interface CostProps {
    addComm?: number;
    dailyHire?: number;
    priceFO?: number;
    priceDGO?: number;
}
/**
 * 速度计算参数
 */
export interface SpeedProps extends CostProps {
    usePerfSpeed?: boolean;
    useRouteParam?: boolean;
    useMeteo?: boolean;
    alterStep?: number;
    lat?: number;
    lng?: number;
    etd?: string;
    speedStep?: number;
    forecastDay?: number;
    meteoVendor?: string;
}
/**
 * Cp参数
 */
export interface CpProps {
    loadCondition: string | LoadCondition;
    speed: number;
    fo: number;
    dgo: number;
}
export declare class SpeedHelper {
    /**
     * @see https://baike.baidu.com/item/%E6%96%B9%E5%BD%A2%E7%B3%BB%E6%95%B0/4965568?fr=aladdin
     * 方形系数（block coefficient）
     * 是指与基平面相平行的任一水线面以下的船型排水体积与对应的船长、型宽
     * 和平均吃水的乘积所表示的长方体体积之比
     * 方块系数介于 0.55 - 0.85
     * @param displacement 排水 m^3
     * @param length 水线长 m
     * @param breadth 水线宽 m
     * @param draught 吃水 m
     * @return [0.55, 0.85]
     */
    private static blockCoefficient;
    /**
     * @see https://baike.baidu.com/item/%E5%BC%97%E5%8A%B3%E5%BE%B7%E6%95%B0/228891?fromModule=search-result_lemma-recommend
     * 弗劳德数 (froude number)
     * 流体力学中表征流体惯性力和重力相对大小的一个无量纲参数，记为Fr。它表示惯性力和重力量级的比，即：Fr=sqrt（U²/（gL）） [6]  ，
     * 式中U为物体运动速度，g为重力加速度；L为物体的特征长度
     * 佛勞德數介乎 0.05 - 0.30
     * @param speed 速度 m/s
     * @param length 船长 m
     * @param g 重力加速度 9.80 m/s^2
     * @return [0.05, 0.30]
     */
    private static froudeNumber;
    /**
     * 失速修正系數
     * @param bc 方形系数 [0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85]
     * @param fr 弗劳德数 [0.05 - 0.30]
     * @param loadCondition
     * @private
     */
    private static amendFactor;
    /**
     * 失速方向因子
     * 頂浪(不規則 波)、頂風 (0°):   2 * 𝐶𝜇 = 2
     * 艏斜浪(不規 則波)、前迎風 (30°~60°):  2 𝐶𝜇 = 1.7 −0.03(Bn − 4)^2
     * 橫浪(不規則 波)、橫風 (60°~150°): 2 𝐶𝜇 = 0.9 −0.06(Bn − 6)^2
     * 順浪(不規則 波)、順風 (150°~180°): 2 𝐶𝜇 = 0.4 −0.03(Bn− 8)^2
     *
     * @param beta 航向与风浪的夹角
     * @param bn
     * @private
     */
    private static directionFactor;
    /**
     * 失速船型因子
     * 集装箱(普通裝載狀態): 0.7Bn + Bn^6.5/(22 * ∇^(2/3))
     * 散货等(满载): 0.5Bn + Bn^6.5 2 /(2.7 * ∇^(2/3))
     * 散货等(压载): 0.7Bn + Bn^6.5 2 /(2.7 * ∇^(2/3))
     * @param displacement 排水量，m^3
     * @param loadCondition
     * @param tag
     * // @param bn
     * @param kts
     * @private
     */
    private static vesselTagFactor;
    /**
     * 浪高影响因子
     * @param ht 浪高，单位m
     * @param beta 夹角
     * @param draught 吃水
     * @param options
     * @private
     */
    private static waveHeightFactor;
    /**
     * 组装船舶运行参数
     * @param vessel 船舶基础档案
     * @param loadCondition 装载状态
     * @param speed 速度，kts
     * @param bearing 方位角
     * @private
     */
    static assembleProperties(vessel: VesselAssemble, loadCondition: LoadCondition | string, speed: number, bearing: number): VesselProperties;
    /**
     * 船舶特定时间的瞬时失速样本
     * @param props 船舶属性
     * @param coordinate {lat: 纬度, lng: 经度, velocity: 速度(kts, 可选，指定速度) }
     * @param eta 位置时间
     * @param source
     * @param role 1: 船东, 2: 租家, 0: 未知
     * @param useMeteo true 启用气象分析
     * @param useRouteParam true 启用设置速度
     * @param options
     */
    static speedLoseAt(props: VesselProperties, coordinate: any, eta: moment.Moment, source?: string, role?: number, useMeteo?: boolean, useRouteParam?: boolean, options?: {
        requestId?: string;
        selfHosted?: boolean;
        minV0Factor?: number;
        maxV0Factor?: number;
    }): Promise<any>;
    /**
     * 基于步长计算失速样本
     * @param props 船舶属性（失速模型依赖）
     * @param etd 出发时间
     * @param etd4Day 前行过程中动态计算加24小时的天(etd + 24 * n)
     * @param hours 前行的步长（小时）
     * @param distanceFromStart 与最开始起点的距离
     * @param keypoints 剩下的航路点
     * @param source 气象数据源: CMEMS / GFS
     * @param useMeteo true 启用气象分析
     * @param useRouteParam true 启用航线上设置的参数 { suspend: 停留时长（小时）, velocity: 速度（kts）}
     * @param options
     * @private
     */
    private static speedLoseInHoursStep;
    /**
     * 洋流影响因子
     * @param bearing 船舶航行方位角
     * @param current 洋流要素
     * @param role  1: 船东, 2: 租家, 0: 未知
     * @param options
     */
    static currentFactor(bearing: number, current: Current, role?: number, options?: {
        requestId?: string;
    }): number;
    /**
     * 风浪影响因子
     * @param props 船舶档案
     * @param wwc 气象要素
     * @param cFactor 洋流因子
     * @param options
     */
    static weatherFactor(props: VesselProperties, wwc: Meteo, cFactor?: number, options?: {
        requestId?: string;
    }): number;
    /**
     * 以12小时级别去掉重复的days
     * @param days
     * @param interval 12 hours
     */
    static reduceDays(days: any[], interval?: number): Promise<any[]>;
    /**
     * 以分钟级别去掉重复的wps
     * @param wps
     * @param interval 1 minute
     */
    static reduceWPS(wps: any[], interval?: number): Promise<any[]>;
    /**
     * 全程失速分析(走完航程)
     * @param from 起点 {lng, lat}
     * @param etd 出发时间，YYYY-MM-DDTHH:mm:ssZ
     * @param vessel 船舶属性 @see VesselAssemble, 注意吃水为船舶实时吃水，非档案中的固定吃水，一般可以从ais获取; 如获取不得，用档案吃水代替
     * @param cp { loadCondition, speed } LoadCondition: Ballast or Laden, speed(kts)
     * @param lane 航线 { points: { route, waypoints }}
     * @param source 气象数据源，GFS or CMEMES, 默认CMEMS
     * @param stepHrs 样本步长, 0表示动态计算(6 or 3 hrs)
     * @param useMeteo true 启用气象分析
     * @param useRouteParam
     * @param options
     * withDT: true, desulfurization tower 脱硫塔
     */
    static analyseInstant(from: any, etd: string | number | moment.Moment, vessel: VesselAssemble, cp: CpProps, lane: {
        points: {
            route: number[][][];
            waypoints: any[];
        };
    }, source?: string, stepHrs?: number, useMeteo?: boolean, useRouteParam?: boolean, options?: {
        requestId?: string;
        selfHosted?: boolean;
        withDT?: boolean;
    }): Promise<any>;
    /**
     * 分段失速分析（最多走hours 小时）
     * @param from 起点 {lng, lat}
     * @param etd 出发时间，YYYY-MM-DDTHH:mm:ssZ
     * @param threshed 单次所走上限时间
     * @param vessel 船舶属性 @see VesselAssemble, 注意吃水为船舶实时吃水，非档案中的固定吃水，一般可以从ais获取; 如获取不得，用档案吃水代替
     * @param cp { loadCondition, speed } LoadCondition: Ballast or Laden, speed(kts)
     * @param route 航路[[[lng, lat]]]
     * @param waypoints
     * @param source 气象数据源，GFS or CMEMES, 默认CMEMS
     * @param stepHrs
     * @param useMeteo true 启用气象分析
     * @param useRouteParam
     * @param options
     */
    static analyseInstantWithThreshed(from: any, etd: string | moment.Moment | number, threshed: moment.Moment, vessel: VesselAssemble, cp: CpProps, route: number[][][], waypoints: any[], source?: string, stepHrs?: number, useMeteo?: boolean, useRouteParam?: boolean, options?: {
        requestId?: string;
        selfHosted?: boolean;
    }): Promise<any>;
    /**
     * 在指定航线条件下，基于多CP，动态计算最优成本(租金+油费)方案
     * 1）首先分别计算单CP下的成本方案，基于成本排序，保留最省成本的两个方案，分别用 a, b 表示;
     * 2) 选择步骤1）中a,b的CP,分别用 cpa, cpb 表示；
     * 3) 基于当前有效天气预报时长（14天）,按步长多次减半，分别用7,4,2,1天步长及cpa,cpb交替计算各种组合下的成本；
     * 4）保留步骤3）中的最省成本的两个方案，并与步骤1）合并按成本排序，获取成本较优的三个方案；
     * 5) 基于步骤4），同客户沟通后，最终基于时间和成本，选择最合适的方案；
     *
     *
     * @param props 基础属性（位置，出发时间等）
     * @param vessel 船舶档案（长、宽、吃水、船舶类型等）
     * @param cps CP条款（装载状态，速度、油耗等）
     * @param lane 基础航线（重要转向点）
     * @param options
     */
    static analyseCost(props: SpeedProps, vessel: VesselAssemble, cps: CpProps[], lane: {
        route: number[][][];
        waypoints: any[];
    }, options?: {
        requestId?: string;
        selfHosted?: boolean;
    }): Promise<any[]>;
    /**
     * 按步长多次减半，分别用7,4,2,1天步长及cpa,cpb交替计算各种组合下的成本
     * @param props 基础属性（位置，出发时间，日租金，FO/DO/GO单价等）
     * @param vessel 船舶档案（长、宽、吃水、船舶类型等）
     * @param cps CP条款（装载状态，速度、油耗等）
     * @param max 最长分析未来14天
     * @param lane 基础航线（重要转向点）
     * @param step 步长，7，4，2，1
     * @param options
     */
    static combinedAnalyse(props: SpeedProps, vessel: VesselAssemble, max: moment.Moment, cps: CpProps[], lane: {
        route: number[][][];
        waypoints: any[];
    }, step: number, options?: {
        requestId?: string;
        selfHosted?: boolean;
        level?: number;
        counter?: number;
    }): Promise<{
        combined: boolean;
        cost: number;
        speeds: any[];
        step: number;
    }>;
    /**
     * 基于cp索引，交替计算指定步长下的成本
     * @param props 基础属性（位置，出发时间等）
     * @param vessel 船舶档案（长、宽、吃水、船舶类型等）
     * @param cps CP条款（装载状态，速度、油耗等）
     * @param cpIndex cp索引
     * @param max 最长分析未来14天
     * @param lane 基础航线（重要转向点）
     * @param step 步长，7，4，2，1
     * @param options
     */
    static alternateAnalyse(props: SpeedProps, vessel: VesselAssemble, max: moment.Moment, cps: CpProps[], cpIndex: number, lane: {
        route: number[][][];
        waypoints: any[];
    }, step: number, options?: {
        requestId?: string;
        selfHosted?: boolean;
        level?: number;
        counter?: number;
    }): Promise<any[]>;
    /**
     * 计算Speed的cost
     * @param speed
     * @param cp
     * @param props
     * @param options
     */
    static calculateCost(speed: any, cp: CpProps, props: CostProps, options?: {
        requestId?: string;
    }): Promise<any>;
    /**
     * 计算单cp模式下的ECA属性
     * within ECA, 需计算在ECA内的距离、时间、以及基于dgo的油耗；如果样本点落在ECA边界上，则通过航线插值的方式计算进入和离开ECA的时间点，以提高精度
     * @param speed
     * @param cp
     * @param options
     * withDT: true, desulfurization tower 脱硫塔
     */
    static calculateECA(speed: any, cp: CpProps, options?: {
        requestId?: string;
        withDT?: boolean;
    }): Promise<{
        distanceInECA: number;
        hoursInECA: number;
        totalDgoConsInECA: number;
        totalFoConsInECA: number;
        eca: any;
    }>;
    /**
     * 合并多cp组合模式下的速度集合
     * @param speeds
     * @param options
     */
    static mergeSpeeds(speeds: any[], options?: {
        requestId?: string;
    }): Promise<{
        sample: any;
        etd: any;
        eta: any;
        from: any;
        to: any;
        v0: any;
        label: string;
        distance: number;
        totalHrs: number;
        avgSpeed: number;
        wxFactor: number;
        cFactor: number;
        totalFoCons: number;
        totalDgoCons: number;
        cost: {
            total: number;
            hire: number;
            bunker: number;
        };
        extend: {
            cps: any[];
            eca: any;
            distanceInECA: number;
            hoursInECA: number;
            totalDgoConsInECA: number;
            speeds: any[];
        };
    }>;
}
