Documentation
¶
Index ¶
- Constants
- func AntennaElectricalDelayNs(gen AntennaGen) (float64, error)
- func GenerateSVG(tor *TORFile, peaks []Peak, result *MeasurementResult, w io.Writer) error
- func GenerateSVGWindow(tor *TORFile, peaks []Peak, result *MeasurementResult, w io.Writer, ...) error
- func GenerateSVGZoomed(tor *TORFile, peaks []Peak, result *MeasurementResult, w io.Writer, ...) error
- func PeakDescription(model ReceiverModel) map[string]string
- func SMAPortOffsetNs(model ReceiverModel) (float64, error)
- type AntennaGen
- type DataPoint
- type DelayResult
- type MeasurementResult
- type Peak
- type PeakGroup
- type PeakResult
- type ReceiverModel
- type TORFile
- type TORSettings
- type TracePoint
Constants ¶
const CoaxDelayNsPerM = 5.05
CoaxDelayNsPerM is the propagation delay of RG58 coaxial cable in ns/m
const SpeedOfLight = 299792458.0
SpeedOfLight in meters per second
Variables ¶
This section is empty.
Functions ¶
func AntennaElectricalDelayNs ¶
func AntennaElectricalDelayNs(gen AntennaGen) (float64, error)
AntennaElectricalDelayNs returns the electrical delay in nanoseconds for a given antenna generation
func GenerateSVG ¶
GenerateSVG creates an SVG plot of the full OTDR trace with peaks annotated
func GenerateSVGWindow ¶
func GenerateSVGWindow( tor *TORFile, peaks []Peak, result *MeasurementResult, w io.Writer, minTimeNs, maxTimeNs float64, ) error
GenerateSVGWindow creates an SVG plot of the OTDR trace for a specific time window (minTimeNs to maxTimeNs), with peaks annotated.
func GenerateSVGZoomed ¶
func GenerateSVGZoomed(tor *TORFile, peaks []Peak, result *MeasurementResult, w io.Writer, maxTimeNs float64) error
GenerateSVGZoomed creates an SVG plot of the OTDR trace zoomed to the first maxTimeNs nanoseconds, with peaks annotated.
func PeakDescription ¶
func PeakDescription(model ReceiverModel) map[string]string
PeakDescription returns the descriptions for OA/OB/OC/OD based on receiver model
func SMAPortOffsetNs ¶
func SMAPortOffsetNs(model ReceiverModel) (float64, error)
SMAPortOffsetNs returns the delay in nanoseconds between the FO Out port (where OA is measured) and the SMA port (where downstream devices connect).
Types ¶
type AntennaGen ¶
type AntennaGen string
AntennaGen represents antenna generation and phase
const ( Gen2Phase0 AntennaGen = "gen2-p0" Gen2Phase1 AntennaGen = "gen2-p1" Gen2Phase2 AntennaGen = "gen2-p2" Gen2aPhase2 AntennaGen = "gen2a-p2" )
type DelayResult ¶
type DelayResult struct {
SMAPortOffsetNs float64 `json:"sma_port_offset_ns"`
RxDelayNs float64 `json:"rx_delay_ns"`
CableDelayNs float64 `json:"cable_delay_ns"`
AntennaOpticalDelayNs float64 `json:"antenna_optical_delay_ns"`
AntennaElectricalDelayNs float64 `json:"antenna_electrical_delay_ns"`
TotalDelayNs float64 `json:"total_delay_ns"`
CoaxCableLengthM float64 `json:"coax_cable_length_m"`
CoaxCableDelayNs float64 `json:"coax_cable_delay_ns"`
EndToEndDelayNs float64 `json:"end_to_end_delay_ns"`
}
DelayResult captures the computed delays between peaks
type MeasurementResult ¶
type MeasurementResult struct {
DeviceName string `json:"device_name"`
SerialNumber string `json:"serial_number"`
Model ReceiverModel `json:"model"`
AntennaGen AntennaGen `json:"antenna_gen"`
TORFile string `json:"tor_file"`
DateTime string `json:"date_time"`
Settings TORSettings `json:"settings"`
Peaks []PeakResult `json:"peaks"`
Delays DelayResult `json:"delays"`
Trace []TracePoint `json:"trace"`
}
MeasurementResult is the detailed per-device JSON output
func ComputeResult ¶
func ComputeResult( tor *TORFile, peaks []Peak, name, serial string, model ReceiverModel, antennaGen AntennaGen, coaxCableLengthM, launchCableLengthM float64, ) (*MeasurementResult, error)
ComputeResult computes the full measurement result from parsed TOR data and peaks.
type Peak ¶
type Peak struct {
Label string // OA, OB, OC, OD
DistanceM float64 // distance in meters at peak maximum
AmplitudeDB float64 // amplitude in dB at peak maximum
TimeNs float64 // time in nanoseconds
Index int // index into DataPoints
}
Peak represents a detected reflective event in the OTDR trace
func DetectPeaks ¶
DetectPeaks finds the 4 reflective peaks (OA, OB, OC, OD) in the OTDR trace.
OA is found via local prominence detection (it is a strong reflection from the FO Out connector). OB, OC, OD are found by searching for the highest-amplitude raw data point inside fixed time windows, because the connectors at OB and OC can produce subtle reflections (e.g. Q-ODC-12 and FC APC) that don't exceed the prominence threshold.
OD is anchored to the strongest reflection past OB (the antenna optical isolator), and OC is then located in a small window before OD. This avoids any reliance on cable-end detection and prevents post-OD saturation noise from being mistaken for a peak.
launchCableLengthM specifies the length of the launch cable in meters. Any peaks within this distance from the start of the trace are ignored, as they are reflections from the launch cable connectors rather than the system under test. Use 0 if no launch cable is present.
type PeakGroup ¶
type PeakGroup struct {
StartIdx int
EndIdx int
PeakIdx int
PeakDistM float64
PeakAmpDB float64
Prominence float64
}
PeakGroup is a cluster of consecutive elevated data points forming a single reflection event
type PeakResult ¶
type PeakResult struct {
Label string `json:"label"`
Description string `json:"description"`
DistanceM float64 `json:"distance_m"`
AmplitudeDB float64 `json:"amplitude_db"`
TimeNs float64 `json:"time_ns"`
}
PeakResult captures a single detected peak
type ReceiverModel ¶
type ReceiverModel string
ReceiverModel represents the Huber-Suhner GNSS receiver model
const ( GNSSoF16RxE ReceiverModel = "GNSSoF16-RxE" GNSSPoF164RxE ReceiverModel = "GNSSPoF16-4RxE" )
type TORFile ¶
type TORFile struct {
DateTime time.Time
InstrumentInfo string
ModuleSerialNumber string
CableID string
FiberID string
FiberType int
Wavelength int
PulseWidth int
RefractiveIndex float64
DistanceUnit int
Average int
End float64
Start float64
Resolution float64
DistanceRange int
LossThreshold float64
ReflectanceThreshold float64
EndOfFiberThreshold float64
BackscatterCoefficient float64
HighResolution int
DataPoints []DataPoint
}
TORFile represents a parsed Luciol LOR-220 OTDR .tor file
type TORSettings ¶
type TORSettings struct {
Wavelength int `json:"wavelength_nm"`
PulseWidth int `json:"pulse_width"`
RefractiveIndex float64 `json:"refractive_index"`
Resolution float64 `json:"resolution_m"`
Start float64 `json:"start_m"`
End float64 `json:"end_m"`
BackscatterCoefficient float64 `json:"backscatter_coefficient"`
Average int `json:"average"`
LaunchCableLengthM float64 `json:"launch_cable_length_m"`
}
TORSettings captures the relevant OTDR measurement settings
type TracePoint ¶
type TracePoint struct {
TimeNs float64 `json:"time_ns"`
AmplitudeDB float64 `json:"amplitude_db"`
}
TracePoint is a single data point in the OTDR trace for the report