Documentation
¶
Index ¶
- Variables
- type MotorData
- type Record
- type RecordManager
- func (rm *RecordManager) CreateRecord(cfg *config.Config) (*Record, error)
- func (rm *RecordManager) CreateRecordWithConfig(configData []byte, orkData []byte) (*Record, error)
- func (rm *RecordManager) DeleteRecord(hash string) error
- func (rm *RecordManager) GetRecord(hash string) (*Record, error)
- func (rm *RecordManager) GetStorageDir() string
- func (rm *RecordManager) ListRecords() ([]*Record, error)
- type SimStorageType
- type SimulationData
- type Storage
- type StorageInterface
- type Stores
- type ThrustPoint
Constants ¶
This section is empty.
Variables ¶
var ErrRecordNotFound = errors.New("record not found")
ErrRecordNotFound is returned when a requested record hash does not exist.
var StorageHeaders = map[SimStorageType][]string{ MOTION: { "time", "altitude", "velocity", "acceleration", "thrust", }, EVENTS: { "time", "event_name", "motor_status", "parachute_status", }, DYNAMICS: { "time", "position_x", "position_y", "position_z", "velocity_x", "velocity_y", "velocity_z", "acceleration_x", "acceleration_y", "acceleration_z", "orientation_x", "orientation_y", "orientation_z", "orientation_w", }, }
StorageHeaders is a map of columns for storage types
Functions ¶
This section is empty.
Types ¶
type MotorData ¶ added in v0.9.0
type MotorData struct { Name string MaxThrust float64 TotalImpulse float64 BurnTime float64 AverageThrust float64 ThrustData []ThrustPoint Headers []string // Headers for the data columns Data [][]string // Raw CSV data for motor }
MotorData represents motor-specific simulation data
type Record ¶
type Record struct { Name string `json:"name"` Hash string `json:"hash"` LastModified time.Time `json:"lastModified"` // Keep for potential compatibility, but prioritize CreationTime CreationTime time.Time `json:"creationTime"` // More reliable timestamp Path string Motion *Storage Events *Storage Dynamics *Storage }
type RecordManager ¶
type RecordManager struct {
// contains filtered or unexported fields
}
RecordManager manages simulation records
func NewRecordManager ¶
NewRecordManager creates a new RecordManager. It requires the application config, the base directory for records, and a logger.
func (*RecordManager) CreateRecord ¶
func (rm *RecordManager) CreateRecord(cfg *config.Config) (*Record, error)
CreateRecord creates a new record with a unique hash based on the current time
func (*RecordManager) CreateRecordWithConfig ¶ added in v0.8.0
func (rm *RecordManager) CreateRecordWithConfig(configData []byte, orkData []byte) (*Record, error)
CreateRecordWithConfig creates a new record with a hash derived from configuration and OpenRocket data
func (*RecordManager) DeleteRecord ¶
func (rm *RecordManager) DeleteRecord(hash string) error
DeleteRecord deletes a record by Hash
func (*RecordManager) GetRecord ¶
func (rm *RecordManager) GetRecord(hash string) (*Record, error)
GetRecord retrieves an existing record by hash without creating a new one.
func (*RecordManager) GetStorageDir ¶ added in v0.7.0
func (rm *RecordManager) GetStorageDir() string
GetStorageDir returns the base directory for the record manager.
func (*RecordManager) ListRecords ¶
func (rm *RecordManager) ListRecords() ([]*Record, error)
ListRecords lists all existing valid records in the base directory.
type SimStorageType ¶ added in v0.3.5
type SimStorageType string
SimStorageType is the type of storage service (MOTION, EVENTS, etc.)
const ( // MOTION storage SimStorageType MOTION SimStorageType = "MOTION" // EVENTS storage SimStorageType EVENTS SimStorageType = "EVENTS" // DYNAMICS storage SimStorageType DYNAMICS SimStorageType = "DYNAMICS" )
type SimulationData ¶ added in v0.9.0
type SimulationData struct { Motor *MotorData `json:"motor" yaml:"motor"` MotionHeaders []string `json:"motion_headers,omitempty" yaml:"motion_headers,omitempty"` MotionData [][]string `json:"motion_data,omitempty" yaml:"motion_data,omitempty"` EventsHeaders []string `json:"events_headers,omitempty" yaml:"events_headers,omitempty"` EventsData [][]string `json:"events_data,omitempty" yaml:"events_data,omitempty"` ORKDoc *openrocket.OpenrocketDocument `json:"ork_doc,omitempty" yaml:"ork_doc,omitempty"` }
SimulationData holds overall data from a simulation run that isn't part of the static config. It's intended to be passed to functions like report generation.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a service that writes csv's to disk
func NewStorage ¶
NewStorage creates a new storage service for a specific store type within a given record directory.
func (*Storage) GetFilePath ¶
GetFilePath returns the file path of the storage service.
func (*Storage) Init ¶
Init ensures the header row is written if the file is new/empty. It is non-destructive if the file already appears to be initialized.
func (*Storage) ReadHeadersAndData ¶
ReadHeadersAndData reads the headers and data separately from the storage file
type StorageInterface ¶
type ThrustPoint ¶ added in v0.9.0
ThrustPoint represents a single point on a motor thrust curve