-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
running with no results #6
Comments
Hi Jiadalee, Thanks for reaching out. The main result that the current version of the code produces is a csv file in the |
Hi Jeff: No. Basically, I wrote the 'my_swmm_mpc.py'file and created a 'result' folder. After that, I run my_swmm_mpc.py in Linux system. This shows running is successful but there is nothing in the 'results 'folder. Can you help me check the 'my_swmm_mpc.py' file? I can share it with you. |
Hi Jeff: What does 'To add to the path, add this line to your .bashrc' mean? Is .bashrc a file? |
Hi @Jiadalee , I can definitely look at your |
Thanks!. I added 'print(MPC is great)'at the end of the my_swmm_mpc.py file. So the output to my shell is only'MPC is great'. I didn't see any info about GA generators. I'm wondering if there are problems in the setting-up before running. Below is the my_swmm_mpc codes: from swmm_mpc import run_swmm_mpc input_file = "/uufs/chpc.utah.edu/common/home/u1147017/RL/flux_version_system_run/swmm_mpc/swmm_mpc/sample.inp" target_depth_dict = {'St1':{'target':1, 'weight':0.1}, 'St2':{'target':1.5, 'weight':0.1}} def main(): |
How long does it take to run that? |
just two seconds. Very short |
Hmm. When I run it, it usually takes at least 10 minutes. Where in the above code do you have your print statement? I don't see it. Also, do you mind using the markdown code block feature so it's easier to read? |
Hi: No problem! Jiada |
Can I email this code to you? |
Sure. You can email me OR maybe it would be easier to send on Research Gate. I just replied to your thread about sharing the paper. Let me know if that works. If not, I can give you my email address. |
Just got your code file. Which version of Python are you running? if _name_ == "_main_": What I think you need to have is if __name__ == "__main__": (add another underscore before and after |
underscore to 'nam'e was also added .. |
from swmm_mpc import run_swmm_mpc
input_file = "/uufs/chpc.utah.edu/common/home/u1147017/MPC/swmm_mpc/swmm_mpc/sample.inp"
control_horizon = 1. #hr
control_time_step = 900. #sec
control_str_ids = ["ORFICE R1", "ORIFICE R2"]
results_dir = "/uufs/chpc.utah.edu/common/home/u1147017/MPC/swmm_mpc/swmm_mpc/results/"
work_dir = "/uufs/chpc.utah.edu/common/home/u1147017/MPC/swmm_mpc/swmm_mpc/"
ngen = 4
nindividuals = 300
target_depth_dict = {'St1':{'target':1, 'weight':0.1}, 'St2':{'target':1.5, 'weight':0.1}}
def main():
run_swmm_mpc(input_file,
control_horizon,
control_time_step,
work_dir,
results_dir,
target_depth_dict = target_depth_dict,
ngen = ngen,
nindividuals = nindividuals
)
if __name__ == "__main__":
main() |
Okay. I've only been running this on Python 2.7. I haven't tried on Python 3. So I would first suggest to try running on Python 2.7. After that, I'm still a little unsure that it is running at all. Could you put a print statement in your code? like this: def main():
run_swmm_mpc(input_file,
control_horizon,
control_time_step,
work_dir,
results_dir,
target_depth_dict = target_depth_dict,
ngen = ngen,
nindividuals = nindividuals
)
print 'yep. my code is running'
if name == "main":
main() |
Sure! Let me have a try |
Sorry. I got the same error. ... Actually, I double checked the codes like swmm_mpc.py and run_ea.py file. I found it seems they are written in Python 3 since they use syntax such as print (' xxx ') but not print ' '. If so, I think running them in Python 3 is a correct way. Can I run these codes in Windows system? If so, how should I do? Thanks Jiada |
Ok, I fixed this local PC 'deap' problem of swmm_mpc. So here comes the same question just same as I run it in Linux system: I can run it but no output in 'results' folder..... |
Currently, running on Windows is not supported. |
I am trying your code on my computer to see if I can reproduce the behavior your seeing |
@Jiadalee, I ran your code and found a couple problems.
After changing all those thing, I got it to work. |
Thanks. I will check it out. |
I modified my codes. This time I got a log file in my 'results' folder. I passed this file to you via researchgate |
Oh. I fixed the last question Here comes another one: when I include the if_name_...line inside the main() function, then, I run the codes. Finally, there is no error and I also got a newly-produced .inp file which is called 'simple_processed'. However, nothing in the results folder.... |
I can get a new .rpt file now after running it in python3 |
Awesome. So you are getting it to run. That is actually a known bug with a simple fix that I've neglected to push. I will push that today. |
I just pushed the commit that should fix that. After you run the code, it should update the control rules of the |
I'm testing it now. |
Yes. It basically can run in the Linux system now. |
I just ran it with the latest commit and there was no error. Pls let me know if you still have an error. |
so you added a line |
Hi yes. If you just make the changes from this commit in your code, it should work: 3dd16c6 . Let me know if that makes sense. |
And that's cool you got it to run in Python3. What changes did you have to make? |
Hi Jeff: Sorry for the late reply. Basically, I modified the tabs and indentations. I will send you the updated scripts for running in Python3 Linux system soon. |
Dear Authors,
|
@DangMH-TLU It seems the working directory is not correct. Can you introduce which programming environment are you using and how did you navigate to your working dir? |
Hi Jiadalee, |
Hi @DangMH-TLU - sorry for the slow reply. I think your error means that you haven't installed swmm5 correctly or it's not in your path. Did you follow this step in the readme? https://github.com/UVAdMIST/swmm_mpc#2-install-epaswmm5 @bdb3m - didn't you have a similar problem? Were you able to fix that? |
@jsadler2 I'm fuzzy on the details since it's been a while but that sounds right. I'll see if I can find anything in my notes. @DangMH-TLU I hope jsadler2's response can help you get it working! |
@jsadler2 : Thank you very much. I fixed sucessfully the error which originated from the wrong working directory in the .bashrc file. Again, thank you very much! |
@bdb3m Thank you very much! |
Glad you got it working! |
Hi :
I can run your codes but I didn't get any results. Have you ever encounter this problem?
The text was updated successfully, but these errors were encountered: