Running Scheduled Scripts

Hi Everybody!

I have a question for you, I hope you can help me.

Can I run a script that executes once a day when an OPC Server is connected? How could I do that?

I have several OPC Servers that will be connected once a day at different times and I want to generate a script to run some queries accesing databases that are located in those OPCServers.

Thank you a lot for your help!


can you give more info on what you mean by connecting to the opc server once per day? typically an opc server is always connected.

anyway, you should be able to use system.opc.getServerState to get the current state.

so you could have a script that runs periodically checking to see the status of the opc server using system.opc.getServerState. If you get a connected you could then run your script. Once your script is finished you could write a 1 to a memory tag that gets set back to 0 every night. If that memory tag = 1 or the opc server state is not equal to connected, then dont run your script.

Thank you a lot for your help :laughing: ! How can I set to 0 a tag every night?

I’ll try to describe you my situation:

I have several computers located in different machines around the world that collect data using Ignition from PLCs during the day.

I want to collect the data from those computers into a server located in my company also using Ignition. To do so, I have to connect the server computer to the other computers through the Internet. However, I cannot have a permanent connection between the server and the other computers so I am planning to do it once a day.

Once I am connected I want to collect the data from the local Databases and transfer it to the server database. The easiest way would be to do it with a transaction group but the connection I have from the server to the other computers is not bidirectional. I mean, I can see the different computers from my company but the computers around the world cannot see me. So I cannot use the store and forward. I have to manually access the local databases with queries and manually write into the server database.

I don’t know if I have explained myself very well…If you have other ideas to be able to transfer the data I would really appreciate your advice!!

Thanks! :smiley:


Hi Laura.

At first blush, I’d say four status flags may do the trick…

  1. Is it time to get data? (example: is it between 8:00 and 9:00)
  2. Has the data already been transferred? (we don’t want to keep doing it over and over again within that window)
  3. Trigger for the transaction group
  4. ACK from the tranaction group

EDIT: If you have 7.7, I think this would be a prime application for SFCs.

Here’s the workflow I’m visualizing. No doubt, it can be streamlined or generally be improved upon… :laughing::

Thank you guys for your help!

I hope I can fix it!