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: 

Discrete transfer function-change sample time in VI

Hi all,

 

I am working on a VI which posted below with sinusoidal input and pass thru an discrete Transfer Function. The output is use to compare in my MATLAB simulink  model. By comparison, I found the sampling time is 0.1 sec. I am looking for faster sampling time at ~0.001sec but I am having difficulty in changing it in LabView. VI's option have non sample time input.

 

May the expert out there help me on this.

 

Many thanks

 

SeeChew 

 

(P.S. Attachments are my problem print screen and my VI.)

 

Parameters for my test are:

Offset=0

Frequency=0.08Hz

Amplitude=180deg

Phase=90deg

 

 

Download All
0 Kudos
Message 1 of 4
(2,990 Views)

Hey SeeChew,

 

I've just looked at your code and I can't seem to understand exactly what it is your trying to achieve? Is the code for real time simulation? If real time is not of importance then find Control Design and Simulation palette and find the Control and Simulation Loop where everything you are trying to do is made easily possible.

 

Otherwise if the real time is important then I would advise a producer consumer architecture for your code (look in the LabVIEW example finder). This will allow the data to be written to file much quicker. At the moment your code is very slow because you have a 'write to spreadsheet file V'I inside your For loop. Hence everytime an element is written to file the 'write to spreadsheet file V'I has to open, write then close the file for every iteration of the For loop.

 

Please get back to me on what the aim of the project is with specification so I can help you more.

 

Regards

Ben

0 Kudos
Message 2 of 4
(2,977 Views)

Hi Ben,

 

I am very new in LabView, and there is not enough support from my region. I am constructing this VI myself by referring from some example.

 

My aim for this project is to design a controller from MATLAB simulation, then implement it into my servo motor. The output from the servo motor experiment should give similar output that I am having from simulation in MATLAB.

 

However, I tried with my VI (main VI to control my servo motor) by sending a sinusoidal signal (same as simulation) but the output is very different. Therefore I am trouble shooting the problem by testing the input and output of the discrete transfer function. I realize if the sampling time is different, output is different too. That's why I am posting up this question.

 

I also realize my VI runs very slow, and thanks for pointing out for this problem. May I know how can I improve this? 

 

I am attaching my main VI and can you please suggest what can I do to improves the performance? And is the Transfer Function block connect correctly?

 

Sorry for asking some basic question. Really appreciate that you are giving me swift respond.

 

Many thanks.

 

Regards,

SeeChew

 

 

 

0 Kudos
Message 3 of 4
(2,970 Views)

anyone can help me on this issue??

0 Kudos
Message 4 of 4
(2,946 Views)