LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate a control of a sine wave signal

Solved!
Go to solution

Hello all

 

For a school project I have to make a control for a reactor that measures pressure, temperature and flow. 

Both pressure and flow will be sine-like signal outputs. So for now I wanna build a simulator that generates a sine signal and a controller that keeps it within certain limits.

So far I've been able to build a sine generator and a basic PID control, but they are both separate. 

I have no clue how I can introduce the sine signal in the controller so that it can be kept within certain limits.

 

 

The sine I now have has an amplitude of 10, a frequency of 0,3 and an offset of 50.

 

Can anyone help me combine the sine signal with the controller so that it stays within an amplitude of 40-60

0 Kudos
Message 1 of 18
(4,605 Views)

Hi Xebe,

 

I have no clue how I can introduce the sine signal in the controller so that it can be kept within certain limits.

How should your controller influence the sine wave generation?

How should the sine wave look like after you "keep it within certain limits"? (Otherwise simply use the InRangeAndCoerce function to "keep the sine within limits"…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 18
(4,586 Views)

We'll be using a pulsing pump, so i don't expect to get a lineair output out of it. 

 

So what I'm trying to achieve is to keep the pump at it's current ratio as long as the process values stay within (lets say) a pressure of 40-60 bar. 

But if the pressure delivered becomes higher than 60 bar the pump needs to slow down again so that the pressure falls within the previous limits again.

 

Where would I find the ' InRangeAndCoerce function'?

 

 

Also I'd like to make some kind of simulation, without having to add hardware yet. But if possible i'd like to easily switch to the real thing by just removing and/or replacing a few blocks.

0 Kudos
Message 3 of 18
(4,573 Views)

Hi Xebe,

 

Also I'd like to make some kind of simulation, without having to add hardware yet.

LabVIEW comes with a lot of example VIs.

With the PID toolkit come several example VIs explaining the use of PID functions with a simple simulation. Did you examine them?

 

Where would I find the ' InRangeAndCoerce function'?

Use Quickdrop (Ctrl-Space).

Or search the LabVIEW help.

Or look at the comparison palette…

 

So what I'm trying to achieve is…

Now we are starting to talk about a control loop consisting of a system, a controller and several signals (sp, pv, outputs). This is a clear improvement against "limiting a sine wave"…

General answer: set the PID gains suitable for your control system!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 18
(4,569 Views)

I've been through a few examples, but I can't find any that use a sine/pulsating signal as input. 

 

At this point my knowledge of LabVIEW and control loops stuff isn't suited for the task, but I'm willing to learn. However, most of these examples are already a bit too complicated for me to even understand. 

0 Kudos
Message 5 of 18
(4,563 Views)

Hi Xebe,

 

However, most of these examples are already a bit too complicated for me to even understand. 

Then you should start the with those GettingStarted links given on top of the LabVIEW forum!

 

I can't find any that use a sine/pulsating signal as input.

There are examples for PID control and there are example to create a sine wave. You just need to combine them (using the basic knowledge from GettingStarted)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 18
(4,559 Views)

I've seen all those learn-labview video tutorials so far. I can now make a thermometer that gives °C or °F and if I try i could make a traffic light.

 

But I don't quite see where I should put my sine signal into the controller, and how the controller will then be able to control the sine signal.

 

I see that you're trying to help me, thanks for that, but it doesn't seem to really help me get anywhere further.

0 Kudos
Message 7 of 18
(4,556 Views)

Hi Xebe,

 

as far as I understood your question the sine wave will be your "process value" pv (aka measurement value). The (PID) controller expects your pv and a "setpoint" sp as inputs (with some PID gains) and gives you an output value. That output should be your pump speed (or requested massflow/pressure)…

 

So when you use those example VIs, which usually use a FP control to set the sp you would replace that control with your "sine wave"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 18
(4,549 Views)

Okay, that was very helpful. 

This is what I got so far (see attachment). It seems to be working and stable.

But now it seems that should my pressure drop, the pump will also start slowing down?

Pressure drops are possible, but will  be mostly slowly over time because of pressure leaks (in the future real process).

0 Kudos
Message 9 of 18
(4,546 Views)

Okay, that was very helpful. 

This is what I got so far (see attachment). It seems to be working and stable.

But now it seems that should my pressure drop, the pump will also start slowing down?

Pressure drops are possible, but will  be mostly slowly over time because of pressure leaks (in the future real process).

 

 

Edit: 

forgot to rescale some graphs, now my pump would get a sine signal to constantly give more and then less power?

0 Kudos
Message 10 of 18
(4,546 Views)