# AzeoTech

5,704

1. ## Duty Cycle of Clock pulse measurement T7

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.
2. ## Corrupt Persist File

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?
3. ## Missing data and duplicate lines in CSV log-file

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!
4. ## 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...
5. ## DATAQ Di-1100

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.
6. ## DATAQ Di-1100

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.
7. ## 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.
8. ## 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 192.168.0.20, you might put: \\192.168.0.20\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.
9. ## Corrupt Persist File

Any chance you could send me the .ctl document. You can email to support @ if you don't want to post it.
10. ## Corrupt Persist File

Does this happen often, or did it just happen once? Do you have auto-updates disabled? In WIn10 it is kind of tricky to do.
11. ## Corrupt Persist File

It refers to any non-magnetic drive. As I said, newer systems have better wear leveling. Older style ones didn't and so if you rewrote to the same place on the disk over and over you could very quickly kill that part of the disk. While newer ones work better, they are not completely immune.
12. ## Combining channels into array

Sure. If you aren't going to log it in a logging set, probably the easiest is to use a V channel, and in the expression calculate those values. For mean, you could calc it in one step on your own, but max and min are more involved, so its probably best to use concat() for all three. mean(concat(a[0], b[0], c[0], d[0])) max(concat(a[0], b[0], c[0], d[0])) Note that concat() is limited to 20 parameters, so if you have more you'll have to nest it: mean(concat(concat(a[0], b[0], c[0], d[0]),e[0], f[0], g[0]))
13. ## Missing data from CSV file.

I would personally take some data, then switch the system into Safe Mode. Then look at the time stamps for the channels and see how much variance there is. You can use the table view in the Channel View (click on each Channel in the workspace).
14. ## Missing data and duplicate lines in CSV log-file

It looks like the alignment of the data is just off. You probably want an alignment threshold of .9, or actually maybe even 1. It's hard to say without a time stamp with milliseconds in it. You might try a run with DF time instead of custom time. As for sig figs, it is important to understand that sig figs is different what we call "Precision" in variable value components. Precision is the number of digits to display to the right of the decimal place. Sig figs is actually just that, significant figures, though DAQFactory automatically adds 1 to the sig figs, basically to avoid have your least significant figure rounded. So, when you specify 2 for figs, you'll get three non-zero digits. So: 123.4567 becomes 123 but: 1234567 becomes 1230000 and: 0.000123456 becomes 0.000123 Its more digits because of the leading 0's, but that is needed. The 0's aren't significant so don't count. Note that 102.345 becomes 102. The zero is significant because it has a non-zero digit to its left. Likewise 123000.567 becomes 123000. The zero's aren't significant, but are required to actually write 123 thousand.
15. ## DDE requests start to fail after long data acquisitions

Yeah, that's the problem with DDE and Resources. It doesn't matter if you are running the fastest workstation money can buy. DDE is so antiquated, that Windows never really updated it to take advantage of new technology. It's kind of like running a 32 bit app on Windows x64. You can put 256 gig of memory into the machine, but the app is still only going to be able to use 4 gig. Except of course that DDE is much older, almost no one uses it anymore (unlike 32 bit apps which are 99% of apps out there), and the problems aren't as obvious. Now I'm not saying you shouldn't use DDE, as it is common to use antiquated technology in this industry, I'm just trying to explain why the machine doesn't matter. Why don't you email us directly on support @ and I'll see about adding a reset command to the DDE driver so you can reset the connection from within DAQFactory. Then you may just be able to reset the connection every hour to keep things fresh.
16. ## DDE requests start to fail after long data acquisitions

I'd be curious if restarting the other side, the software that DAQFactory is communicating with over DDE resolves the issue. DDE is ancient technology of Windows that actually uses windows (note lower case w) to allow for interprocess communications. Because it uses windows (among other reasons), it uses "Resources" (note upper case R because I'm talking about something specifically named Resources), another somewhat ancient concern that rarely appears nowadays. Basically applications are allocated a limited amount of Resources and creating windows takes away from this. Once you run out of resources, you can no longer create new windows. Your latest debug data point tells me that you are somehow running out of resources, and that by not opening 6 extra windows it leaves just enough space for DDE to keep running. Resources are not the same as memory and have nothing to do with what video card you are using. I, truthfully, don't know what Windows calls it now as it generally never causes a problem. You may be able to track your Resource use in Task Manager by showing these columns: Handles, USER objects, or GDI Objects. I'm not actually sure which will line up, but you may see one of these steadily rising as your program runs.
17. ## Corrupt Persist File

Certainly. A loss of power can cause all sorts of problems even outside DAQFactory. I once lost power during Windows boot and had to reinstall the OS (this was a long time ago....) These problems don't crop up often because systems typically are only writing to disk a very small percentage of operating time, but they do happen. That is why you should always have a UPS in place with a connection to the PC so that Windows can gently shut things down if there is a sustained power loss. A laptop achieves the same thing, but of course they tend not to be rugged.
18. ## Missing data from CSV file.

This almost certainly is due to the alignment parameter of the logging set and differences in the time stamp. If you are taking data once a second and generally all data at the same time, you'll want the align threshold at something like 0.7 or so.
19. ## DEVICES DATA TO WEB BROWSER

Your best bet would be to use a service such as DAQConnect.com to do this. With that product you'd have to create separate HMI screens for the web, but they will work more efficiently and across all devices. Alternatively, you could program DAQFactory to take screenshots of pages, then upload them to a webserver. Sending commands back to DAQFactory would be slightly harder, but is best implemented using a pull mechanism, meaning DAQFactory queries the server at some interval to see if there are commands to perform. You do not want to open up the system running DAQFactory to the Internet as that is just asking for security problems. Not because DAQFactory is more insecure than anything else, but because opening up the system to the Internet exposes the system to attacks on all levels, the most likely being on the OS and probably DoS type attacks (even if they are unintentional).

21. ## Multi Color LED

Actually, the quickest way is to display the Event panel (View->Events), select each LED, then select the OnPaint event. Let's say the variable is called myVar, and the first LED shows state 0 and 1, and the second 2 and 3. So, the On Paint event for the first LED would be: visible = myVar < 2 while the second LED would be: visible = myVar > 1