Running Multiple Model Processes
If you are going to run several different Python models in different processes (for example, you might have different modelling teams working on different areas of your plant), you will need to take some extra steps during setup.
Run Each Model From A Different Folder
ModelHost creates some additional files when you run the model. If you try to run several different ModelHost instances in one folder, these files will be overwritten, which might cause difficulties accessing your OPC-UA information.
For this reason, you should always make sure that each Python model file is contained in a separate folder.
Avoid OPC-UA Port Number Collisions
ModelHost starts an OPC-UA server on a port. This defaults to 7332, but when you are running several Python models on the same server, you'll need to ensure that each runs on its own port number.
This us done by setting the uaport property of the ModelHost object, before you call Run()
host = ardimodel.ModelHost() host.ardiurl = "localhost" host.ardisite = "default" host.uaport = 1255