• Content Count

  • Joined

  • Last visited

Everything posted by AzeoTech

  1. Are you sure some of those channels aren't empty? Is it off for the entire column or just a few rows?
  2. The function you wrote would only work if all the channels had the exact same number of historical data points, and would only work if no data came in during the time the for() loop runs. If I wanted to successfully align data and log it, but only after the fact, I would generate each line in-situ, then write it at the end. I'd do that by creating a Test String channel (with Timing 0 of course), then a sequence that is always running like this: Private string channelNames = Channel.ListAll() private string strLine while(1) delay(1) try strLine = FormatDateTime("%c", systime()) for(j = 0, j < numrows(ChannelNames), j++) strLine += "," + DoubleToStr(Evaluate(channelNames[j] + "[0]")) endfor myTestStringChannel.addValue(strLine) catch() endcatch endwhile Then when I wanted to write this to disk, I'd write the header like you did, then write the enter strLine history, or whatever part of it I wanted.
  3. You don't want DAQFactory to be the slave. Possibly, but the radio isn't responding to DAQFactory queries except occasionally, and then the response doesn't look to me like a Modbus, that's why I think its either a comm setting issue, or the device isn't setup to be a Modbus slave, but instead a different protocol.
  4. Yes, that is because Windows made the program files folder read only unless run as admin. And right, inside the protocol script for an iotype, there is a local variable created called "Channel" that is passed in corresponding to the channel # in your channel. So, it gets confused and uses that variable instead of the global Channel object.
  5. DAQFactory is the master because it is making the queries. The device is the slave because it only responds to queries. It won't say anything unless asked. That device supports several different protocols, and typically you have to configure the device for the protocol you want as you can't talk multiple protocols on the same port.
  6. The device doesn't seem to be replying with Modbus. Are you: a) sure that the device is setup for Modbus RTU slave and not another protocol, b) sure you have all the comm settings right? Often Modbus uses Even parity.
  7. 1) you have a comment in line 39 that isn't marked as a comment. Its outside functions in the class, but still will have unpredictable behavior. 2) for some reason you commented out l2 at line 42. Then you go on to use l2 in line 45 and 46. This may be where you are getting the C1000 error since l2 never exists.
  8. Certainly. But given your error message, you probably have a typo somewhere. Any chance you can post you script? Feel free to X out the URL or anything else you don't want to share.
  9. Sure, use ListAll(), then use evaluate(): private string chans = channel.listAll() for (private x = 0, x < numrows(chans), x++) for(i=evaluate(chans[x] + ".GetHistoryCount()-1"), i > 0 , i--) Private.strLine = FormatDateTime("%c", evaluate(chans[x] + ".Time")) + "," Private.strLine += DoubleToStr(evaluate(chans[x] + "")) + "," File.Write(Private.handle, strLine); delay(.1) endfor endfor Notes: 1) you can do ListAll() and just specify a group of channels by providing the group name as a string 2) the above code will be VERY slow, especially with the delay(0.1) in there 3) I recommend using numrows() instead of GetHistoryCount()
  10. What is datain? And what about the other ? statements output?
  11. We had to change security settings. You'll need to go into Windows Explorer and make it so the Persist folder is writable by all users, or select another folder that has these permissions.
  12. I'm not sure I helped. I would try manually adjusting all your registers to 0 notation. I almost always do this. So if the manual says 40,001, strip the 4 and subtract 1 and put 0 in the Channel # in DAQFactory. So, 41,234 would become 1233.
  13. 25535 or 65535? (65535 is 2 to the 16th - 1 and a number you see often in computers, 25535 is not seen often and looks like a typo of 65535). It is important to understand that Modbus register addressing style can vary from manufacturer to manufacturer. Some manufacturers use 40,000 notation, so that 40,001 is the first holding register. This translates to register 0 in the actual Modbus communication packet (strip the 4 and subtract 1). It also limits one to 9,999 holding registers. Other manufacturers use 0 notation, so that 0 is the first holding register and matches with the Modbus communication packet. In this case, there are 65535 possible holding registers locations. The problem is that a number of manufacturers just flat out misunderstand all this, and will say that there register is, say, 42,323, which one would read as either 2322 or 42,323 depending on which of the two notations they were using, but the manufacturer will actually subtract one without stripping the 4, so they expect 42,322 in the packet. This is just wrong, and confusing. In your case, it is hard to tell. DAQFactory attempts to automatically figure out which notation you are using. If you only provide holding and input registers in the 30,000 (input) and 40,000 (holding) range, then it assumes you are using the strip 4, subtract 1 notation, and it will do that, making 40,001 into 0. If, however, you read a register below 30,000 (or above 50,000) it will assume that all your registers are in 0 notation and send them as is. It sounds a bit like DAQFactory it is doing this, treating 40,001 as 40,001 and not as 0. You'd have to look at the actual packet to be sure, or just check and see if you are reading registers below 30,000.
  14. AzeoTech

    Channel Error Timeout and port locked

    The C type errors codes are listed at the end of the help, but that list isn't all inclusive. Device and protocol codes are typically in the section with the protocol if at all.
  15. AzeoTech

    Channel Error Timeout and port locked

    No, those are just DAQFactory error codes. It makes it easier to do error handling if you choose to have script do something based on errors.
  16. AzeoTech

    Channel Error Timeout and port locked

    Timeout means your device isn't responding to DAQFactory queries. The port locked is just a side effect of that error. You need to be plugged into either Port 1 or Port 2 of the device. Modbus ID (D# in DAQFactory) is most likely 1 unless you changed from the factory setting. I did not see any other information in the manual attached. You'll need to figure out the comm port settings. 9600, 8, e, 1 is the default for Modbus, but your device could be anything. You'll also need a register map, otherwise you are shooting in the dark, and given the Timeout errors, you are missing every shot.
  17. You can do this in a sequence, but the precision of the result is going to be based on your acquisition speed due to quantization in time. For example, if you have a Timing of 100ms, and pulses as described (50, 450, 150, 350), then DAQFactory is going to probably miss the 50ms pulse, or register it as 100ms, and round the others in one way or another. To improve this, you simply need to sample faster. Sampling at 0.01 is probably the fastest you can go without streaming, so streaming the input might be the best as then you can get data at much higher intervals. But this is independent of how the calculation would be done in DAQFactory. So, let's say you have a channel called "current" that is either being acquired quickly through Timing or just streamed at high speed. Next create a channel called "Duty" that is Device Type "Test", "D to A". Then create a sequence to calc the duty and have it running whenever you want the duty calculated: while(1) private data = current[systime(), systime()-1] // retrieve 1 second worth of data from history private pointsOn = sum(data > 0.5) private totalPoints = numrows(data) duty = pointsOn / totalPoints * 100 delay(1) endwhile So: "while(1)" means loop forever "private data =" gets all the data points recorded in the current channel for the last second. It doesn't matter how many there are, as long as the data points are evenly spaced "private pointsOn =" calculates the number of data points in current that read more than 0.5. "(data > 0.5)" returns an array the same size as data containing either 1 when data is > 0.5, or 0. Summing this array gets the number of points. "private totalPoints =" simply gets the number of data points in the last second. "duty = " calculates the duty from those last two measurements "delay(1)" waits a second before "endwhile" loops us back around A few notes: 1) I could of course combine a lot of this into a single line, but left it split up so you can understand the flow 2) the way this is written it will miss data points during the few millisecond that the loop is calculating. This is probably not a problem, but if it is there are ways to tighten it up, it just makes the script a little more involved. 3) remember, the precision of the result of this is dependent on your acquisition speed, and that the data points are equally spaced. For this reason I suggest you stream the "current" channel as fast as you can. Make sure the History of "current" is long enough to hold at least the last 2 seconds worth of data. So if you are streaming at 10kHz, the history should probably be 20,000 or more.
  18. Thanks for the update! I'm not a big fan of 3rd party anti-virus though as it is often bloatware. I usually use Microsoft Security Essentials, which may have been incorporated into Win 10 as Defender?
  19. Yes, that is good to know. Wifi is notoriously finicky I find, which is why I never understood the push for it in industrial settings. We have a commercial level Wifi system here and it still drops out for very short periods. Its almost unnoticeable, but if you were streaming a LabJack I could see how it would become an issue. Thank you for sharing!
  20. AzeoTech

    ERROR C1070 using "=>"

    Because => isn't a valid operator, >= is the correct one. The = always comes second on operators with two characters, so: >=, <=, +=, -=, etc. though of course += and -= aren't comparison operators...
  21. I understand, and if you wanted to deploy 20 or more 1100's it might be worth the effort, but with only one, unless you really just want to learn DLL programming, you'd be better off just buying a LabJack. It is unfortunately, actually, that companies like DATAQ, don't provide better integration, especially since their hardware is good. I'm not talking about software solutions like their WinDaq software. That doesn't give you any choice. I mean providing better DLL's (not ones that only run with .NET) that are easier to integrate, or better, doing like LabJack and providing a Modbus wrapper, even for their USB devices. This means that you can use a LabJack with most any software that supports Modbus, which is most any data acquisition software tool.
  22. Not easily, they only provide a .NET library, so you'd either have to wrap their .NET library into a DLL and use DAQFactory's extern() function to bring it in, or go low level, which still would probably require you to write a DLL. You'd be better off using a LabJack, such as the U3, which is more capable for only a little more money and has complete support and is easy to use in DAQFactory.
  23. AzeoTech

    Set a button to blink

    Well, first, you can always create a button look by putting a panel behind some text (or an image!) But what you want to do with the actual button control you can do in On Paint Event of the button. Let's say you want it to blink each second if myVar is true. In the Event put: visible = !myVar || (systime() % 2 > 1) Note that the page refresh rate will affect the quality of the blink. The first part of the above simply says that the button should be visible if myVar is false (i.e. not flash). If it is true, then the second part kicks in due to the OR. % is modulus, meaning the remainder, and systime() % 2 is the remainder of dividing the current time by 2 seconds, so it will give a number between to 0 and 1.999999... depending on the time. I check if this result is > 1 which is half the time and results in an on for 1 second / off for 1 second.
  24. AzeoTech

    Logging Data issues

    You can actually do this just by using techniques built in to Windows / Windows Explorer for addressing network drives. You can of course map a network drive to a drive letter in Explorer and then it appears just like any other harddrive. But you can also skip this by using double backslash notation. For example if you have a network drive at, you might put: \\\myDrive\dataFiles As for cloud storage, that depends on the service. Many will have similar type notation to make it accessible from Explorer. All this works in Runtime.