From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mehrere Signale mit unterschiedlicher Abtastrate aufnehmen

Solved!
Go to solution

Hallo,

Ich bin absoluter Neuling auf dem Gebiet Labview.

Ich versuche zwei Signale, die eine unterschiedliche Abtastrate besitzen, in einem Measurement File abzuspeichern. Die Abtastrate des ersten Signals ist 5000 Hz und die des zweiten 1000 Hz. Ich will dazu das Express VI "write to Measurement File" nutzen und das ganze als TDM File abspeichern. Nun zu meinem Problem: Ich möchte nur eine Zeitachse für beide Signale haben. Die Intervalle sollten dabei 0,0002 s groß sein, also sich nach dem Signal mit höherer Abtastrate richten. Kann man das 1000 Hz Signal interpolieren, sodass ich dort auch alle 0,0002 s ein Messwert habe?

0 Kudos
Message 1 of 9
(3,154 Views)

You did not say how the "signals" look like. (array, waveform, dynamic, etc.). Please attach a VI with typical data.

 

The general procedure would be to create a desired x ramp, then interpolate into the two original xy-point arrays using "interpolate 1D array". Maybe you can use code fragments from here. There is also resample waveform and the Align and Resample Express VI. It really depends on the answer of my first paragraph above ...

 

 

0 Kudos
Message 2 of 9
(3,123 Views)

Hallo c137,

 

schau mal dir die angehängte Beispiellösung an. Am einfachsten, verschachtelst du das kürzere Array von 1000 S/s fünf mal mit sich selbst, damit die Länge von ihm verfünffacht wird. Was noch wichtig ist, dass die einzelnen Muster der zwei Arrays (das mit 5000 S/s und das verfünffachte Array) zeitlich einander entsprechen müssen, was mit dieser Methode versichert ist.

 

Viele Grüße,

NI TSE

0 Kudos
Message 3 of 9
(3,119 Views)

Hallo Akos_43,

 

Danke für deine Antwort. Ich habe deine Beispiellösung ausprobiert. Sie funktioniert zwar aber ich möchte eventuell auch andere Abtastraten einstellen und deine Lösung ist ja nur anwendbar, wenn die höhere Abtastrate ein ganzzahliges Vielfaches von der kleineren Abtastrate ist oder sehe ich das falsch?

0 Kudos
Message 4 of 9
(3,106 Views)

@c137 wrote:

wenn die höhere Abtastrate ein ganzzahliges Vielfaches von der kleineren Abtastrate ist oder sehe ich das falsch?


Use one of my solutions. Attach your data and I make an example.

0 Kudos
Message 5 of 9
(3,100 Views)

@altenbach wrote:

You did not say how the "signals" look like. (array, waveform, dynamic, etc.). Please attach a VI with typical data.

 

The general procedure would be to create a desired x ramp, then interpolate into the two original xy-point arrays using "interpolate 1D array". Maybe you can use code fragments from here. There is also resample waveform and the Align and Resample Express VI. It really depends on the answer of my first paragraph above ...

 

 


Hi altenbach,

 

attached you can find the VI and some example-data saved as an excel file. I changed the sampling rate into 300 Hz and 50 kHz. The sampling rates are not fixed yet - its just for testing the VI. I tryed to resample the signal with the "Align and Resample VI". It works, but the second signal rises until line 168, where it finally reaches its correct value (23,68...).

Why does the VI behave like this?

 

I am sorry for changing the sampling rate and the type of file. I hope this does not make a big difference for the concept of the VI.

Thank you for your support.

 

 

Download All
0 Kudos
Message 6 of 9
(3,093 Views)
Solution
Accepted by topic author c137

Sorry, I don't "do" express VIs and dynamic data. It seems you only attached the output file where the sampling is already aligned. I would have been more interested in the data before resampling. 😉

 

You only seem to have only one channel for each primitive, so why are you reading multiple channels, creating an array of waveforms with one element each?

 

In any case, you can resample waveforms as already mentioned above, or you could do it explicitely as follows. (This uses linear interpolation, but you could equally easily do e.g.a spline)

 

resampler.png

Message 7 of 9
(3,086 Views)

Hi c137,

 

die jetzige Version nimmt wirklich an, dass die höhere Abtastrate eine Vielfache der anderen Abtastrate ist, aber mit zwei Interleaving-Funktion (eine für jeden Kanal) kannst du es ganz einfach generalisieren, um beliebige rationale Verhältnisse zu erreichen.

 

Viele Grüße,

NI TSE

0 Kudos
Message 8 of 9
(3,070 Views)

@altenbach wrote:

Sorry, I don't "do" express VIs and dynamic data. It seems you only attached the output file where the sampling is already aligned. I would have been more interested in the data before resampling. 😉

 

You only seem to have only one channel for each primitive, so why are you reading multiple channels, creating an array of waveforms with one element each?

 

In any case, you can resample waveforms as already mentioned above, or you could do it explicitely as follows. (This uses linear interpolation, but you could equally easily do e.g.a spline)

 

resampler.png


Hi, Sorry for the late answer. I had no time to integrate the VI in my projekt, but I think this will be the best solution. I will reply to this later again. Thank you.

 

0 Kudos
Message 9 of 9
(3,039 Views)