LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using simulations for online control?

Hi, ok, I'll try that out instead of adding the shift register. But the problem is still not solved for the transfer function blocks which don't have a reset function, which is a bit annoying; I guess they also contain integrators. Alternatively I could ofcourse make my own first order transfer function manually by using an integrator. The same problem with resetting also appears when using e.g. transport delays in the simulation loop. Because the transport delay is interrupted it will never change values as long as the transport delay is longer than the simulation time, because it resets. It is a bit difficult to do anything when not able to look inside sub VI's is this at all possible for the simulation blocks?
 
Thanks for the inputs
 
soeren
0 Kudos
Message 11 of 19
(1,177 Views)

Hi Soeren

No, you cannot see the code begind the integrator blocks e.t.c as they are elementary blocks. You can build the transfer functions by using elementary blocks as you mentioned.

Recall that you can also use the tools from the control design toolkit to construct transfer functions which simplifies the implementation.

Thanks,

KostasB

Applications Engineer NI

0 Kudos
Message 12 of 19
(1,164 Views)

Hi Kostas

I've been trying to use some of the functions in the control module, there are some nice once, where you can construct transfer functions and analyze etc. But I didn't manage to implement them in my testvi. I've been testing a specific block in "Control Design & Simulation>>Control Design>>Implementation>>Discrete Transfer Function. But I can't seem to make it work. To begin with I just wanted to make a simple 1st order filter (which I did using some other blocks in the Control Design module). Everything seemed nice, but my inputs and output change simultaneously, there's no 1st order dynamics what so ever. I tried using the help file there are some wrong links for this block example, if you click on the "Detailed Help" link in the "Context Help" you are directed to the Direct Transfer Function block from the Simulation Module. I've attached a picture showing that if I click on the correct link in the help file manually, the link is corrupted. This has made it a bit difficult debugging the block......which by the way could solve many of my problems, because transport delays, 1st order filters, 2nd order filters can be constructed quite easily. I haven't been able to find out how fast these blocks can be simulated because I didn't make the block work.

I've attached my test vi where i've added a "New" radio button which activates the test of the block, on the second tab of the tab control the input can be changed and the output can be analyzed, and I havn't yet been able to see anything else but instantaneous chages.......what am I doing wrong.

Hope you can help..........because it would be a pitty I would have to make transfer function and transport delays from scratch.

Download All
0 Kudos
Message 13 of 19
(1,162 Views)

Hi soeren

I tried to click on detailed help for the discrete transfer function and worked fine on my computer. There might be a problem with the installation. I have

attached a VI that uses the control design toolkit to create a 2nd order transfer function and uses simulation module for the step response.

Hope that helps,

KostasB

NI Applications Engineering

0 Kudos
Message 14 of 19
(1,157 Views)

Hi Kostas

I know how these block work, and you show a fine example of how the simulation module can be used. However the use that you show is not usable when taking measurements and doing online control at the same time, because the simulation model needs to run in sync with a given DAQ loop (without resetting, at least if transport delays are needed).........nevermind that, back to the thing with the help file. I found out where the problem lies, and its not in my installation (I checked with 5-6 other computers, which have the same problem). Maybe the bug is only in LV 8.2 which I'm using. What confused me was that you actually can place this vi from two different locations, from the simulation module and from the control design. The interesting thing is that the vi is actually the same, but try holding the mouse over the "CD Discrete Transfer function" in the control module (see attached picture) and take a look at the context help, then compare this to when you place it in the vi. The context help changes from "CD Discrete Transfer Function" to "Discrete Transfer Function", and the link also changes. If you click then link before placing the vi you will get the error I showed you. I've tried this on the before mentioned systems and they all exibit the same error. I find it pretty unlikely that I've installed LV falsely 5-6 times Smiley Happy

.............Aaaaanyway I found out how to use the transfer function creater that you also are using together with the "Discrete Transfer Function", the problem is that output of the "CD create special TF model"-block does not match the "Discrete Transfer Function", because the "Discrete Transfer Function" only needs a cluster with the input for the numerator and denominator, and the other out includes an entire structure. I've succesfully extracted the arrays needed and have attached a working model which hopefully can use in my real time system. In the real system, the models implemented will initially be with constant parameters. Not all my problems are solved though because I still need to make my own discrete unit delay, to implement in my timed loop because the ones available only can be used in the simulation loop.

Download All
0 Kudos
Message 15 of 19
(1,148 Views)

Hi Soeren

Thank you for your feedback with regard to the help file. I have attached a modification of your VI that implements a continuous 1st order system with a delay, it is

converted to discrete time and then is fed to the discrete tf VI.

I hope that helps,

KostasB

NI Applications Engineer

0 Kudos
Message 16 of 19
(1,141 Views)

Hi Soeren

It would also be helpful if you have a look at this  tutorial:

http://zone.ni.com/devzone/cda/tut/p/id/4604

At FIG. 21 you see the simulation module in work with real world signals.

Regards,

KostasB

NI Applications Engineer

0 Kudos
Message 17 of 19
(1,134 Views)

Hi Kostas

I just tried out your vi with the delay implemented, but it doesn't work. The "Discrete Transfer Function" only works if I input a cluster containing a 1D array with the values of the numerator and a 1D array with the values of the denominator. I does not work if I input the structure from the "CD" - transfer function blocks. More over, I haven't been able to run your vi's directly, so we are probably using different labview versions, I'm using LV 8.2.1 , what are you using? 8.5 ? Could you try running it in LV 8.2 or 8.2.1 and see what happends? I just set the values in your vi to Sampling time 0,1 s , Delay 10 and used a transfer function of 1 / 1 + s . It does nothing when I change the input, and I get no errors? Could LV 8.2.1 have a bug?

soeren   

0 Kudos
Message 18 of 19
(1,127 Views)
I didn't find an implementable unit delay in labview, so I made one myself.
0 Kudos
Message 19 of 19
(1,121 Views)