Hello!
I have installed Mono and DWSIM version 6.2.2-amd64 as deb-package on Ubuntu 20.04.
DWSIM works well if i run it as an application.
However, when I try to use the API, I get an error during the call method Automation().
NullReferenceException Traceback (most recent call last)
<ipython-input-1-c13c6f6f6a76> in <module>
26 from DWSIM import Interfaces, Automation
27
---> 28 process = Automation.Automation()
29 process = process.LoadFlowsheet("home/raf/Gas.dwxmz")
30 flowsheet = Interfaces.IFlowsheet(process)</module></ipython-input-1-c13c6f6f6a76>
NullReferenceException: Object reference not set to an instance of an object
at Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.get_DirectoryPath () [0x00001] in <4240dd9f28434ace833cfdaa17202e70>:0
Using Automation2() instead Automation() causes the Python's kernel to crash.
The similar code works well for Windows 10.
What am I doing wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Automation2() works on macOS, and it should also work on Linux. Do you have more info on the crash? Did you try calling the Automation2() from a C# code?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When i run my python script, i also get multiple files in my project directory kind of "mono_crash.mem.38580.1.blob". I found their content to be meaningless.
I called the method from C# code and got no errors.
However, I had to copy the executable file directly to dwsim directory where dll's are located.
Specifically, my elementary C# code:
This compiles (with links to DWSIM.Automation.dll and DWSIM.Interfaces.dll), but if I run the executable from my home directory, I get an error:
$ mono DWSIM_test.exe
""" Unhandled Exception:
System.TypeLoadException: Could not load type of field 'DWSIM.Automation.Automation2:app' (0) due to: Could not load file or assembly 'Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'DWSIM.Automation.Automation2:app' (0) due to: Could not load file or assembly 'Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. """
After copying my executable file to the directory with dll's (/usr/local/lib/dwsim/) and launched it from the dwsim directory - it's works well.
I suspect there is some problem with dependency resolution Mono on Linux.
Is it possible to somehow configure the project so that it can be loaded independently?
Well, I also probably using libraries incorrectly...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
It looks like this issue is pythonnet related. Similar crashes occur not only for me.
I am using .net to interact with DVSIM API now.
I would like to clarify the following.
When I run DWSIM using command in terminal:
:~$mono/usr/local/lib/dwsim/DWSIM.exe
I get the "classic UI" and I cannot calculate anything even by running the sample.
At this point in the terminal, I see:
Could not set X locale modifiers
Gtk-Message: 20:03:48.402: Failed to load module "canberra-gtk-module"
Error checking latest version: System.Net.WebException: Error: ProtocolError
at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x00165] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.WebOperation.Run () [0x0009a] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x00094] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.HttpWebRequest.GetResponse () [0x00016] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.WebClient.DownloadBits (System.Net.WebRequest request, System.IO.Stream writeStream) [0x000e6] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.WebClient.DownloadDataInternal (System.Uri address, System.Net.WebRequest& request) [0x00061] in <3d97dda773a54430b892e1d794e5d921>:0
at System.Net.WebClient.DownloadString (System.Uri address) [0x00011] in <3d97dda773a54430b892e1d794e5d921>:0
at (wrapper remoting-invoke-with-check) System.Net.WebClient.DownloadString(System.Uri)
at DWSIM.SharedClasses.UpdateCheck.CheckForUpdates () [0x00048] in <b97a4310545f46448b1501cf25ada8e5>:0 [12/7/2020 8:04:06 PM] resource pool: create resource pool... [12/7/2020 8:04:06 PM] resource pool: create resource pool... [12/7/2020 8:04:08 PM] resource pool: font resource group added. font groups: 1</b97a4310545f46448b1501cf25ada8e5>
But when I run DWSIM using command in terminal just like:
:~$dwsim
I get "Cross-Platform UI" and when i try to simulate something - it works well!
Also, when I use the saved .dwxmz file from the classic UI version in my .net application, using code like
I get in terminal:
"""Solving Flowsheet, please wait...
System.Exception: ABS-01: UnsupportedSolver ---> System.Exception: UnsupportedSolver
at DWSIM.UnitOperations.UnitOperations.Column.Calculate (System.Object args) [0x019ca] in <84d6452e36fa4cc494ef5f2714d7c7d0>:0 ...
System.Exception: ABS-01: UnsupportedSolver ---> System.Exception: UnsupportedSolver ...
etc..."""
However, when I use the saved .dwxmz file from the cross-platform UI version, it works fine!
Does the format .dwxmz contain information about the type of UI?
What is the fundamental difference between classic UI and cross-platform UI versions? Do both work well on Linux, or are there any features and preferences for Linux?
I will be glad to receive any information.
Thanks for your hard work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a better way to getting and setting values?
About using ChemSep on Linux...
When I run sample "Natural Gas Processing Unit with Turbo-Expansion (Classic UI - Windows only).dwxmz" on Linux (cross-platform UI) and Windows (classic UI), the sample is calculated successfully for both OS, although on Linux there is no access to CAPE-OPEN interface.
- Can I set these variables via C # API on Linux?
If the schema is evaluated for both operating systems, is the calculation correct for both?
- Generally, does DWSIM С# API on Linux have fundamental restrictions to using ChemSep?
If i using only DWSIM C# API - Is it possible to do, using classic UI on Windows, fundamentally, what cannot be done on Linux using cross-platform UI?
Last edit: Dmitry 2020-12-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I have installed Mono and DWSIM version 6.2.2-amd64 as deb-package on Ubuntu 20.04.
DWSIM works well if i run it as an application.
However, when I try to use the API, I get an error during the call method Automation().
For instance, my python code is:
After executing this script, I get:
NullReferenceException Traceback (most recent call last)
<ipython-input-1-c13c6f6f6a76> in <module>
26 from DWSIM import Interfaces, Automation
27
---> 28 process = Automation.Automation()
29 process = process.LoadFlowsheet("home/raf/Gas.dwxmz")
30 flowsheet = Interfaces.IFlowsheet(process)</module></ipython-input-1-c13c6f6f6a76>
NullReferenceException: Object reference not set to an instance of an object
at Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.get_DirectoryPath () [0x00001] in <4240dd9f28434ace833cfdaa17202e70>:0
Using Automation2() instead Automation() causes the Python's kernel to crash.
The similar code works well for Windows 10.
What am I doing wrong?
Automation2() works on macOS, and it should also work on Linux. Do you have more info on the crash? Did you try calling the Automation2() from a C# code?
Thanks a lot for the quick response!
When i run my python script, i also get multiple files in my project directory kind of "mono_crash.mem.38580.1.blob". I found their content to be meaningless.
I called the method from C# code and got no errors.
However, I had to copy the executable file directly to dwsim directory where dll's are located.
Specifically, my elementary C# code:
This compiles (with links to DWSIM.Automation.dll and DWSIM.Interfaces.dll), but if I run the executable from my home directory, I get an error:
$ mono DWSIM_test.exe
""" Unhandled Exception:
System.TypeLoadException: Could not load type of field 'DWSIM.Automation.Automation2:app' (0) due to: Could not load file or assembly 'Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'DWSIM.Automation.Automation2:app' (0) due to: Could not load file or assembly 'Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. """
After copying my executable file to the directory with dll's (/usr/local/lib/dwsim/) and launched it from the dwsim directory - it's works well.
I suspect there is some problem with dependency resolution Mono on Linux.
Is it possible to somehow configure the project so that it can be loaded independently?
Well, I also probably using libraries incorrectly...
Try playing with System.IO.Directory.SetCurrentDirectory()
You can also setup an Assembly Resolver like I've did in here: https://github.com/DanWBR/DWSIM.Automation.Test.macOS/blob/master/DWSIM.Automation.Test.macOS/Program.cs
Hello!
It looks like this issue is pythonnet related. Similar crashes occur not only for me.
I am using .net to interact with DVSIM API now.
I would like to clarify the following.
When I run DWSIM using command in terminal:
I get the "classic UI" and I cannot calculate anything even by running the sample.
At this point in the terminal, I see:
But when I run DWSIM using command in terminal just like:
I get "Cross-Platform UI" and when i try to simulate something - it works well!
Also, when I use the saved .dwxmz file from the classic UI version in my .net application, using code like
I get in terminal:
"""Solving Flowsheet, please wait...
System.Exception: ABS-01: UnsupportedSolver ---> System.Exception: UnsupportedSolver
at DWSIM.UnitOperations.UnitOperations.Column.Calculate (System.Object args) [0x019ca] in <84d6452e36fa4cc494ef5f2714d7c7d0>:0 ...
System.Exception: ABS-01: UnsupportedSolver ---> System.Exception: UnsupportedSolver ...
etc..."""
However, when I use the saved .dwxmz file from the cross-platform UI version, it works fine!
Does the format .dwxmz contain information about the type of UI?
What is the fundamental difference between classic UI and cross-platform UI versions? Do both work well on Linux, or are there any features and preferences for Linux?
I will be glad to receive any information.
Thanks for your hard work.
Are you running the latest version (6.3.6)?
https://sourceforge.net/projects/dwsim/files/DWSIM/DWSIM%206.3/Update%206/dwsim_6.3.6-amd64.deb/download
I used an older version (5.x.x), the newest version is much more stable, thanks!
I access to spreadsheet cells from C# on Linux like this:
and I get access to properties schematic elements like this:
Is there a better way to getting and setting values?
About using ChemSep on Linux...
When I run sample "Natural Gas Processing Unit with Turbo-Expansion (Classic UI - Windows only).dwxmz" on Linux (cross-platform UI) and Windows (classic UI), the sample is calculated successfully for both OS, although on Linux there is no access to CAPE-OPEN interface.
- Can I set these variables via C # API on Linux?
If the schema is evaluated for both operating systems, is the calculation correct for both?
- Generally, does DWSIM С# API on Linux have fundamental restrictions to using ChemSep?
If i using only DWSIM C# API - Is it possible to do, using classic UI on Windows, fundamentally, what cannot be done on Linux using cross-platform UI?
Last edit: Dmitry 2020-12-10