dleutnant / swmmr

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

Any changes in swmmr package in the last 4-5 months? #49

Closed HamedGhodsi90 closed 1 year ago

HamedGhodsi90 commented 4 years ago

Hi,

I have a question. Did you change the swmmr package in R in the last 4-5 months? I have a reason to ask this question.

Previously, I could run my swmm model in my local computer RStudio and everything was fine when I used read_out() function to read the nodes and links time series. But now, I use the same code, but this function gives me some wrong results. I mean when I use PCSWMM software, I can see the correct results, but when I read_out() my .out file, I don't get the same result.

I do not have permission to share my .inp file. But you can find the .out file in this link. https://github.com/HamedGhodsi90/CSO_Real-Time_Prediction/raw/master/SWMM_online.out

I use this code to see node "100580", "Total inflow" time series:

results <- read_out(file = "SWMM_online.out", iType = 1, object_name = "10058", vIndex = 4)
View(results[[1]][[1]])

when I use this code, the result which is wrong is: 2

But when I use PCSWMM, the result which is right is: 1

Do you have any explanation of why it is happening? it was right previously (maybe a couple of months ago), but now I cannot extract the right results from .out file.

dleutnant commented 4 years ago

Related #48 ?

HamedGhodsi90 commented 4 years ago

I read all comments in issue #48. I think it is related. Can you guide me how to solve this problem considering the following information:

In my own laptop (windows 64bit), I use R version 4.0.2 (2020-06-22), and I get wrong results while I use read_out() function. However, I use AWS (amazon web services) with this configuration: ......... platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
year 2019
month 04
day 26
svn rev 76424
language R
version.string R version 3.6.0 (2019-04-26) .......

And again I get wrong results (even though the R version is 3.6.0). So, Are you sure it is related to the R version? Which version I should use?

I also tried to use an old version of R in my local computer (R 3.6.1) to see if it works, but I get this error: 3

I also tried to follow the steps in https://cran.r-project.org/bin/windows/Rtools/ , and installed Rtools. But I could not follow the next step which is:

.... After installation is complete, you need to perform one more step to be able to compile R packages: you need to put the location of the Rtools make utilities (bash, make, etc) on the PATH. The easiest way to do so is create a text file .Renviron in your Documents folder which contains the following line:

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

You can do this with a text editor, or you can even do it from R like so:

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

..... how can I do this on both my computer and AWS? what is PATH? where should I put this new text .Renviron file?

Any other ways that I can easily solve this problem?

HamedGhodsi90 commented 4 years ago

Updates: I installed and used Rtools, but the problem is still there. Any other ways you can suggest me to solve this problem? (considering my explanation about the R version in both my local computer and AWS) I would follow my question under issue #48

hsonne commented 1 year ago

Hi @HamedGhodsi90, @dleutnant asked me to help him maintain this package. Since the last weeks I worked a lot on the code. I integrated changes that relate to the reading of the SWMM output file. I do all changes on the dev branch of this repository. Would you like to install the package from there:

remotes::install_github("dleutnant/swmmr@dev")

and check if you can read your output file with that version of the package?

With the file that you uploaded, I received the following:

out_file <- normalizePath("~/../Downloads/SWMM_online.out")
results <- swmmr::read_out(file = out_file, iType = 1, object_name = "10058", vIndex = 4)
plot(results$`10058`$total_inflow)

grafik

hsonne commented 1 year ago

Since there was no more reaction, I treat this issue as being solved.