92 lines
2.1 KiB
TypeScript
92 lines
2.1 KiB
TypeScript
/**
|
|
* Scenario-related domain types.
|
|
*
|
|
* A scenario is a named prediction configuration a user saves and reapplies.
|
|
* Scenarios are composed of "flight parameters" plus dataset/model metadata.
|
|
*
|
|
* Identifiers (`standard_profile` etc.) are the canonical form. Localized
|
|
* labels live in `$i18n/locales` — do not use the `PROFILE_NAMES` here for
|
|
* UI text; look up the i18n key `domain.profile.<identifier>`.
|
|
*/
|
|
|
|
export const PROFILE_IDENTIFIERS = [
|
|
'standard_profile',
|
|
'float_profile',
|
|
'reverse_profile',
|
|
'custom_profile',
|
|
] as const;
|
|
export type ProfileIdentifier = (typeof PROFILE_IDENTIFIERS)[number];
|
|
|
|
export const PREDICTION_MODES = ['single', 'hourly', 'ensemble'] as const;
|
|
export type PredictionMode = (typeof PREDICTION_MODES)[number];
|
|
|
|
export interface FlightParameters {
|
|
ascent_rate: number;
|
|
burst_altitude: number;
|
|
dataset: string;
|
|
descent_rate: number;
|
|
format: 'json';
|
|
launch_altitude: number;
|
|
launch_latitude: number;
|
|
launch_longitude: number;
|
|
profile: ProfileIdentifier;
|
|
version: number;
|
|
start_point?: number;
|
|
rate_profile?: number;
|
|
template?: number;
|
|
}
|
|
|
|
export interface SavedPoint {
|
|
id: number;
|
|
name: string;
|
|
lat: number;
|
|
lon: number;
|
|
alt: number;
|
|
}
|
|
|
|
export interface RateCurvePoint {
|
|
order: number;
|
|
time_constraint: number;
|
|
alt_constraint: number;
|
|
rate: number;
|
|
}
|
|
|
|
export interface SavedFlightProfile {
|
|
id: number;
|
|
name: string;
|
|
type?: string;
|
|
rate_profile_data: RateCurvePoint[];
|
|
}
|
|
|
|
export interface SavedScenario {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
prediction_mode: string;
|
|
model: string;
|
|
dataset: string;
|
|
flight_parameters: FlightParameters;
|
|
}
|
|
|
|
export const DEFAULT_FLIGHT_PARAMETERS: FlightParameters = {
|
|
ascent_rate: 5.0,
|
|
burst_altitude: 30000.0,
|
|
dataset: '',
|
|
descent_rate: 5.0,
|
|
format: 'json',
|
|
launch_altitude: 0.0,
|
|
launch_latitude: 62.1234,
|
|
launch_longitude: 129.1234,
|
|
profile: 'standard_profile',
|
|
version: 2,
|
|
};
|
|
|
|
export const DEFAULT_SCENARIO: SavedScenario = {
|
|
id: -1,
|
|
name: 'Новый сценарий',
|
|
description: '',
|
|
prediction_mode: 'single',
|
|
model: '',
|
|
dataset: '',
|
|
flight_parameters: DEFAULT_FLIGHT_PARAMETERS,
|
|
};
|