Data logging over various adresses


Andreschrosa

Recommended Posts

:rolleyes:I've come to a point in my system development where I must implement the following:

user specifies IP adresses where various equipments are communicating via modbus RTU.

When I run the sequence to scan the network, parsing the user provided IP list, I noticed it does gets the equipments from the first IP adress, however it duplicates then on the next loop, meaning it dosent change the device IP adress on the fly fast enougth to get a response to Read Slave ID (modbus function 17). This might be solved by a delay inserted in the loop sequence, however a new doubt arised from this:

will I be able to log channels from diferent IP adress in the logging set?

My understanding is that this cannot be done, and if I where to implement this via sequence, probably it would not work properly, as the modbus communication fails until the connection is timed. So constantly switching device IP adress for logging is not an option as far as I understand.

What would be a better solution to implementing this kind of network monitoring, I'm thinking about opening new DAQFactory instances for each IP adress givem by the user, this way every subnetwork can be monitored and stored via the logging sets. However in this approach, how could I have then started with their right IP adress (coming from the initial program stance which will map the network)? Can some parameter be passed on initialization for this to be done? :rolleyes:

Link to comment
Share on other sites

First, don't run multiple instances of DAQFactory for this. The issues you mentioned would be challenging to overcome and there is no reason you can't do this in a single instance.

You can switch IPs on a single device, but you have to call InitComm() after it and then wait for the new connection to be established (which could be 1/2 a second or it could be 20, its up to windows really). Unfortunately, there is no way, other than trying to communicate on the port, to tell if it is connected.

Alternatively, if you know a maximum # of IP addresses you want to scan, you could create a separate device for each. Initialize the address to an empty string and port = 0 so DAQFactory doesn't do anything with it, then you can programatically change it to a real port from the disk file configuration. I think you can even just create separate ports and a single device and then change the port the device is using by changing the PortName variable (it is likely case sensitive)

Link to comment
Share on other sites

My biggest consern is how to make then all register data on the various IP addresses simultaneously and log then to the sql database.

I realize this might be acoplished creating new devices on the fly, say a device called mod_IP_XXX.XXX.XXX for the IP address XXX.XXX.XXX, but can devices be created like this, on a sequence?

Link to comment
Share on other sites

Not really, the user network can have any number of IP addresses connect to it, each with it's possible full range of modbus addresses (1-255), so it would be good if this all could be done dinamicaly.

I set up a text edit box where the user can enter the IP addresses (separeted by";"), that are later parsed and the network is mapped from there, scanning for modbus communications and identifing equipments. Those then have channels set and those channels are logged to the database.

Link to comment
Share on other sites

Well, you are most likely going to have to use a single device and just change the address and reinit as you go. Device.mydevice.address = "xxxx", then device.mydevice.initcomm().

The trick is that trying to init to an address that doesn't exist can take a while and there is no way, other than a timeout on a read to find out if it is inited. How to handle that is up to you, but at a minimum you'll probably need a small delay after initcomm() and before you send your query, maybe 0.5 a second.

Link to comment
Share on other sites

Anyway that will leave me with the problem of the channels, they must be logging all the time from the various IP addresses. We will estimate the user need for IP addresses and enter then manualy, then use execute to assign each a IP address from the network.

While coding this, I seen to have run into some problem. The code worked before without, but now somehow it wont display the values on my tree lists.

 
for(i=0, i < x, i++)

execute("device.Mod_"+i+".lockport()")
   ip = ipparse[i]
   execute("device.Mod_"+i+".Address = ip")
....

Link to comment
Share on other sites

No, I want the user to be able to configure the IP addresses that will be used. Those IP addresses will have any number of modbus devices connected on then.

Then this sequence will scan the IP addresses for the modbus devices and display then on a tree list. The user can then configure each of those devices for which data each will record (using a channel and a logging set).

So I must create a communication device inside DAQFactory for each IP address, and have the IP addresses allocated into each of those.

I will name those devices Mod_n, like, Mod_0, Mod_1... the ip list provided by the user will be parsed to fill into those DAQFactory devices for then to work all simultaneously into the channels and logging set.

Somehow I fixed it, and it's almost working now! :rolleyes:

Link to comment
Share on other sites

OK, but I need to warn you that you may be violating the end user license agreement for DAQFactory Developer which says that you cannot create applications that would otherwise compete with DAQFactory (or other AzeoTech software). This means that you can't create generic data acquisition applications.

What you describe sounds like a generic data acquisition application with the only real added functionality over what can be done with a development version of DAQFactory being the device search. If you are not using Developer, then it is fine since you would have to pay $99 for each user, but if you are using Developer you cannot distribute this sort of application without paying a royalty.

If you are using Developer, feel free to email us directly with your application and we can review whether you would need to pay a royalty.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.