dleutnant / swmmr

R Interface for US EPA's SWMM
https://cran.r-project.org/package=swmmr
39 stars 15 forks source link

run_swmm error #37

Closed wujinshi closed 4 years ago

wujinshi commented 4 years ago

hi, all I' m a new user of swmmr. When I want to run the test file, warning messages appeared. Is there any problem with the following code? thanks.


setwd("D:/") library(Rcpp) library(swmmr) library(tidyverse) library(purrr) library(ggplot2) library(broom)

inp_file <- read_inp("D:/Program Files (x86)/R-3.6.1/library/swmmr/extdata/Example1.inp", rm.comment = TRUE)

summary(inp_file) inp_file

inp_subcath <- inp_file$subcatchments inp_subcath

inp_path <- system.file("extdata", "Example1.inp", package = "swmmr", mustWork = TRUE) inp <- read_inp(x = inp_path) inp tmp_rpt_file <- tempfile() tmp_out_file <- tempfile() files <- run_swmm(inp = "D:/Program Files (x86)/R-3.6.1/library/swmmr/extdata/Example1.inp", rpt = tmp_rpt_file, out = tmp_out_file, exec = "D:/Program Files (x86)/EPA SWMM 5.1.013/swmm5.exe", stdout = TRUE, wait = TRUE)

dleutnant commented 4 years ago

Code seems ok. What is the warning message?

wujinshi commented 4 years ago

Code seems ok. What is the warning message?

Warning messages: 1: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="D:/Program Files (x86)/R-3.6.1/library/swmmr/extdata/Example1.rpt": system can not find files. 2: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="D:/Program Files (x86)/R-3.6.1/library/swmmr/extdata/Example1.out": system can not find files

wujinshi commented 4 years ago

Code seems ok. What is the warning message? Are there errors because my file path does not exist .rpt files and .out files? However, how can I have not run the file yet? I do not quite understand this. Can you give me some advice? thanks.

dleutnant commented 4 years ago

Could you please check if you've set the path to your inp file and to your swmm5 executable correctly?

library(swmmr)

inp_file <- system.file("extdata", "Example1.inp", package = "swmmr", mustWork = TRUE)

file.exists(inp_file)
#> [1] TRUE

exec <- "D:/Program Files (x86)/EPA SWMM 5.1.013/swmm5.exe"
file.exists(exec)
#> [1] FALSE

exec <- "/usr/local/bin/swmm5"
file.exists(exec)
#> [1] TRUE

tmp_rpt_file <- tempfile()
tmp_out_file <- tempfile()

run_swmm(inp = inp_file, rpt = tmp_rpt_file, out = tmp_out_file)
#> Argumente 'minimized' und 'invisible' sind nur für Windows

Created on 2019-11-11 by the reprex package (v0.3.0)

dleutnant commented 4 years ago

Does it work now?

wujinshi commented 4 years ago

Does it work now?

Hi, thanks for attention! I run your code in RStudio, the return value as follow:

exec <- "D:/Program Files (x86)/EPA SWMM 5.1.013/swmm5.exe" file.exists(exec) [1] TRUE Does it means that the path of swmm5 executable is correct?

wujinshi commented 4 years ago

Does it work now?

Hi,Mr. Dleutnant Do you have any good suggestions for my model running error? So much thanks to you. Best regard, Jinshi

dleutnant commented 4 years ago

@wujinshi Yes, if you double check with file.exists your path to swmm5.exe should be fine. Also, could you please check that the model itself runs without complication (sometimes paths to rainfall time series need to be updated...), i.e. please run the model with the GUI of EPA's SWMM.

dleutnant commented 4 years ago

any news?