I am new to Ignition. Just trying to write a custom driver to use TCP connection, periodically poll for new data, and handle new data updates.
I have already used the TCP driver that is part of ignition to connect to my TCP Server. I can connect, write to it and receive data back.
In the Message Tag associated with the TCP driver I can see my data. How do I access this programmatically?
I can write to my TCP server using the Writeable Tag through the Ignition GUI. How do I programmatically do this periodically?
From what I can tell I should be able to use the TCP module then make my own Custom handler module? Or should I write a completely custom TCP module that can access all these Tags and do the polling?
Ok so from my first post "From what I can tell I should be able to use the TCP module then make my own Custom handler module? Or should I write a completely custom TCP module that can access all these Tags and do the polling?"...
You are saying I should just write my own TCP driver? I should just be able to make an OPC UA device that can setup TCP connection and then handle the sending and receiving however I want?
Work from the existing TCP driver and what you have access to inside the standard Ignition environment via scripting.
Start totally from scratch and implement your own TCP communication stack and integrate it into Ignition as a module.
You're describing an option 3 that's sort of in the middle of the two in theory, using a module to dive deeper in the internals of an existing module. In practice, this is actually going to be substantially more complicated than either of the other two options.
I am setting up my own TCP Client driver using the OPC UA device example. I added a new class and call it to connect to my TCP server.
This may seem like a silly question but how do I know what is going on in my class? like how do I print or log and where do I see those logs? I do not see any logging in the OPC UA device example.
I tried this System.out.println("Just connected to " + socket.getRemoteSocketAddress()); but if it does print somewhere I do not know where it is printing. I looked at the console in the design studio.
I just can not seem to find easily accessibly information on the ignition platform.
Writing to standard output goes to the wrapper log files on the Ignition Gateway. Using a Logger instance will go to both wrapper log files and the logs in the gateway web interface.
You’re in over your head being new to Ignition and diving into the under-documented module SDK at the same time.
We have a software department at our company that usually writes our GUIs. We go into high security level places so none of our stuff can be connected to the internet. SO our GUIs are not web based. We had a customer want a web based application. I can throw one up in react in no time but we had a person with almost zero software background pick this so he could implement it.
Now that we need the Ignition web app to interact with our system they brought in the Software team. So we need to make a driver that allows that interaction. So I have never used Ignition until developing this driver. I am not sure anyone advised it from your side.
Ok, I'm just trying to go back to step 0 here and make sure this is the right thing to be doing. Developing a module is not part of the standard Ignition user experience, so it's pretty unusual right from the start.
It's possible the standard TCP driver could be made to work, but without knowing more about the protocol it's hard to say. The most common thing for Ignition to communicate with are PLCs via some native protocol we support or by OPC UA; the capabilities of the TCP driver are fairly limited. It's not meant to be build-your-own generic protocol thing, it's mostly meant for receiving periodic data from barcode scanners or scales.
Is there anything you can share about this protocol? Maybe a custom driver is the right move, or maybe it can be done via the existing driver, or maybe just from Ignition's scripting.
So we are not interacting with PLCs at all in this scenario. We have a Server that runs all of our software. It has has a TCP server on it that can handle and commands needed for the system. It is a Get/Set Control that we custom made. So the data has to be pulled (Get) from it and then parsed or sent to it (Set). It is different variable to Get and Set every time so we need a handler that can interpret what has come in or is going out and update the relevant Tags.
Is it truly bare TCP, or a higher level protocol like HTTP or REST? Do you need a persistent connection, or can you just retrieve data at an interval and push data to it event-driven?
I have created my own TCP driver starting with the OPC UA device example and modifying it. So thanks to your help and guidance on where to start. It seems to do everything I need of it.
I have now run into what may be an issue. I have been making and testing the driver with 20 Tags. Now that I am connecting it to our system we have many more Tags than that. When the UI starts it reaches out to our system for a list of the Tags and their data. It then creates and initializes the Tags.
Over a certain number of Tags and my periodic function I use for polling just stops firing. I can use the OPC Quick Client to write to my Tags and send that change over TCP to our system. So that continues to work. If I change something on my system side however I never get the update because the periodic polling stops being called.
Here is how a start my period in the onStartup function..
try {
deviceContext.getGatewayContext().getExecutionManager().register(getClass().getName(), TASK_NAME, this::poller, 2000);
logger.info("TCP module started.");
} catch (Exception e) {
logger.error("Error starting up TCP poller.", e);
}
I have been messing with it but so far not understanding why my period is stopping. Somewhere around 100/200 Tags this starts happening. We have many more Tags than that.