components

package
v0.0.0-...-57fb5ef Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateIdle    = "idle"
	StateBurning = "burning"
)

MotorState represents the states of the motor

Variables

This section is empty.

Functions

func CalculateFinMass

func CalculateFinMass(fin *openrocket.TrapezoidFinset) float64

calculateFinMass calculates mass based on material density and dimensions

Types

type Acceleration

type Acceleration struct {
	ecs.BasicEntity
	X, Y, Z float64
}

Acceleration represents a 3D acceleration

type Bodytube

type Bodytube struct {
	ID           ecs.BasicEntity
	Position     types.Vector3
	Radius       float64
	Length       float64
	Mass         float64
	Thickness    float64
	Density      float64 // Material density
	Finish       string  // Surface finish
	MaterialName string  // Name of material
	MaterialType string  // Type of material
	CrossSection float64 // Cross-sectional area
	SurfaceArea  float64 // Total surface area
	Volume       float64 // Volume of material
}

Bodytube represents the bodytube entity of a rocket

func NewBodytube

func NewBodytube(id ecs.BasicEntity, radius, length, mass, thickness float64) *Bodytube

NewBodytube creates a new bodytube instance

func NewBodytubeFromORK

func NewBodytubeFromORK(id ecs.BasicEntity, orkData *openrocket.RocketDocument) (*Bodytube, error)

NewBodytubeFromORK creates a new bodytube instance from an ORK Document

func (*Bodytube) GetDensity

func (b *Bodytube) GetDensity() float64

GetDensity returns the material density of the bodytube

func (*Bodytube) GetMass

func (b *Bodytube) GetMass() float64

GetMass returns the mass of the bodytube

func (*Bodytube) GetPlanformArea

func (b *Bodytube) GetPlanformArea() float64

GetPlanformArea returns the planform area of the bodytube

func (*Bodytube) GetSurfaceArea

func (b *Bodytube) GetSurfaceArea() float64

GetSurfaceArea returns the total surface area of the bodytube

func (*Bodytube) GetVolume

func (b *Bodytube) GetVolume() float64

GetVolume returns the volume of the bodytube material

func (*Bodytube) String

func (b *Bodytube) String() string

String returns a string representation of the bodytube

func (*Bodytube) Type

func (b *Bodytube) Type() string

Type returns the type of the component

func (*Bodytube) Update

func (b *Bodytube) Update(dt float64) error

Update updates the bodytube (currently does nothing)

type Mass

type Mass struct {
	ecs.BasicEntity
	Value float64
}

Mass represents a mass value

type Motor

type Motor struct {
	ID          ecs.BasicEntity
	Position    types.Vector3
	Thrustcurve [][]float64
	Mass        float64

	Props *thrustcurves.MotorData
	FSM   *MotorFSM
	// contains filtered or unexported fields
}

Motor represents a rocket motor component

func NewMotor

func NewMotor(id ecs.BasicEntity, md *thrustcurves.MotorData, logger logf.Logger) *Motor

NewMotor creates a new motor component from thrust curve data

func (*Motor) GetElapsedTime

func (m *Motor) GetElapsedTime() float64

Add method to get elapsed time

func (*Motor) GetMass

func (m *Motor) GetMass() float64

GetMass returns the current mass of the motor

func (*Motor) GetPlanformArea

func (m *Motor) GetPlanformArea() float64

GetPlanformArea returns the planform area of the motor

func (*Motor) GetState

func (m *Motor) GetState() string

GetState returns the current state of the motor

func (*Motor) GetThrust

func (m *Motor) GetThrust() float64

GetThrust returns the current thrust of the motor

func (*Motor) IsCoasting

func (m *Motor) IsCoasting() bool

IsCoasting returns true if the motor has completed its burn

func (*Motor) Reset

func (m *Motor) Reset()

Reset resets the motor state for potential reuse

func (*Motor) SetState

func (m *Motor) SetState(state string)

SetState (testing only) sets the motor state to a specific value

func (*Motor) String

func (m *Motor) String() string

String returns a string representation of the motor component

func (*Motor) Type

func (m *Motor) Type() string

Type returns the type of the motor component

func (*Motor) Update

func (m *Motor) Update(dt float64) error

Update updates the motor state based on the current time step

type MotorFSM

type MotorFSM struct {
	*fsm.FSM
}

MotorFSM represents the finite state machine for the motor

func NewMotorFSM

func NewMotorFSM() *MotorFSM

NewMotorFSM creates a new FSM for the motor

func (*MotorFSM) GetState

func (fsm *MotorFSM) GetState() string

GetState returns the current state of the FSM

func (*MotorFSM) UpdateState

func (fsm *MotorFSM) UpdateState(mass float64, elapsedTime float64, burnTime float64) error

UpdateState updates the state based on mass and elapsed time

type MotorState

type MotorState string

MotorState represents the current state of the motor

const (
	MotorIgnited  MotorState = "IGNITED"
	MotorBurning  MotorState = "BURNING"
	MotorBurnout  MotorState = "BURNOUT"
	MotorCoasting MotorState = "COASTING"
)

MotorState constants

type Nosecone

type Nosecone struct {
	ID                ecs.BasicEntity
	Position          types.Vector3
	Radius            float64
	Length            float64
	Mass              float64
	ShapeParameter    float64
	Thickness         float64
	Shape             string
	Finish            string
	MaterialName      string
	MaterialType      string
	Density           float64
	Volume            float64
	SurfaceArea       float64
	AftShoulderRadius float64
	AftShoulderLength float64
	AftShoulderCapped bool
	ShapeClipped      bool
	IsFlipped         bool
}

Nosecone represents the nosecone entity of a rocket

func NewNosecone

func NewNosecone(id ecs.BasicEntity, radius, length, mass, shapeParameter float64) *Nosecone

NewNosecone creates a new nosecone instance

func NewNoseconeFromORK

func NewNoseconeFromORK(id ecs.BasicEntity, orkData *openrocket.RocketDocument) *Nosecone

NewNoseconeFromORK creates a new nosecone instance from an ORK Document

func (*Nosecone) GetDensity

func (n *Nosecone) GetDensity() float64

GetDensity returns the material density

func (*Nosecone) GetMass

func (n *Nosecone) GetMass() float64

GetMass returns the mass of the nosecone

func (*Nosecone) GetPlanformArea

func (n *Nosecone) GetPlanformArea() float64

GetPlanformArea returns the planform area of the nosecone

func (*Nosecone) GetSurfaceArea

func (n *Nosecone) GetSurfaceArea() float64

GetSurfaceArea returns the surface area of the nosecone

func (*Nosecone) GetVolume

func (n *Nosecone) GetVolume() float64

GetVolume returns the volume of the nosecone material

func (*Nosecone) String

func (n *Nosecone) String() string

String returns a string representation of the Nosecone

func (*Nosecone) Type

func (n *Nosecone) Type() string

Type returns the type of the component

func (*Nosecone) Update

func (n *Nosecone) Update(dt float64) error

Update updates the nosecone (currently does nothing)

type Position

type Position struct {
	ecs.BasicEntity
	X, Y, Z float64
}

Position represents a 3D position

type TrapezoidFinset

type TrapezoidFinset struct {
	ecs.BasicEntity
	RootChord  float64
	TipChord   float64
	Span       float64
	SweepAngle float64
	Position   Position
	Mass       float64
}

TrapezoidFinset represents a trapezoidal fin

func NewTrapezoidFinsetFromORK

func NewTrapezoidFinsetFromORK(basic ecs.BasicEntity, ork *openrocket.RocketDocument) *TrapezoidFinset

NewTrapezoidFinsetFromORK creates a new TrapezoidFinset component from OpenRocket data

func (*TrapezoidFinset) GetMass

func (f *TrapezoidFinset) GetMass() float64

GetMass returns the mass of the finset

func (*TrapezoidFinset) GetPlanformArea

func (f *TrapezoidFinset) GetPlanformArea() float64

GetPlanformArea returns the planform area of the finset

type Velocity

type Velocity struct {
	ecs.BasicEntity
	X, Y, Z float64
}

Velocity represents a 3D velocity

Jump to

Keyboard shortcuts

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