Using third party libraries with ignition tags as variables

I have process that requires me to use steamtables (thermodynamics) to calculate heat consumption in my system using tag values from my plc. I need the calculations done in realtime. If I install pyXSteam to the C:\Program Files\Inductive Automation\Ignition\user-lib\pylib> I get this error:

Could not import runpy module
Traceback (most recent call last):
  File "<frozen runpy>", line 14, in <module>
  File "<frozen importlib.machinery>", line 3, in <module>
ModuleNotFoundError: No module named 'importlib._bootstrap'

Is there a way I run the script externally or within Ignition using the library while using tag values as input variables to the script?

You may not have all the dependencies that pyXSteam requires. Or that library is expecting python3 when Ignition is using Jython2.7

specifically
image

You should consider using @bmusson's free 3rd party module for this task. Part of his Embr project:

Look at the "Releases" in the right sidebar.

4 Likes

Yup, this should have everything you need. Here’s the direct link to the docs:

5 Likes

Thanks a lot @pturmel and @bmusson

1 Like

@bmusson there seems to be a configuration issue when I use the expression examples in the readme file.


image

Check the tag's diagnostics. Click this icon on the top right of the tag popup window:
image

This will give you more details:



The function seems fine from the expression side. What could I be doing wrong?

Did you install @bmusson's module ?
The functions listed in the readme are part of his module, they are NOT built-in.

The diagnostic message "Unknown function: 'if97'" suggests that you did not install the module, or that it wasn't installed properly.

1 Like

Yeah, I have the module installed.
If I add an expression binding to a label component using the same function everything works fine. I am only experiencing the problem when I use it in an expression type tag.

I'm not sure that's relevant for expressions, but that sounds like global scripting project issues.

Do you have a GSP configured ? You can find this on your gateway page, under config -> gateway settings.

It's not configured

Try configuring it (just put the name of your project) and see if it changes anything.

Nothing has changed.

Can you restart your gateway?

1 Like

restart gateway after filling that in

Everything works fine after restarting the gateway.
Thank you.

1 Like