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,592 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,580 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,570 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,564 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,980 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,965 Views)