LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use Fuzzy Logic Controller for transfer function in labview control and simulation loop?

I am facing problem with fuzzy PD logic controller for transfer function in control and simulation loop.

 

Plz Help me in this regard...................

 

i have attache snapshot of my program

0 Kudos
Message 1 of 7
(4,873 Views)
Can you elaborate a bit more on the issue that you are facing? It would be extremely helpful if you can post your code.
Andy Chang
National Instruments
LabVIEW Control Design and Simulation
0 Kudos
Message 2 of 7
(4,843 Views)

Hello there,

 

Thank you for your reply. Actually I am new in designing fuzzy logic controller in labview control and simulation loop. I have developed fuzzy logic for proportional plus derivative controller to get better response for a particular transfer function(model of dc motor). I have tested it in matlab 8 and it is running.But the FLC is not performinng in labview although the membership functions for input output variable and rules ar same even without FLC, simple pd controller along with the same transfer function is running in labview. I dont know why? And many examples I have seen so far about FLC in labview is for the 'while' and 'for' loop. But I am designing it for control and simulation loop since I have to connect many blocks of Control design pallete and transfer function to the FLC.

 

I have used unit step input and taken error and rate of error as two inputs for FLC and the output of FLC is connected to the plant transfer function. There should be transient and steady state response. But not comung.

 

I am attaching the two files - (1) fuzzypdcontroller.VI and (2) fuzzypd.fs or (3) fuzzzypd.fc  .Both are programmed in labview 2009.

 

Waiting for your kind reply.................................................

 

0 Kudos
Message 3 of 7
(4,808 Views)

Sankhadip

 

Based on your screenshot, the first thing you need to do is to move your code that read the FS file outside the loop. The way you have setup, it will try to read the file very minor stepsize, slowing down the code tremendously.

 

The second is to define what kind of solver you are using. If you have a variable stepsize solver, you need to define to which frequency you will execute the fuzzy logic controller. To do that, just right click on top of the Fuzzy Logic Controller and go to "SubVI node Setup" option. There, you can choose "Discrete" where you can then define the sampling frequency to which it will execute. Without this step, you will run this VI every single minor stepsize, giving incorrect results.

 

Hope this helps.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 4 of 7
(4,800 Views)

Dear Barp,

 

Thank you for your reply. According to your suggestion I have made changes in my program. But still the output of the plant transfer function is wrong. Another thing I am wondering about is that how to select the sampling frequency in sub vi node of FLC . And is the format of location of .fs file in the build path correct? 

 

I am attaching the  modified .vi and .fs file for your convenience to find the fault.

 

Waiting for your kind reply.....

0 Kudos
Message 5 of 7
(4,777 Views)

Hello there,

 

Plz help me to solve my problem on designing FLC in control and simulation loop...............

 

waiting for reply................

0 Kudos
Message 6 of 7
(4,753 Views)

Hi Sankhadip,

 

Sorry for the late response. I was looking at your code and I noticed that the graph scale does not start from zero. That might be the reason why you don't see the transient in the simulation. To change the scales simply double click on the lower limit and set it to zero. If this is not the expected results, can you please post the expected results, so we can see what are the differences between the results . Also, you might be using different solvers, and that gives different results as well.    

 

 

Thanks and have a great day.

 

Esmail Hamdan | Applications Engineering | National Instruments

0 Kudos
Message 7 of 7
(4,639 Views)