gorow

package module
v0.0.0-...-c10fe60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 25 Imported by: 1

README

gorow

gorow package for numerical calculations related to rowing (sport)

Documentation

Documentation

Overview

Package gorow package to simulate the physics rowing (sport)

Index

Constants

View Source
const CLmax = 1.0

CLmax maximum lift coefficient for blade

View Source
const Cdw = 1.1 // for all boats, big approximation

Cdw drag constant

View Source
const LbstoN = 4.44822

LbstoN convert lbs of force to Newton

View Source
const N = 50

N Number for bladeforce

View Source
const RhoAir = 1.226 // kg.m3

RhoAir air density

View Source
const Scull = "scull"

Scull string

Variables

View Source
var RigCoastalLiteboat = NewRig(0.9, 35, 2.655, 1.6, 0.88, "scull", -0.93, 0.0822, 0.46, 1, 1.121)

RigCoastalLiteboat coastal1x

View Source
var RigCoastalMaas = NewRig(0.9, 18, 2.655, 1.6, 0.88, "scull", -0.93, 0.0822, 0.46, 1, 1.121)

RigCoastalMaas coastal1x

View Source
var RigDouble = NewRig(0.9, 27, 2.655, 1.6, 0.88, "scull", -0.93, 0.0822, 0.46, 2, 1.05)

RigDouble 2x

View Source
var RigEight = NewRig(1.14, 151, 3.205, 1.6, 0.88, "row", -0.93, 0.1174, 0.545, 8, 1)

RigEight 8+

View Source
var RigFour = NewRig(1.14, 50, 3.205, 1.6, 0.88, "row", -0.93, 0.1174, 0.545, 4, 1)

RigFour 4-

View Source
var RigPair = NewRig(1.14, 27, 3.205, 1.6, 0.88, "row", -0.93, 0.1174, 0.46, 2, 1.05)

RigPair 2-

View Source
var RigQuad = NewRig(0.9, 52, 2.655, 1.6, 0.88, "scull", -0.93, 0.0822, 0.46, 4, 1.11)

RigQuad 4x

View Source
var RigSingle = NewRig(0.9, 14, 2.655, 1.6, 0.88, "scull", -0.93, 0.0822, 0.46, 1, 0.98)

RigSingle 1x

Functions

func AddBearing

func AddBearing(strokes []StrokeRecord)

AddBearing returns a stroke set with bearing

func AddStream

func AddStream(strokes []StrokeRecord, vstream float64, unit string)

AddStream adds river stream

func AddWind

func AddWind(strokes []StrokeRecord, vwind float64, winddirection float64, unit string)

AddWind adds wind speed and direction

func AverageHR

func AverageHR(strokes []StrokeRecord) float64

AverageHR calculates average heart rate

func AveragePower

func AveragePower(strokes []StrokeRecord) float64

AveragePower calculates average power

func AverageSPM

func AverageSPM(strokes []StrokeRecord) float64

AverageSPM calculates average SPM

func BladeForce

func BladeForce(oarangle float64, rigging *Rig, vb, fblade float64) ([]float64, error)

BladeForce calculates the blade slip given a handle force

func ConstSpace

func ConstSpace(value float64, N int) []float64

ConstSpace to create a array of value

func ConstantVeloFast

func ConstantVeloFast(
	velo float64,
	crew *Crew,
	rigging *Rig,
	timestep float64,
	aantal int,
	aantal2 int,
	Fmin float64,
	Fmax float64,
	catchacceler float64,
	windv float64,
	dowind bool,
) ([]float64, error)

ConstantVeloFast calculates force and power to achieve certain boat speed

func ConstantWattFast

func ConstantWattFast(
	watt float64,
	crew *Crew,
	rigging *Rig,
	timestep float64,
	aantal int,
	aantal2 int,
	Fmin float64,
	Fmax float64,
	catchacceler float64,
	windv float64,
	dowind bool,
	maxIterationsAllowed int,
) ([]float64, error)

ConstantWattFast returns force, average speed given input power in Watt

func DragEq

func DragEq(displacement float64, velo float64,
	alfaref float64, doprint int, constantdrag int) float64

DragEq calculates drag

func EnergyBalance

func EnergyBalance(
	F float64,
	crew *Crew,
	rigging *Rig,
	v0 float64,
	dt float64,
	catchacceler float64,
	windv float64,
	dowind bool,
) ([]float64, error)

EnergyBalance calculates one stroke with average handle force as input

func LinSpace

func LinSpace(start float64, stop float64, N int) ([]float64, error)

LinSpace to create a Linear range

func OTWSetPower

func OTWSetPower(
	strokes []StrokeRecord,
	c *Crew,
	rg *Rig,
	secret string,
	progressurl string,
	powermeasured bool,
	verbose bool) error

OTWSetPower adds power for OTW rows

func PhysGetPower

func PhysGetPower(
	velo float64,
	rower *Crew,
	rigging *Rig,
	bearing float64,
	vwind float64,
	winddirection float64,
	vstream float64,
) ([]float64, error)

PhysGetPower Gets power and no wind pace

func Stroke

func Stroke(
	F float64,
	crew *Crew,
	rigging *Rig,
	v0 float64,
	dt float64,
	aantal int,
	catchacceler float64,
	dowind bool,
	windv float64,
) ([]float64, error)

Stroke calculates a few (aantal) strokes and returns parameters averaged over those strokes

func StrokeFieldMapping

func StrokeFieldMapping(field string) (string, error)

StrokeFieldMapping maps StrokeRecord field names to CSV header names

func WorkoutMetrics

func WorkoutMetrics(
	filename string,
	ftp float64,
	sex string,
	hrftp, hrmax, hrmin float64,
) (tss, normp, trimp, hrtss, normv, normw float64, err error)

WorkoutMetrics calculates workout level metrics (TSS, TRIMP and more)

func WriteCSV

func WriteCSV(strokes []StrokeRecord, f string, overwrite bool, gz bool) (ok bool, err error)

WriteCSV writes data to file

func WriteParquet

func WriteParquet(strokes []StrokeRecord, f string, overwrite bool, gz bool) (ok bool, err error)

WriteParquet writes data to Parquet

Types

type CosinusRecovery

type CosinusRecovery struct {
	P1           float64
	Strokelength float64
}

CosinusRecovery recovery profile

type Crew

type Crew struct {
	Mc           float64
	Strokelength float64
	Tempo        float64
	Frac         float64
	// recprofile = sinusrecovery()
	Recoveryprofile RecoveryProfile
	// Strokeprofile = trapezium(X1=0.15,X2=0.5,H2=0.9)
	Strokeprofile ForceProfile
	// technique = technique_meas()
	Maxpower float64
	Maxforce float64
}

Crew class with rower quantities

func NewCrew

func NewCrew(Mc float64, Strokelength float64, Tempo float64, Frac float64,
	Recoveryprofile RecoveryProfile, Strokeprofile ForceProfile,
	Maxpower float64, Maxforce float64) *Crew

NewCrew inits Crew instance

func (*Crew) FromJSON

func (c *Crew) FromJSON(s string) error

FromJSON sets crew from JSON

func (*Crew) ToJSON

func (c *Crew) ToJSON() (string, error)

ToJSON exports crew to JSON

type Flat

type Flat struct {
}

Flat stroke profile

type FlatRecovery

type FlatRecovery struct {
}

FlatRecovery recovery profile

type ForceProfile

type ForceProfile interface {
	// contains filtered or unexported methods
}

ForceProfile interface forceprofile

type RecoveryProfile

type RecoveryProfile interface {
	// contains filtered or unexported methods
}

RecoveryProfile interface

type Rig

type Rig struct {
	Lin         float64
	Mb          float64
	BladeLength float64
	Lscull      float64
	Nrowers     int32
	RowOrScull  string
	Span        float64
	CatchAngle  float64
	DragForm    float64
	// contains filtered or unexported fields
}

Rig holds boat rigging parameters and has methods to manipulate them

func NewRig

func NewRig(Lin float64, Mb float64, Lscull float64,
	Span float64, spread float64, RowOrScull string,
	CatchAngle float64, bladearea float64, BladeLength float64,
	Nrowers int32, DragForm float64) *Rig

NewRig initiates a new boat rigging

func (*Rig) FromJSON

func (rg *Rig) FromJSON(s string) error

FromJSON sets rig from JSON

func (*Rig) ToJSON

func (rg *Rig) ToJSON() (string, error)

ToJSON exports rig to JSON

type SinusRecovery

type SinusRecovery struct {
}

SinusRecovery recovery profile

type SinusRecovery2

type SinusRecovery2 struct {
	P1           float64
	Strokelength float64
}

SinusRecovery2 recovery profile

type StrokeRecord

type StrokeRecord struct {
	Timestamp          float64 `rowingdata:"TimeStamp (sec)" parquet:"name=time, type=DOUBLE, encoding=PLAIN_DICTIONARY"`
	Distance           float64 `rowingdata:" Horizontal (meters)" parquet:"name=distance, type=DOUBLE"`
	Spm                float64 `rowingdata:" Cadence (stokes/min)" parquet:"name=spm, type=DOUBLE"`
	Hr                 float64 `rowingdata:" HRCur (bpm)" parquet:"name=hr, type=DOUBLE"`
	Pace               float64 `rowingdata:" Stroke500mPace (sec/500m)" parquet:"name=pace, type=DOUBLE"`
	Power              float64 `rowingdata:" Power (watts)" parquet:"name=power, type=DOUBLE"`
	Drivelength        float64 `rowingdata:" DriveLength (meters)" parquet:"name=drivelength, type=DOUBLE"`
	Strokedistance     float64 `rowingdata:" StrokeDistance (meters)" parquet:"name=distanceperstroke, type=DOUBLE"`
	Drivetime          float64 `rowingdata:" drivetime"`
	Dragfactor         int64   `rowingdata:" DragFactor"`
	Strokerecoverytime float64 `rowingdata:" StrokeRecoveryTime (ms)"`
	Workperstroke      float64 `rowingdata:" WorkPerStroke (joules)" parquet:"name=driveenergy, type=DOUBLE"`
	Averageforce       float64 `rowingdata:" AverageDriveForce (lbs)" parquet:"name=averageforce, type=DOUBLE"`
	Peakforce          float64 `rowingdata:" PeakDriveForce (lbs)" parquet:"name=peakforce, type=DOUBLE"`
	Velo               float64 `rowingdata:" Speed (m/sec)" parquet:"name=velo, type=DOUBLE"`
	Lapnr              int64   `rowingdata:" lapIdx"`
	Intervaltime       float64 `rowingdata:" ElapsedTime (sec)"`
	Calories           float64 `rowingdata:" Calories (kCal)"`
	Workoutstate       float64 `rowingdata:" WorkoutState" parquet:"name=workoutstate, type=DOUBLE"`
	Latitude           float64 `rowingdata:" latitude"`
	Longitude          float64 `rowingdata:" longitude"`
	Bearing            float64 `rowingdata:" bearing"`
	Nowindpace         float64 `rowingdata:"nowindpace" parquet:"name=nowindpace, type=DOUBLE"`
	Equivergpower      float64 `rowingdata:"Equiv erg Power" parquet:"name=equivergpower, type=DOUBLE"`
	Modelpower         float64 `rowingdata:"power (model)"`
	Modelfavg          float64 `rowingdata:"averageforce (model)"`
	Modeldrivelength   float64 `rowingdata:"drivelength (model)"`
	Vwind              float64 `rowingdata:"vwind"`
	Winddirection      float64 `rowingdata:"winddirection"`
	Vstream            float64 `rowingdata:"vstream"`
}

StrokeRecord sort of dataframe

func ReadCSV

func ReadCSV(f string) ([]StrokeRecord, error)

ReadCSV reads rowing data into data frame from CSV file or gzipped CSV file with extension .csv.gz

func ReadParquet

func ReadParquet(f string) ([]StrokeRecord, error)

ReadParquet reads rowing data into data frame from Parquet file

func (*StrokeRecord) GetField

func (s *StrokeRecord) GetField(field string) (float64, error)

GetField gets field value as float from StrokeRecord

type StrongBegin

type StrongBegin struct {
	Frac float64
}

StrongBegin stroke profile

type StrongEnd

type StrongEnd struct {
	Frac float64
}

StrongEnd stroke profile

type StrongMiddle

type StrongMiddle struct {
	Frac float64
}

StrongMiddle stroke profile with strong middle

type StrongMiddle2

type StrongMiddle2 struct {
	Frac float64
}

StrongMiddle2 stroke profile, alternative with strong middle

type Trapezium

type Trapezium struct {
	H1, H2, X1, X2 float64
}

Trapezium stroke profile

type Trapezium2

type Trapezium2 struct {
	H0, H1, H2, X1, X2 float64
}

Trapezium2 stroke profile

type TriangleRecovery

type TriangleRecovery struct {
	X1 float64
}

TriangleRecovery recovery profile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL