iccsa-21-wind

git clone https://git.igankevich.com/iccsa-21-wind.git
Log | Files | Refs

commit 2af5f2c289186d746643bb2bcd0c4132bfe7f109
parent 0fda1b187f09aed54ecbbb5c3268e88d462da040
Author: Ivan Gankevich <i.gankevich@spbu.ru>
Date:   Tue, 27 Apr 2021 00:14:52 +0300

New wind data.

Diffstat:
R/anal.R | 2++
R/vtestbed.R | 46+++++++++++++++++++++++++++++++++++-----------
samples/vtestbed/wind_data | 2++
3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/R/anal.R b/R/anal.R @@ -300,6 +300,8 @@ cumulative_data <- foreach (timestamp=timestamps, .combine=rbind, .errorhandling # "direction_rmse","direction", # "acf_x_rmse","acf_y_rmse","acf_z_rmse")] write.table(cumulative_data, "build/daily-rmse", row.names=FALSE, quote=FALSE) +print("Mean speed") +print(mean(cumulative_data$speed)) #print(cumulative_data) print(summary(cumulative_data)) model <- nls(x_sd ~ a*speed+b, diff --git a/R/vtestbed.R b/R/vtestbed.R @@ -1,12 +1,32 @@ source("R/common.R") source("R/distributions.R") +delevel <- function (x) { + x - min(x) +} + # the timestamp against which the simulation output is validated time_start = 1616936400 time_end = time_start time_delta = 60*60*2 -data <- read.table("samples/vtestbed/statistics.log", sep=",", header=TRUE) +#data <- read.table("samples/vtestbed/statistics.log", sep=",", header=TRUE) +data <- read.table("samples/vtestbed/wind_data", sep=",", header=TRUE) +#timestamps <- seq(1,floor(max(data$time))) +##print(timestamps) +## resample the data to 1 second period +#new_data <- data.frame( +# time=timestamps, +# wind_velocity_x = approx(data$time, data$wind_velocity_x, timestamps)$y, +# wind_velocity_y = approx(data$time, data$wind_velocity_y, timestamps)$y, +# wind_velocity_z = approx(data$time, data$wind_velocity_z, timestamps)$y +#) +#data = new_data + +# select every 10th point +#data <- data[seq(1,nrow(data),4000),] + +data$time = seq(1,nrow(data)) x_mean = -2.439 y_mean = -2.158 z_mean = -1.367 @@ -57,9 +77,13 @@ do_fit_direction <- function (direction, suffix="no-suffix") { dist } -do_fit_acf <- function (velocity, axis="x", suffix="no-suffix") { +do_fit_acf <- function (velocity, axis="x", suffix="no-suffix", delevel=FALSE) { v = velocity model <- fit_velocity_acf(v, axis=axis, plot=FALSE, write=FALSE); + if (delevel) { + model$actual = delevel(model$actual) + model$estimated = delevel(model$estimated) + } plot(model$lag, model$actual, xlab='Lag', ylab=paste('ACF ', axis, sep="")) lines(model$lag, model$estimated, col='red', lwd=2) path <- file.path('build', 'vtestbed', suffix) @@ -87,9 +111,9 @@ banner("Anemometer") data_real <- select_samples(time_start, time_delta) dist_speed_real <- do_fit_velocity(data_real$speed, suffix="anem") dist_direction_real <- do_fit_direction(data_real$direction[data_real$direction<=0], suffix="anem") -model_acf_x_real <- do_fit_acf(data_real$x[data_real$x<=0], axis="X", suffix="anem") -model_acf_y_real <- do_fit_acf(data_real$y[data_real$y<=0], axis="Y", suffix="anem") -model_acf_z_real <- do_fit_acf(data_real$z[data_real$z<=0], axis="Z", suffix="anem") +model_acf_x_real <- do_fit_acf(data_real$x[data_real$x<=0], axis="X", suffix="anem", delevel=TRUE) +model_acf_y_real <- do_fit_acf(data_real$y[data_real$y<=0], axis="Y", suffix="anem", delevel=TRUE) +model_acf_z_real <- do_fit_acf(data_real$z[data_real$z<=0], axis="Z", suffix="anem", delevel=TRUE) # https://stackoverflow.com/questions/27455948/in-r-whats-the-simplest-way-to-scale-a-vector-to-a-unit-vector normalise <- function(x) { @@ -116,15 +140,15 @@ lines(dist_direction_real$x, normalise(dist_direction_real$estimated_density), c plot(model_acf_x$lag, model_acf_x$actual, col='red', xlab='Lag', ylab="ACF X") lines(model_acf_x$lag, model_acf_x$estimated, col='red', lwd=2) -points(model_acf_x_real$lag, model_acf_x_real$actual, col='blue') -lines(model_acf_x_real$lag, model_acf_x_real$estimated, col='blue', lwd=2) +points(model_acf_x_real$lag, (model_acf_x_real$actual), col='blue') +lines(model_acf_x_real$lag, (model_acf_x_real$estimated), col='blue', lwd=2) plot(model_acf_y$lag, model_acf_y$actual, col='red', xlab='Lag', ylab="ACF Y") lines(model_acf_y$lag, model_acf_y$estimated, col='red', lwd=2) -points(model_acf_y_real$lag, model_acf_y_real$actual, col='blue') -lines(model_acf_y_real$lag, model_acf_y_real$estimated, col='blue', lwd=2) +points(model_acf_y_real$lag, (model_acf_y_real$actual), col='blue') +lines(model_acf_y_real$lag, (model_acf_y_real$estimated), col='blue', lwd=2) plot(model_acf_z$lag, model_acf_z$actual, col='red', xlab='Lag', ylab="ACF Z") lines(model_acf_z$lag, model_acf_z$estimated, col='red', lwd=2) -points(model_acf_z_real$lag, model_acf_z_real$actual, col='blue') -lines(model_acf_z_real$lag, model_acf_z_real$estimated, col='blue', lwd=2) +points(model_acf_z_real$lag, (model_acf_z_real$actual), col='blue') +lines(model_acf_z_real$lag, (model_acf_z_real$estimated), col='blue', lwd=2) diff --git a/samples/vtestbed/wind_data b/samples/vtestbed/wind_data @@ -0,0 +1 @@ +../../.git/annex/objects/gg/W5/SHA256E-s254118512--1a665e973905d49a30a92ff2d9cf6360ca60c5d7c24edb64a2b521b7d320d446/SHA256E-s254118512--1a665e973905d49a30a92ff2d9cf6360ca60c5d7c24edb64a2b521b7d320d446+ \ No newline at end of file