Run Engine for Fortran DLLS

Can Ignition platform act as an engine for Fortran dlls? Ideally, execute the dlls, monitor performance, log errors, sequence it in a proper fashion etc. If not within Ignition, any other partner apps for that?
Thank you for your response.


The Ignition Jython installation supports the standard Python ctypes library. This provides:

ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.

This would allow you to directly call your Fortran DLLs from Jython.

However I am not sure how well this works as this Stack Overflow question Ctypes support in Jython suggest the support may not be the best.

If it does work for you, then this Stack Overflow question Using python-ctypes to interface fortran with python provides a simple example

Jython ctypes does not work. Java JNI is required to actually load DLLs (or *nix shared objects) in Jython.

If you can let us know your use case it may be possible to use a different approach like using interprocess communication .

Exactly. If you have enough expertise, you can write a module and use JNI/JNA to get access to DLLs / SOs. If you know Java, Ignition, and C, there’s an example of JNA here. If you don’t have expertise in all 3 of those things, this could be a tricky route. If there are other options, I’d explore those first.

1 Like

Caveat is that I have no practical experience in doing this, but from my research yesterday I saw that some ctypes functionality was reported as working under Jython. I would assume that the working functionality would still work under the Jython implementation used in Ignition.

When I was looking up JNI I also hit upon JyNI:

JyNI is a compatibility layer with the goal to enable Jython to use native CPython extensions like NumPy or SciPy. This way we aim to enable scientific Python code to run on Jython. Since Java is quite present in industry and Python is more present in science, JyNI will be an important step to lower the costs of using scientific code in industrial environments.

This seems to be a more general way to include DLLs in Jython code. However this seems to be predicated on running the JyNI.jar file as a part of the Jython.jar execution (See JyNI on GitHub) but in addressing my own question on Jython in Ignition, I’m guessing that this is not possible

Thank you for the responses, all. The application is in a closed loop Advanced Process Control (APC) software. The thought is that Ignition already has OPC capability which allows you to get all the I/O information, but then build proprietary modules in Fortran dlls so that there is IP protection. If Ignition could also execute these dlls on command (thus, acting like an engine), then that’s a full solution to build a proprietary closed loop control APC system, while not having to develop the platform side of things.
Please note that the closed loop aspect is the key difference between our use case and above-mentioned ‘simulation’.

To add, developing ‘platform applications’ is a very different skillset for chemical engineers like me. Thus, the request about 3-p solutions to do just that.

Probably the best bet for getting this working would be to also develop an Ignition module to go along with the DLLs that were developed that interfaced with them via JNI or JNA.

There’s nothing built in that’s going to get you there, though.

Or just write your proprietary code in java, delivered as an Ignition module.

Another alternative is to use FORTRAN from python using NumPy (F2PY is a part of NumPy) which interfaces with Ignition using OPC calls or sockets! Presume you will access real time plant I/O data from Ignition to perform Advanced Process Control actions!