Plot a state-space model

Hi!
I'm currently doing a project and I'm stuck and am in need for some help.
I've done a state-space model that I'm using for this project. I've used Matlab (with and without simulink) to simulate this model and to plot its behaviour. But when I want to do this in LabVIEW, i get stuck.
I dont want to use Mathscript 'cause then it would be using Matlab. 
Does anybody have some ideas of how I can simulate and plot my state-space model from the  matrix parameters that i have?
Look at the attachment, I want to plot x.
Solved!
Go to Solution.
Attachments:
State-Space Model.png ‏11 KB

We have so many different ways to do this. Try to look at the following shipping examples:
C:\Program Files (x86)\National Instruments\LabVIEW 2011\examples\Control and Simulation\Control Design\Model Construction\CDEx Creating SS Model from String Matrix.vi
C:\Program Files (x86)\National Instruments\LabVIEW 2011\examples\Control and Simulation\Control Design\Model Construction\CDEx Rendering State-Space Equations.vi
C:\Program Files (x86)\National Instruments\LabVIEW 2011\examples\Control and Simulation\Control Design\Time Analysis\CDEx Time Domain Analysis.vi
C:\Program Files (x86)\National Instruments\LabVIEW 2011\examples\Control and Simulation\Simulation\Continuous Linear\SimEx state space.vi
They show how you can use the product to create a State-Space (SS) model, show the rendered model on the front panel, do a linear simulation of a model and implement the state-space model in the Control and Simulation Loop, respectively.
Notice also that we have an extensive amount of examples available for you. Hope this helps...
Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

Similar Messages

  • Implementation of state space model with constant disturbance in mathscript and simulation

    I am new to LabVIEW and now I am doing a project realizing heater control in 8 rooms.
    I have realized the state space model in the form x(k+1)=x(k)+u(k) using mathscript (using c_to_d) and feed it into control and simulation loop for simulation.
    My problem is, in my project, I have to consider the disturbance from the other rooms. So the statespace model changed to be x(k+1)=x(k)+u(k)+E*d, where E is the matrix concerning the disturbance and d is the vector of disturbance. How could I implement the disturbance and discretize the new model in mathscript and which function to choose for the simulation. Discrete state space stochastic model?
    Appreciate your kind help.

    Hello, state space models in LabVIEW most of the time are being implemented by utilizing mathscript syntax
    in addition with some functions of the LabVIEW Control Design and Simulation Module.
    There´s a couple of nice tutorials for control design with these tools which I´d like to point you to as a first step.
    http://www.ni.com/white-paper/6368/en/
    http://www.ni.com/white-paper/6368/en/
    http://www.ni.com/white-paper/6435/en/
    http://home.hit.no/~hansha/documents/lab/Lab%20Work/MathScript/MathScript%20Lab%20-%20Part%20II.pdf
    regards
    Marco Brauner AES NIG

  • I have a state space model of a complex system. can anyone help me for implementi​ng MPC and e-MPC control for the same?????

    Hi everyone. I am new to the forums, so let me be as mprecise as possible. i know the basic functionalities of Labview with MPC block etc. However, i dont know how to go ahead with implementing MPC control for a system whose state space model i possess. can anyone help me out?? the problem is that i dont even know the approach or the starting point..

    This happens if you remove a program manually, but still have the registry keys to load files from this program.<br />
    You can use the MSConfig program or the Autoruns utility to see which software and services are getting started.
    *http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx
    You can use registry editor and do a search (Ctrl+D) for imesh to see if you can locate the registry key(s) that launches this program on a reboot.
    Try to ask advice at a Windows oriented forum if you can't fix this.
    * http://www.bleepingcomputer.com/forums/ - BleepingComputer.com - Computer Help Forums
    * http://windowssecrets.com/forums/ Windows Secrets Lounge

  • Discrete state-space representation in FPGA

    Hello all,
    My aim is to simulate a discrete state-space model is the cRIO FPGA (in order to use an observer).
    I am currently trying to simulate it on my computer without using the discrete state-space VI from the Control Design and Simulation toolbox (because there is not state-space model VI for the FPGA). However my discrete state-space model representation does not work.
    There is below the continuous state-space model:
    Then I obtained the discretized model (using the zero-order-hold and t=0.01s):
    Below is the discretized state-space model I designed (in order to design a similar model in the FPGA):
    Here is the discrete state-space VI I'm using to compare the results:
    The graph plots the state X1, which is infinitely increasing. However it should look like a first order, as you can see:
    I understand why the state X1 is increasing like this, I know I'm missing something (integration saturation ?).
    Thanks in advance
    Regards!
    PS: Does somebody know if implenting other controller than the PID is doable in the cRIO FPGA? I also asking myself about matrix inversion if I want to use the Kalman gain in my observer.
    PS2: I apologize for my disorganized/unclear Labview files, I'm beginning with it.
    Solved!
    Go to Solution.
    Attachments:
    SS Discret Simulation.vi ‏544 KB
    SS Discret Model.vi ‏21 KB

    Hi,
    I think the problem might be caused by rounding errors in your A and B matrices.  Have you tried getting it to display the values with greater precision?
    Matlab calculates those values as:  A = [0.995, 0.009925; 0 0.99],  B = [2.488e-5; 0.004975]
    Regards,
    Ian

  • Control and design applying ramp input and plotting polar coordinates state space

    Hi
    I am trying to do a fairly simple state space task with Control Design and Simulation toolbox, however I am quite new at using this toolbox and need some help :-)
    I want to simulate a MIMO system of a 2-DOF robot arm. The robot arm consists of two links, the first link can rotate arround its origo at its end, and the next link moves inside the first link, in and out.
    So the two outputs is define as
    r (radius), which is the distance to the end-effector of the robot, and
    theta, which is the angular postion of the robot arm
    FYI, the two inputs are the currents send to the two motors controlling each link.
    I have set up A, B, C and D matrices in the attached VI file and putted it inside a simulation loop.
    Now I need help :-)
    I want to simulate the system when a ramp input is applied to the two inputs and plot the two outputs in a polar graph to show the end-effectors position when the system is just "let loose". The result should be a spiral (this is verified in MATLAB simulink).
    So please, I need help setting up the VI to do the above, can anyone help?
    Best regards
    Simon
    MSc. Eng.
    Message Edited by SCMAJA on 10-16-2009 11:21 AM
    LabVIEW 8.6 / 2009 / 2010
    Vision Development Module 8.6 / 2009 / 2010
    VBAI 3.6 / 2010
    Attachments:
    2 DOF robot with ramp input, polar coordinates plot, state space.vi ‏49 KB

    Hello Simon,
    The error comes from your Ramp Input. Since your system is MIMO, you would need to feed in a vector input to the system.
    I've changed your VI and attached here~!
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation
    Attachments:
    MIMO Robot VI.vi ‏76 KB

  • (Control Design & Simulation) State-Space block doesn't give output

    I've tried and tried but can't get the State-Space block module to give me a graph / output.
    I have no idea what the problem is and hope that somebody can help me. The numbers and calculations work in Matlab (Simulink) but i can't get it to simulate in labview. 
    Anybody got any ideas?
    Solved!
    Go to Solution.
    Attachments:
    Cavities.vi ‏30 KB
    Matrixes.vi ‏27 KB

    The problem is that you are assuming that LabVIEW executes left to right. Dataflow doesn't work this way. Your code as this:
    does not tell LabVIEW that it has to execute everything from left to right. What is happening is that he is executing the 3 'island' of code in parallel and, in this case, it will have 'empty' values. You have to remove the local variables to make this work and dataflow paradigm will execute your code from left to right, as you want. here is the code:
    Also, one more thing. Your input to the "CD Linear Simulation" is all zero. That means that you are trying to input zero input to a linear system, which will give you a zero output to the response. You probably do not want that since zero as input doesn't give you any more information. If you want to see how to system goes to zero after initial conditions, you should use "CD Initial Response". Or you should modify the input signal to the system. Please study this shipping example to understand how to use Linear Simulation and Initial Response:
    C:\Program Files (x86)\National Instruments\LabVIEW 2012\examples\Control and Simulation\Control Design\Time Analysis\CDEx Time Domain Analysis.vi
    Hope this helps...
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • Vector Space Model implementation

    Hi,
    Does anybody know where I can find a java implementation of "vector space model"? Or simply a java program to extract keywords from an HTML page?
    Actually I don't know if this is the write forum to pose this question!
    Edited by: Marziye on May 28, 2008 10:55 PM

    You can take a look at the Apache Lucene project. It should be possible to extract keywords from documents with it. Anyway, it is not that hard to implement the vector space model yourself!

  • State space and noise models of a signal

    Hello
    I would like to apply Kalman filter to the signal in the attached file. I am asking how to generate the required matrices for the space state and noise models, which I should input to the filter.
    It is my first exposure to this subject,and I much appreciate simple explanations and a practical help.
    Thank you
    Attachments:
    Signal 2.xlsx ‏10 KB

    Yeah, unfortunately I don't think I'll be able to make it down to Austin for the conference.
    But more importantly, I don’t think I completely solved my curve fitting problem.  The curve fitting vi that I am using isn’t generating the output that I was expecting.  My goal is to simply add noise to a signal, then reconstruct the signal finding the best fit line/curve, which best represents the original signal.  Here is where I currently stand:
    The frequency of the new graph is too high.  A sinc function is produced, but it doesn’t share the same form as the original signal. 
    I've tried other options, such as the Levenberg-Marquardt method, but this is proving to be a bit difficult to understand.  I will attach the curve_fitting.vi and the Levenberg-Marquardt example that I was looking at.  I think the LM vi is very close to what I need, but I’m having trouble integrating my own numbers into the program, to generate the results that I need.  If anyone has any advice with the curve fitting, or any information that might 'dumb-down' some of the sub vi's in the Levenberg-Marquardt program model, it would help me out.
    Attachments:
    SimpleFit.zip ‏147 KB
    curve_fitting.vi ‏163 KB

  • State space of continuous systems with discrete mesurements

    Hello everyone,
    I want to implement some estimation techniques for continuous systems using discrete measurement but I'm having some trouble finding a communion between the two concepts in labview. Basically what I want to do is to solve the ODE for the system continuously, while just getting measurements every some time step (bigger that the ODE solver), then using both quantities for state estimation. Any advice on this? 
    Thank you,
    Juan E Tapiero

    Hi!
    Have you tried taking a look at the ODE solver.vi in LabVIEW? You can find more information on this VI here:
    http://zone.ni.com/reference/en-XX/help/371361G-01/lvanlsconcepts/ode_solvers_in_labview/
    Daniel G.
    Applications Engineer
    National Instruments

  • State space time out

    hi all,
    I wanted to actually ask what is a good way for implementing a software timeout with in a state. Normally I use tick count for measuring the elaspsed time and once 5 or 10 seconds have been passed then time out condition occurs and state changes. As in the sample VI i am attaching. Now I know this is a crude form of time out so I was wondering what is actually a good programming practice to do such a task. Keep in mind I am not talking about event structure or some visa comunication (as i know they handle time out them self) ....purely software based .
    p.s its not home work . simply just something I am wondering over.
    Best Regards
    Regards
    Attachments:
    time out lv11.vi ‏8 KB
    time outlv12.vi ‏11 KB

    I usually just use the Elapsed Time express VI.  I have taken it and made my own version to use, but the concept is the same.  But it does really depend on what you are doing.  Most times, you have the option for the user to abort.  So you will want to bounce between a Check Time and Wait For Event states.  The Wait For Event state will have a timeout of its own (something like 100ms usually works well).  Instead of using the Tick Count, use the timestamp instead.  It will give you a larger range to work with and you won't have to worry about the overflow.  It is also easier to debug since you can see the actual time that it starts the current time.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • System identifica​tion miso models

    Hi,
       I want to know is it possible to identify the MISO and MIMO models using system identification toolkit?
       I m using fieldpoint 2010. The program is running very slow inside the fieldpoint. so is it possible to divide the program in such a way that few compuations(which are less critical)  run inside the  computer and few inside the fieldpoint?
    Regards,
    Sai

    Hi Ruser,
     LabVIEW System Identification toolkit provides SI Convert to Models of CDT VI to convert a model you created in the LabVIEW System Identification Toolkit into a transfer function, zero-pole-gain, or state-space model that you can use with the LabVIEW Control Design and Simulation Module.

  • How to emplement Model Predictive Control

    Hi,
    I have to controle a MIMO system whose model could change over time.
    It's an 8dof robot with 8 actuators, and a sensor that gives 3d velocity, position, roation rate, and orientation.
    Actually I'm using autotunnig PID, and considering my MIMO system like multiple SISO systems. It works correctly for some dof but not for others.
    It seems that Model predictive control is the right way to do that.
    What are the steps to emplement correctly a MPC?
    Thanks

    Thank you very much Javi, I will try designing the MPC controller over the a linearized model and implement it on the nonlinear proccess. But I have a problem designing the controller with the linear model. I am using the example "CDEx MPC with Dual Constraints" to start working over it. So I just change each matrix (A,B,C,D) and the rest of the parameters (constraints, set point), but when I run it it doesn't works fine and it shows to me 2 control signals when the system just have one. Something similar occur with the outputs, according to the model I have 2 outputs but the chart only shows me 1. And the constarints seems to do nothing (umin = 0 - umax = 5e-4; ymin = [0;0]; ymax = [0.69;0.59]. I attach the file hoping you can help me please because I've been trying also on several examples for this state space model and having no result. 
    Please help me with this problem, because I do not have no where to ask.
    Attachments:
    MPC.vi ‏190 KB

  • ARX Model Simulation - Error -41263

    Hello
    I'm trying to simulate an ARX model using System Identification pallete. I don't like to write too much about my problems when one VI can explain everything - so there it is, in attachment "Model Simulation.vi" works well, while "Model Simulation PtByPt.vi" gives me error -41263 (System Identification Toolset:  The System Identification Toolkit cannot retrieve the data in system model because the model type you wire in is incompatible with the system model requirements).
    Can anybody tell me what am I doing wrong?
    Just for reference: there was once similar topic, but unfortunately it didn't provide any answers at all: http://forums.ni.com/t5/LabVIEW/system-identification-error-41263/td-p/886077 .
    Solved!
    Go to Solution.
    Attachments:
    ARX.vi ‏23 KB

    That is correct, it accepts only State-Space model. It would be good if I could read this in documentation, not by asking here or by clicking inside the actual VI...

  • Error in Mathscript (FOPDT Transfer Function)

    Hi all, i am trying to write a First Order Plus Dead Time system into the mathscript, unfortunetaly i found that it appear an error (please refer to the attachements), do anyone have idea or approach to write an FOPDT Transfer function in mathscript? 
    Thankyou veery much.
    Solved!
    Go to Solution.
    Attachments:
    error.png ‏18 KB

    Thank you very much barp, both method work for me, but now i had face another problem.
    I had try your method and design the PI controller, but the result (overshoot) is different compare to the result (overshoot) by using Matlab.
    I had try to copy and paste the code from the Mathscript to the Matlab and step plot it. Consequently, the overshoot shown different value. 
    I also had try to check all the value and i found that everything is ok until the last line sys_cl=feedback(Gf,1), Labview has given the answer in transfer function but Matlab has show the answer in continuous time state space model. 
    The value of the transfer function : Gain = 58.46; Time constant = 0.55 and time delay = 0.06.
    The value of Pi controller : Kp = 0.0784 and the Ti = 0.24. 
    I had attach some picture which show the difference.
    Am i did something wrong in the mathscript and should i do it in Labview by different way?
    Thankyou very much
    Attachments:
    matlab1.png ‏24 KB
    labview bd1.png ‏28 KB
    labview bd2.png ‏43 KB

  • DAQ Assistant with multichannels causing Simulation Loop slow?

    Hi, another LabView newbie here.
    I have in a Real Time Target (NI 9132)  a Control & Simulation Loop with DAQ Assistant block inside, whose signals are fed into a Discrete State Space block. The discrete state space model has 1 second time step. I have set the Simulation Loop parameters so that it executes every 1 second as well (see Fig. A below). *sorry for the big white gap under the figures..
    The DAQ assistant acquisition mode is set as "1 Sampe (On Demand)".
    However, when I run the VI, the plot seemed to be updated much slower than 1 second rate. To confirm this, I put an "Elapsed Time" block inside the Simulation Loop. The "elapsed time" shows the actual time in seconds while the simulation plot show slower time (see Fig. B below).
    I tried to isolate the problem by removing the block one by one. Finally, I found out that this problem was caused by (at least) the DAQ Assistant which acquires multichannels data of NI 9214. When I remove some channels and leave one or two channels, the VI runs at the actual time (see Fig. C below). But when I added more channels reading, it became slower again. 
    Here is the snippet of the block diagram (after all other blocks were removed):
    What am I doing wrong here? I'm going to use all of NI 9214 channels so how not to have similar problem like this?
    I look forward to hearing any relevant comments from the members. Thanks in advance.
    Tian

    Hi Tian,
    why do you need a Sim loop anyway?
    - When it comes to speed you shouldn't use the DAQAssistent. Use basic DAQmx functions…
    - Use parallel running loops for each task. Put DAQmx functions in their own loop, running in parallel to your Sim loop…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • How to count number of occurence of a particular charchter

    Hi All, Anybody there who can help me in counting the no. of occurence of a particular char in a string, with the help of a select query !!! For example : there is a string 'RAJENDRA'. I want the select query to print 2 in this case without using a p

  • 2 GB graphics card

    what 2GB graphics card is compatible in a HP Envy 700-414? i have R5 230 Radeon Graphics Card and it does not work

  • Database maintenance for sqlserver database to improve performance

    In our company sqlserver 2008 R2 is working as a project server database. I want to know commands for database maintenance. Please let me know all command in order which i need to run in sqlserver for database maintenance. because i want to increase

  • How to access request attributes in a portlet?

    Hello Experts, request.getParameter() in the reset method works fine in a pageflow but doesnt work in a portlet or a portal and always returns null for all the attributes/parameters,is there any special way of getting the request attributes in a port

  • To View Calc Scripts and Report scripts via MaxL or Esscmd

    Hi all, Can somebody tell how to read any calc script or report script in any database with the help of MaxL or Esscmd? For example if there is any .csc or .rep file, I want to read the context of the file i.e. the script that is written in the file.