From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

how to implement sliding mode control in mathscript

Hi everyone,

I have been trying to implement sliding mode control in LABVIEW , and i think the best option is to use Mtahscript. But i don't have any idea how to do it...

As in MATLAB i had created a model containing two blocks of plant and controller and wrote their equations accordingly, BUT i don't have any idea how to implement it in LABVIEW. Anyone who have used LABVIEW/MAthscript for sliding mode cotroller designing, plz help me finding solution. 

Thanks in advance.

 

Kind regards

0 Kudos
Message 1 of 10
(13,117 Views)

The preferred way to simulate a system in LabVIEW is to use the Control and Simulation Loop (part of the Control Design and Simulation Module) where the 'solver' integrates the system over time. A good example is the shipping example:

 

C:\Program Files (x86)\National Instruments\LabVIEW 2014\examples\Control and Simulation\Case Studies\Automotive\ABS Control\Control of Vehicle Motion - ABS.vi

 

Here is picture of the diagram, so you have an idea.

Sliding mode control.PNG

 

Now, if you do not have the simulation loop, then you can just use LabVIEW For Loop and try to create the integration funcions that would make this system to work... This is a bit more work but also doable...

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 2 of 10
(13,105 Views)

Thanks Barp for your kind reply,

I do have the control and simulation Loop. But the point that i want to ask is, how to implement Sliding mode control in it, as there are blocks for controller design like PID etc , but i haev to design controller using Sliding mode control technique. I have implemented Sliding mode control in MATLAB/Simulink using S function, but i don't know how to implement it LABVIEW.

 

0 Kudos
Message 3 of 10
(13,095 Views)

Well... as you can see in my picture above, you do not necessarily need a S-function. If your S-function is m-based, then you can use the Mathscript node to define the nonlinear equations and, then, use the 'integrator' from Simulation Palette to integrate the signal (if you have derivative).

 

However, if your S-function is C based, then you can try to use another function in Simulation called External Model Interface. You will need to create a DLL and code your features into it. But probably you have all this code already and I think it can be somewhat easy to do... Here is the documentation:

 

http://zone.ni.com/reference/en-XX/help/371894D-01/lvsimconcepts/sim_using_emi/

 

If you still have difficulty to do this after you look into my information, it would help if you could create a simple schematic or some paper that describes what you are trying to do.

 

Hope this helps,

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 4 of 10
(13,089 Views)

Can you give me file example ABS Brake, please?


@Barp wrote:

The preferred way to simulate a system in LabVIEW is to use the Control and Simulation Loop (part of the Control Design and Simulation Module) where the 'solver' integrates the system over time. A good example is the shipping example:

 

C:\Program Files (x86)\National Instruments\LabVIEW 2014\examples\Control and Simulation\Case Studies\Automotive\ABS Control\Control of Vehicle Motion - ABS.vi

 

Here is picture of the diagram, so you have an idea.

Sliding mode control.PNG

 

Now, if you do not have the simulation loop, then you can just use LabVIEW For Loop and try to create the integration funcions that would make this system to work... This is a bit more work but also doable...


 

 

0 Kudos
Message 5 of 10
(8,505 Views)

This example is shipping with the LabVIEW Control Design and Simulation Module and you can find the example and its subVIs in the folder:

C:\Program Files (x86)\National Instruments\LabVIEW <version>\examples\Control and Simulation\Case Studies\Automotive\ABS Control\

Does that work for you?

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 6 of 10
(8,490 Views)

I can't open this example in my version. Can you give me your example(abs.vi)? Thank you!!!

 

 

0 Kudos
Message 7 of 10
(8,484 Views)

If you can't open it, it is because you also need to install the LabVIEW MathScript Module. You can get that in here:

 

http://www.ni.com/en-us/support/downloads/software-products/download.labview-mathscript-module.html

 

Also, keep in mind that you have to match the LabVIEW versions of the Modules too. For example, if you have LabVIEW 2018, you have to install LabVIEW Control Design and Simulation Module 2018 and LabVIEW MathScript RT Module 2018 for x86:

http://www.ni.com/download/labview-control-design-and-simulation-module-2018/7367/en/

http://www.ni.com/download/labview-mathscript-rt-module-2018/7408/en/

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 8 of 10
(8,472 Views)

Hi sir..

I AM A NEW WORKER WITH LABVIEW. BUT I WANT TO DESIGN A SLIDING MODE CONTROLER IN LABVIEW. CAN YOU GIVE ME SOME EXAMPLE OF THESE CONTROLLER IN LABVIEW TO HELP ME?

0 Kudos
Message 9 of 10
(7,714 Views)

@omid73 wrote:

I AM A NEW WORKER WITH LABVIEW.

You are asking for a LabVIEW solution, thus you should post in the LabVIEW forum instead. A moderator can move it for you.

 

(Also please fix your keyboard. It seems your caps-lock is stuck)

0 Kudos
Message 10 of 10
(7,702 Views)