Hello everybody,
I am trying to use a DWSim-internal Python Script to adjust a splitter Unit-Operation. The calculation is running without any problems, but after calculating a new split-ratio and setting it to the splitter I can't solve/run the flowsheet again. By using "Flowsheet.RequestCalculation(None, False)" the warnings "Dynamic Mode is currently enabled" and "The calculator is busy, please wait..." occure, but nothing happens. By using "Flowsheet.SolveFlowsheet2()" I get the error "Traceback (most recent call last)".
I noticed that everything seems to work well when I activate an "old" controllerblock. (Meanwhile it is replaced by a Script)
Attached you can find my Flowsheet. I am using version 8.8.2. The relevant script is called MVRMassflow. I added it in a .txt-file as well.
Hello Daniel,
thank you for your reply.
Unfotunately both methods didn't work for me. I tried "Flowsheet.RequestFlowsheetCalculation(None, True)" as well as "Flowsheet.RequestCalculationAndWait()". Both times I get the error "Traceback (most recent call last)".
When using "Flowsheet.RequestCalculation2(True)" and "Flowsheet.RequestCalculation3(None, True)" Warning is again "Dynamic Mode is currently enabled" and "The calculator is busy, please wait..." and nothing happens.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I saw your script. I never expected someone to do calls to the flowsheet solver right after it has finished... I added the "not busy" setter right after running the solver finished scripts!
It is because adjustment of the split ratio requieres calculation of the whole flowsheet again. I also tried to use the same script after calculating the last Stream, so before the solver finished, but the same problems occured. Maybe you know another way expect from using an external python-script for DWSIM-Automation. This would have been my next try.
However, it worked the way you described in your previous post with one small adjustment:
Hello everybody,
I am trying to use a DWSim-internal Python Script to adjust a splitter Unit-Operation. The calculation is running without any problems, but after calculating a new split-ratio and setting it to the splitter I can't solve/run the flowsheet again. By using "Flowsheet.RequestCalculation(None, False)" the warnings "Dynamic Mode is currently enabled" and "The calculator is busy, please wait..." occure, but nothing happens. By using "Flowsheet.SolveFlowsheet2()" I get the error "Traceback (most recent call last)".
I noticed that everything seems to work well when I activate an "old" controllerblock. (Meanwhile it is replaced by a Script)
Attached you can find my Flowsheet. I am using version 8.8.2. The relevant script is called MVRMassflow. I added it in a .txt-file as well.
Try calling
so your code waits for the flowsheet to solve. You could also do
but the first method is better as it will return a list of errors, if any.
Hello Daniel,
thank you for your reply.
Unfotunately both methods didn't work for me. I tried "Flowsheet.RequestFlowsheetCalculation(None, True)" as well as "Flowsheet.RequestCalculationAndWait()". Both times I get the error "Traceback (most recent call last)".
When using "Flowsheet.RequestCalculation2(True)" and "Flowsheet.RequestCalculation3(None, True)" Warning is again "Dynamic Mode is currently enabled" and "The calculator is busy, please wait..." and nothing happens.
I saw your script. I never expected someone to do calls to the flowsheet solver right after it has finished... I added the "not busy" setter right after running the solver finished scripts!
You can try this
at the top of your script.
It is because adjustment of the split ratio requieres calculation of the whole flowsheet again. I also tried to use the same script after calculating the last Stream, so before the solver finished, but the same problems occured. Maybe you know another way expect from using an external python-script for DWSIM-Automation. This would have been my next try.
However, it worked the way you described in your previous post with one small adjustment:
I used this and the following method:
Thank you very much!