npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ladderscoring

v0.5.22

Published

A Library for scoring IGC files in accordance with BGA Ladder rules, with the addition of Windicapping

Downloads

18

Readme

LadderScoring

A Library for scoring IGC files in accordance with BGA Ladder rules, with the addition of Windicapping

The Scoring rules used are defined in the IScoringConfig interface, an instance of which must be passed to the scoreFlight function

Installation

npm install --save ladderscoring

or

yarn add ladderscoring

Include the module in your project:

import { TaskModel, assessFlight, AssessIGCResult, scoreFlight, ScoreIGCResult, IWind, .... } from 'ladderscoring';

Acknowledgements

To user Turbo87 for igc-parser

Interfaces

  • IGCFile See igc-parser

  • AssessIGCResult

    • The result of running an assessment on an IGCFile
    interface AssessIGCResult {
    
        flightDate: Date | null;
        loggerFlightDate: Date | null;
        flightLoaded: boolean,
    
        taskCompleted: boolean,
        legScoringDistance: number[],      // this is per leg....
        totalScoringDistance: number;
        speed: number,
    
        gpsLandout: boolean,                
        landoutPosition: ITurnPoint | null;
        usedTPs: ITaskTP[],
        missingTPs: ITaskTP[],
        TPTimes: string[],
        StartTime: string | undefined,
        FinishTime: string | undefined,
        LandingTime: string | undefined,
    
        secondPilot: string |null ,
        gliderReg: string,
        gliderType: string | null
        timeTaken: number;
        heightLoss: number;
        assessment: AssessmentResult | null,
        flightException: boolean,
        errorArray: string[],
    }
  • IScoringConfig

    interface IScoringConfig  {
    CompetitionID: number;      // The ID of competition for which this config applies. Not used by this module
    DistancePoints: number;     // points/handicapped km. Default 5
    SpeedPoints: number;        // Points/handicapped kph. Default .05
    MinimumSpeed: number;       // minimum handicapped speed to get speed points. Default 50
    CompletionFactor: number;   // multiplier if task completed. Default 1.1
    UseTaskDistance: boolean;    // Use Task or Sector Distance. In calculating performance, whether to use distances between task points or to reducce leg distances by the configured sector sizes
    UseMinDistance: boolean;    // if true, handicapped distance must be greater than glider handicap to get speed points
    CompleteForSpeed: boolean;  // if true, task must be completed to get Speed Points
    }
  • ScoreIGCResult

    interface ScoreIGCResult {
    taskDistance: number;   // the basic task distance
    hcDistance: number;     // the distance after windicapping was applied
    scoreDistance: number;  // the scoring distance (=hcDistance if completed)
    completed: boolean;
    taskTime: number;       // time on task in seconds
    hcSpeed: number;        // handicapped speed over the task
    distancePoints: number; // using the Scoring Rules.
    speedPoints: number;
    totalPoints: number;
    errors: string[];
    }
  • IWind: used to set the Contest wind for windicapping. Leave undefined for no windicapping

    {
        windstrength: number;   // in knots
        winddirection: number;  // in degrees true
    }
  • ITaskPoint

    • Definition of a turnpoint in a Task
    ITaskPoint {
    title: string;                      // eg 'Start', 'Finish'...
    TP: ITurnPoint | null;              // the actual Turnpoint
    sector: Sector;                     // the Sector definition used at this point
    legDistance: number | undefined;    // distance from the previous selected TP, without adj for sector
    sectorDistance: number|undefined;   // adjusted for sector size...    
    }
  • ITurnPoint

    • Definition of a Turnpoint. The interface defines all the properties used by a BGA Ladder Turnpoint, but the only ones used by this library are

      ITurnPoint {
      Trigraph: string;
      Name: string;
      Latitude: number;
      Longitude: number;
      }

Classes

  • TaskModel - defines the task against which the flight will be assessed. You should create a TaskModel then pass it to the assessFlight and scoreFlight APIs

    • Properties
        CompetitionID?: number;      The ID of the competion in which this task is used (see ladderscoringweb)
        TaskID?:  string | number;   Unique ID for this task
        TaskDate?: string;           Date of this task in ISO (YYYY-MM-DD) form
        turnpoints: ITaskPoint[];    Array of points for this task, in order
        Title: string = '';          A name for this task
        SubTaskOf?: string | number; which larger task this one is derived from, or zero
  • Sector - defines a sector as used in the Taskmodel. Create with

    sector = new Sector(
        radius1: number = 0.5,
        angle1: number =180,
        radius2: number=20,
        angle2: number=90,
        line: boolean=false )

    Angles in degrees, distances in km.

API

  • loadFlight (flt: string | string[]):IGCParser.IGCFile

    Takes an IGC file as either a single string or as an array of lines and parses it into an IGCFile object.

  • assessFlight = async (igcflight: IGCParser.IGCFile, task:TaskModel): Promise<AssessIGCResult>

    Takes an IGCFile object and assesses it against a TaskModel, producing an AssessIGCResult with the results of the analysis.

  • scoreFlight = async (task: TaskModel, assessment: AssessIGCResult, wind: IWind, gliderHandicap: number, config: IScoringConfig): Promise<ScoreIGCResult>

    Takes an AssessIGCResult and scores it against the given TaskModel, applying windicapping as appropriate. Set the wind strength to zero for no windicapping.