library(pipenostics)
## It is possible to run without specification of argument values:
m325tracebw()
## Consider isomorphic representation of District Heating Network graph:
DHN <- pipenostics::m325testbench
DHN$d <- 1e3*DHN$d # convert [m] to [mm]
## When tracing large network graphs put screen log to file
output <- do.call("m325tracebw", c(as.list(DHN), verbose = TRUE))
## Distinct options for opinion aggregation lead to distinct traced
## temperature and pressure:
## * When aggregation is by mean:
output_mean <- do.call(
"m325tracebw", c(as.list(DHN), verbose = FALSE, opinion = "mean")
)
## * When aggregation is by median:
output_median <- do.call(
"m325tracebw", c(as.list(DHN), verbose = FALSE, opinion = "median")
)
## The differences between aggregations should be:
aggregation_differences <- c(delta_t = 0.03732, delta_p = 0.00139, delta_g = 0)
print(aggregation_differences)
## Check:
stopifnot(
round(
subset(
output_mean,
node == 13 & aggregation == "median",
c("temperature", "pressure", "flow_rate")
) - subset(
output_median,
node == 13 & aggregation == "median",
c("temperature", "pressure", "flow_rate")
),
5
# difference between aggregation options
) == aggregation_differences
)
## It is possible to process partially measurable District Heating Network:
## * Simulate lack of temperature and pressure sensors:
DHN[c(7, 10, 21, 24), c("temperature", "pressure")] <- NA_real_
## Trace thermal-hydraulic regime
output <- do.call("m325tracebw", c(as.list(DHN)))
print(output)
Run the code above in your browser using DataLab