Files
lec-sdr/hw4.Rmd
2026-05-17 09:40:05 +02:00

56 lines
2.0 KiB
Plaintext

# HW 4
Write an R script to calculate the output of the Klobuchar model.
Provide a GUI means for entering input data, and the name and the
path to navigation message file with coefficients of the Klobuchar
model. Load the coefficients of the Klobuchar model from the given
RINEX n file using a dedicated function in the R script. Provide a
feature to calculate the value of the ionospheric delay of the GPS
signal during 24 hours of a given day, in 1-minute increments, with
the given coefficients of the ionospheric model. Verify the correctness
of the algorithm implementation with a given numerical example. After
that, conduct a 24-hour simulation of the GPS ionospheric delay in 1-
minute increments for the position φu = 45.33709°, λu = 14.42496°, E
= 90°, A = 180°. Store the estimated 24-hour simulation data set in a
dedicated file on the local disc.
The problem description, method, R script and implementation results
should be presented in a single HTML document, which should be
sent to the subject teacher's e-mail by May 21, 2026 at 23:59 CEST.
```{r read-file}
# Function to extract Klobuchar parameters from a RINEX navigation file
extract_klobuchar_parameters <- function(rinex_file) {
ion_alpha <- numeric(4)
ion_beta <- numeric(4)
# Read the file line by line
con <- file(rinex_file, "r")
while (length(line <- readLines(con, n = 1)) > 0) {
if (grepl("ION ALPHA", line, fixed = TRUE)) {
# Extract the 4 numeric values from the line
ion_alpha <- unlist(strsplit(line, "\\s+"))[2:5]
}
if (grepl("ION BETA", line, fixed = TRUE)) {
# Extract the 4 numeric values from the line
ion_beta <- unlist(strsplit(line, "\\s+"))[2:5]
}
# Stop reading if we've reached the end of the header (END OF HEADER)
if (grepl("END OF HEADER", line, fixed = TRUE)) {
break
}
}
close(con)
# Return the parameters as a named list
list(
ION_ALPHA = ion_alpha,
ION_BETA = ion_beta
)
}
rinex_file <- "brdc0930.26n"
klobuchar_params <- extract_klobuchar_parameters(rinex_file)
print(klobuchar_params)
```