DanWBR / dwsim

DWSIM is a Steady-State and Dynamic Sequential Modular Chemical Process Simulator for Windows, Linux and macOS.
https://dwsim.org
GNU General Public License v3.0
297 stars 96 forks source link

Make DWSIM visible while running DWSIM throught automation #119

Closed jmacias552 closed 2 years ago

jmacias552 commented 3 years ago

While controlling DWSIM with Automation is not possible to make it visible and do manual interaction. It will be nice to have a Visible property that will make visible or invisible DWSIM while running.

In DWSIM.Automation there is already a property called Visible but its value is False and there is no way to set to True.

DanWBR commented 3 years ago

@jmacias552 just to clarify some doubts I have, what is the purpose of making the flowsheet visible?

jmacias552 commented 3 years ago

Daniel, the reason is because I'm designing a program that uses DWSIM as a Chemical Engineering simulation tool. For debugging purposes it is better to have DWSIM visible, and if there is a problem see where it was. I'm worried about convergence problems, windows screens that get blocked and so on.

My program will pass data to DWSIM, ask for solving and monitor its output. The user normally will not have to interact with the program but while running in visible if there is a problem is very straightforward to find the issue.

I have done the same thing in other software like HYSYS, UNISIM and I find it very useful to have it in visible mode. I am being able to manually modify things while being controlled by another program and the solving routine has ended. I don't know if something similar can be done with DWSIM. You have already done wonderful work.

The property (Visible) is already available in Automation but it seems that it is not implemented.

Thanks,

Jose Macías

El jue, 25 feb 2021 a las 21:33, Daniel Medeiros (notifications@github.com) escribió:

@jmacias552 https://github.com/jmacias552 just to clarify some doubts I have, what is the purpose of making the flowsheet visible?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DanWBR/dwsim6/issues/119#issuecomment-786242373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWYWER25HVTJL5ZWBVJFP3TA262VANCNFSM4YHGUPVA .

-- Jose Macías-Hernandez Chemical Engineering Dept. University of La Laguna Tenerife SPAIN jmacias@ull.edu.es +34649741084

DanWBR commented 3 years ago

@jmacias552 I don't know how to do to control a flowsheet from the outside... once you ask to display the flowsheet, the thread stops executing the subsequent code, waiting for you to close the window... I'll have to find a way of circumventing this behavior.

jmacias552 commented 3 years ago

@DanWBR , The way I run HYSYS is using Dispatch from Win32com api.

The code is something like


from win32com.client import Dispatch

Create the HYSYS COM object and open HYSYS V10.0

objeto Application

hysysApp = Dispatch("HYSYS.Application.V10.0") hysysApp.Visible = True

Open the simulation case.

directorio = "C:\SimulacionesPruebas"

Objeto SimulationCase

hysysCase = hysysApp.SimulationCases.Open(directorio + "\Crude Oil Fractionation Facility.hsc")

hysysCase = hysysApp.SimulationCases.Open(directorio + "\ISTMO32 -CDU overhead sour water linked JFO_05_Test02.hsc")

hysysCase.Visible = True


And then, I am able to control via COM automation

I have tried to do the same with DWSIM but I don't know the application name in the windows registry.

Probably the program has to be compiled in multiThread option.

I hope it helps

Regards,

Jose Macias

DanWBR commented 3 years ago

@jmacias552 the way that HYSYS does its automation is very different from DWSIM's... in HYSYS you are automating the application itself while in DWSIM you're manipulating the underlying flowsheet and its objects without the need to "open" the app.

AdrianDietz commented 3 years ago

Hello, one of the application of automation is OTS, one (or several) executable represents the dcs/plcs an an independent thread carry out the dynamic simulation, accessing the model allows representing field operator actions. I have done this with excel and hysys, and many others...