08-18-2008 10:47 PM
Since NI-DAQmx apparently can only simulate one and only one waveform and refuses to allow me to even apply a custom scale to it so I can at least change the amplitude, I am forced to try to work around this and write my own simulator. I can't afford to wait until the HW is available and even when it is, I want to be able to test error conditions that I wouldn't WANT the HW to do! So I the simplest thing I can do is take advantage of the fact that I have a host/target system with SVs between them and test the front panel with a simulated "target". All I need to do is write to two SVs that are waveform arrays representing the 32 AI channels from two boards (one SV per board). I see there is a handy "simulate signal" VI, but how the heck do I get it to generate multiple channels?? I tried putting it in a for loop but it just appends the channels instead of making them in parallel. FWIW, I have one board being sampled at 1 KHz and the other at 100 Hz.
Signed,
Extremely frustrated and disappointed with LabView.
08-19-2008 02:05 AM
Well, sorry to say that: LabVIEW has nothing to do with your frustration.
As far as i understand your posting, you are designing your software like this:
Module A acquires data and transfers the data to two SVs, one SV for each device.
Module B reads the waveforms from the SVs and processes them.
Ok, here is one suggestion for Module A:
- The DAQmx returns an array of waveforms if configured to read more than one channel in waveform-mode
- You can configure the SV to contain an array of double waveform (the data in the waveform is of type double then)
- Since you don't get the array of waveforms from DAQmx, you have to create some on your own. You can use different functions for this, please take a look into the waveform-palette
hope this helps,
Norbert
08-19-2008 09:08 AM
DAQmx will simulate as many channels as you specify and a quick test of custom scales seems to be working just fine.
You have not provided the code that you've written for the DAQmx simulated channels and you have not provided the code for the other simulated channel. I can only presume that you've done something very wrong as I cannot see how you append the channels when you use a for loop. The most basic code should produce an array. If you want it fixed, show what you've done instead of just complaining that it does not work.
08-19-2008 09:21 AM
Dennis,
last time i checked, DAQmx only generated sinewaves for all channels with the same amplitude and frequency and only a little shift in the phase. You cannot change these settings. Therefore, i think that knicewar is a bit annoyed by the default DAQmx simulation.... (you are correct that you can simulate as many channels as the simulated hw supports though....).
Nonetheless you are also correct that without sources, we can only asume things and give very general hints.
Norbert
08-19-2008 10:14 AM
08-19-2008 10:28 AM
Dennis,
What version of LabView are you using? Everyone else who I've asked to try it has not been able to change the amplitude, phase, or frequency of the NI-DAQmx simulated waveforms -- never mind trying to make a sawtooth or other waveform. But yes, at least it simulates all the channels and does add noise (but I can't see a way to control that either). Unfortunately, this isn't very helpful for my testing.
Attached is a picture of the VI I used to simulate the target. The two arrays coming in are from a configuration file -- I'm just using them right now to know how many channels to put in each array. I'd like to set the waveform attributes to use the channel names from the array, but that's low priority. The second image below is the VI for a given board. The first VI generates an array of times for all the waveforms, then the subVI goes through and calls the sine function for each channel. This seems rather manual and still doesn't have noise or a convenient way of specifying the frequency, but it does work. I had hoped the "simulate signal" VI would allow simulating more than one channel but I can't figure out how to do that. Can anyone see a simpler way of doing what I'm trying to do? Note that I'm also not yet handling the fact that one board is 1 kHz and the other is 100 Hz.
Keith.
08-19-2008 10:33 AM
Dennis,
You say custom scales work with NI-DAQmx simulated signals? That is also something nobody else has been able to do. It lets me create a custom scale and apply it to a simulated channel with no errors, but when I look at the data, it is not scaled. Other people see the same thing. Very easy to reproduce -- it can all be done in MAX.
Keith.
08-19-2008 10:45 AM
Oops -- the simulated sine I gave wasn't quite right. Here is the corrected version that fits the min/max args. (It was a late night ...) It's even more ugly than before.
08-19-2008 10:48 AM - edited 08-19-2008 10:49 AM
Keith,
it IS possible to scale signals from simulated devices. But this can only be done in custom applications, the testpanel from MAX does not provide this feature. Nevertheless, it will still be a sine with the given frequency......
hope this helps,
Norbert
08-19-2008 10:59 AM
That works!! I think I had tried just about every pertubation except that one and once I saw I couldn't do it in MAX I gave up. Well, it's still only a sine wave but at least it allows me to develop my app and test custom scales from a config file.
Thanks!
Keith.