Simulation loop timing

I am having trouble runnnig my simulation in real time.  I am using LabVIEW version 10.0F2 and acquiring signals using a PCI-6230. In the simulation loop parameters, I am using the solver: Runga-Kutta 1 (Euler) with a step size of 0.005, and in the timing parameters I have it syncronized with the timing source, source type: 1 KHz clock with a period of 5.For a relatively simple VI these settings seem to work just fine. In a slightly more complicated VI, which happens to be saved as a Simulation SubVI for another VI, I see that the loop timing is completely off. Also by removing components of the subvi the timing changes drastically. Please advise.

duplicate
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Simulation loop inside subVI inside a simulation loop

    First of all, let me just say, I've got to hand in my work in 24 hours so please any help will be appreciated.
    I've got a simulation loop inside a subVI inside a simulation loop. If I give the inner loop enough time to run, i.e make its duration smaller than the time step of the outer simulation loop. Shouldn't everything run smoothly? Or is this just a no-no with labview?
    Thank you

    Hi VicMackie,
    This help file on the properties of the Simulation Loop is likely to help you out.
    I believe from you posts that you're wanting the loop to run every second.
    Therefore you want to check "Synchronize loop to timing source" and set your 1kHz clock or set a 1kHz <reset> so that it'll reset on every invocation of the loop. From your post, I understand that you've already done this.
    As the period is in milliseconds, for a period of a second you'd want to set your period to 1000 milliseconds, which is the default (1000).
    I'd recommend leaving the step size at the default for now and just modifying the Timing Parameters tab to confirm whether the loop will execute every second if you set the period to 1000.
    Best wishes,
    Tori
    Student

  • Memory function in Control and Simulation loop - ODE solver problem

    Hello,
    I am currectly using the control & simulation loop to simulate the behaviour of what is essentially a spring-damper-mass system. In the process the change in time (dt) is being used to integrate an arbitrary value. I am using a built in memory function to store the time, to calculate the time change (dt).
    The simulation is rather complex, due to the necessary accuracy needed, not all the ODE solvers can handle it. Currently I am using Adams-Moulton method, this works fine for the simulation. However it cannot detect the change in time, the change is constantly zero. This problem worked it self out by using another ODE solver, but then the simulation was rather messed up (even when I tuned the step sizes and tolerances). So I am quite confident that Adams-Moulton is one of the best suited ODE solver for the problem at hand.
    Is there another way to store the previous time and use it calculate the time difference, than using the memory function? Has anyone experienced such problems before?
    I have been doing alot of error searching using the probe, but I am quite sure that there is a problem with the ODE solver and the memory function. See picture below, showing in basic how the change in time is being calculated.
    I am rather new to LabVIEW, so if there could be something else I have missed I will be glad to hear it.
    PS! I have tuned the minimum step size/relative and absolute tolerances for the Adams-Moulton to simulate the behaviour of the system correctly.
    Solved!
    Go to Solution.

    Hi Willy,
    I am sorry, I can not upload the VI some of the content is confidential. I have attached a larger picture of the section were the change in volume and time is calculated, dV and dt. Also I have marked the two memory functions used. Hopefully this can help.
    My parameters:
    - ODE solver Adams-Moulton
    - Relative tolerance      1e-8
    - Absolute tolerance     1e-7
    - Minimum step size     0,0005
    - Maximum step size    0,01
    - Initial step size           0,01
    - Auto discrete time      On
    - Decimation                 0
    - Synz loop to timing source off
    Attachments:
    06-05-2014 21-20-00.png ‏52 KB

  • 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
    Attachments:
    fuzzy in simulation loop.JPG ‏52 KB

    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

  • Input for CD Linear Simulation.vi in a Simulation Loop

    Hi I'm new to LabView and I was trying to implement a real time estimator for a linear system, so a steady
    state gain is acceptable (estimator doesn't need to be adaptive). It will be
    implemented in real time target (cDAQ). The estimator will get the acquired
    data (there are 2 inputs and 1 output) from the real system.
     I have learned and tried few different ways to do it but finally decided to try using CD State
    Estimator.vi (standalone) in a Simulation Loop. My questions are:
     1. I found that the only way to use the estimator model with the acquired input is by
    using CD Linear Simulation.vi. Is there another alternative to do the
    estimation?
     2. However, with CD Linear Simulation.vi I had problem: According
    to the LabView help, if the input signals are more than 1, we have to specify
    the input as 2D array with smaller dimension as the number of channels and the
    larger dimension as number of points in each channel.
     While for every execution in the loop I will get only 2 x 1 data (see appended array 3 in the
    attached example file). How can I be able to use the measured data as the two
    inputs for the CD Linear Simulation.vi?
     Thank you.
    Attachments:
    2015_03_31_Test DAQ in sim loop.vi ‏299 KB

    Hi Mike,
    Thanks for the reply.
    I browsed through some examples and tried some things; here are the updates, maybe useful for others in the future.
    About the CD Linear Simulation.vi; In the example finder I found CDEx Kalman Filter.vi which uses CD Linear Simulation.vi to compare the estimation with real system states for two inputs.  The number of samples of the inputs was given as a constant (e.g. N samples), from which the array of N x 2 data is built and fed to CD Linear Simulation.vi. So up to now I can’t see a way of using CD Linear Simulation for feeding input to the estimator model built from CD State Estimator.vi in a “real time “ way.
    I look forward to hearing from anyone if it can be done.
    So, from here I tried another alternative to implement this real time estimator: using Discrete State Space Function. So I generate the estimator state space model in Mathscript and feed it to that function.
    I use kalman (mathscript) function to generate the estimator model.
    Interesting thing is, (although irrelevant with my original enquiry), that this kalman command seems not generate correct estimator model with multiple input (e.g. if in the original system there are inputs u1 and u2 with one output y, I expect the generated estimator model would have three inputs i.e. u1, u2, and y. But the generated estimator only has one input (??)).
    I remember that the kalman command from Matlab has the same problem which I neglected at that time.
    So this time in labView I also did the same thing as the last time, which is taking the gain generated from the same kalman command and build manually the A and B matrices of the estimator.
    I haven't browsed though to see if someone has used this kalman command for multi input system and noticed this. 
    Nevertheless, this alternative seems working well so hopefully it works well too with the RT target.
    Thanks.

  • Simulation Loop: Code could not be generated correctly for this VI

    Running LabView Simulation 8.2 on Windows XP laptop.  I have a Simulation Loop that keeps generating the following error message:
    "Simulation Loop: Code could not be generated correctly for this VI"
    The only reference I can find in my searches is to using an RTX target, which does not apply.  When I click on Show Error it just highlights the Sim Loop
    Any ideas on how to debug this?

    Perhaps you can start removing things until you don't get the error any more. How big is the code in the loop?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Control & Simulation Loop failed to compile

    Dear Forum Members,
    I have a problem with a Control & Simulation Loop program (attached) that just doesn't compile & run.  I believe that the problem is associated with the 'Feedback Node' at the bottom of this Control & Simulation Frame since if this is taken out the program will run ok.
    Can anyone please advise me if this 'Feedback Node' is incorrectly used or in violation of anything.  I have tried various ways to overcome the problem i.e. initialising it at the start but nothing works.  The error message that I received just says "VI failed to compile".
    Appreciate any help with this.

    Hello bunnykins, 
    The Feedback node really isn't a supported function in control design and simulation. The behavior you're reporting, and the work around are both documented in the know issues of the module here: 
    201449
    Return
    A Feedback Node on a Simulation Diagram causes the VI to fail to compile
    The Feedback Node does not make sense semantically within a Simulation Diagram, due to the fact that most ODE Solvers will execute the diagram multiple times per iteration and may need to reject steps and try again, filling the Feedback Node with bad data.
    Workaround: Use the Memory block from the Simulation Utility palette. If a delay of greater than 1 is desired you can chain multiple memory blocks in sequence.
    Reported Version: 8.5
    Resolved Version: N/A
    Added: 07/31/2010
    Applications Engineer
    National Instruments
    CLD Certified

  • Stopping the VI when running a infinite simulation loop

    Hi,
    This is my first time on this forum and for that matter, I started with Labview a few months back. I am developing a standalone application for servo motor control through USB 6211. The motor control was completed and I created a DLL which I could run through VC++. My application requires me to call this DLL or an EXE based on this VI repeatedly with direction, velocity and angle parameters and the remainder of the program depends on the finishing of this executable.
    The issue was that the VI did not stop execution after the motor was turned off, I suppose due to the simulation loop. I tried using the abort execution block but was advised to avoid doing so. My next step was to move all the DAQ assistant blocks into a while loop and couple the motor ON/OFF control with the stop button. But this hasn't helped either. I am attaching the VI and the SubVI here. I went through the board but did not come across a query involving a simulation loop. Any suggestions?
    Attachments:
    rotate.vi ‏551 KB
    Velocity_Con.vi ‏430 KB

    Hi Vivek!
    Thank you for contacting National Instruments.  From the information you have provided here, along with the attached VIs, I would agree that it is the simulation loop that is causing the problems when stopping the VI.  It looks like you are using the LabVIEW Simulation Module. 
    When using these loops there are two primary ways of stopping their execution.  The total simulation time can be controlled from the input node, the box at the upper left of the loop, or the Halt Simulation VI can be used from within the Utilities palette.  I would suggest taking a look at the detailed help for the simulation loop in order to better understand the methods of stopping this execution.  As you mentioned it is always good programming practice to avoid using the abort button because this can result in open references being left without any programmatic resolution.
    I hope this helps!  Let me know if there is anything else I can help with or clarify.  Have a great day!
    Jason W.
    National Instruments
    Applications Engineer

  • Simple counter within Control & Simulation Loop

    Does anyone know a simple way of creating an incremental counter within the Control & Simulation Loop ? It's not possible to have a For loop within the Control & Simulation Loop hence the shift register method is out.

    The "simulation parameters" function on the utilities pallete outputs a "Timestep Index" that is incremented each step. That's the simplest option. Alternatively, you could use a sub VI that executes on major steps and contains a for loop.

  • Basic simulation loop question

    Hi. I've been searching this board for quite some time, but couldn't find what I'm really looking for.
    I'm an absolute beginner when it comes to Labview. I'm working on a school project that includes controlling the pneumatic actuated inverted pendulum via Labview 2011 and cRIO9074, and I'm having trouble understanding all of the parameters in the simulation loop that grant real time simulation. What really bothers me are three parameters and their correlation: scan period (scan engine properties), step size and period (simulation properties). Right now I've achieved real time simulation with this parameters: scan period (10ms), step size (0.01ms), period (1(I don't know what unit)). When I try to change scan period to 5ms, the whole simulation speeds up twice ("simulation time" function displays 2s for every 1 second that passes in real time. 
    So can someone please explain these parameters in normal words (context help is confusing) and how to achieve real time simulation for desired sampling time?
    Thanks in advance! 

    There's more extensive help than the context help. Even from the context help, you can click "detailed help" to get to LabVIEW's help file. Did you look through this material? Here are a few tips:
    for real-time, only use a fixed step solver (RK1-4)
    choose the step size you desire, then select the "1 kHZ" or "1 MHz" clock. Select "Auto Period" and then you don't have to worry about calculating the period.
    Step size determines how much time is added to the simulation time every time the diagram executes. Period determines how many ticks of the hardware clock pass between every execution of the sim loop. If you want "real time" which implies that the simulation time passes at the same rate as actual time, then the "Auto Period" option will look at your step size, look at the clock you've selected, and automatically calculate the period required to run at real time.
    As stated in the help context, the unit of period depends on the clock you've selected. If you've selected a 1 kHZ clock, there are 1000 clock ticks per second and the unit of period (each clock tick) is 1 ms. If you select the 1 MHZ clock, there are 1,000,000 clock ticks per second so the unit of period is 1 us.
    Say you select the 1 kHZ clock and choose a period of 15. This means the simulation loop will execute once every 15 ms of actual time. If you want real-time, you should set the step size to 15 ms. This would cause the simulation time to advance at the same rate as actual time. If you set the step size to 30 ms, the simulation time will run twice as fast as actual time.
    I don't know anything about scan period; that is not a simulation parameter. Hope this helps, and good luck.

  • Simulation Loop ODE Solver

    I keep getting Error 2324: Labview Simulation Module: The ODE solver cannot meet the error tolerance using the minimum step size. I've broken my code down and my signal multiplication function seems to be the cause. If I don't multiply things it works fine. If I do, I get the error. Any ideas?
    Thanks,
    Brian
    Solved!
    Go to Solution.
    Attachments:
    Signal Multiplication.JPG ‏46 KB

    Brian,
    The Simulation Loop has some parameters that needed to be changed. In general, you can try to reduce the stepsize (double-click on the terminal on the left of the Simulation Loop) and change the minimal step size. Also, it is worth to change the relative and absolute tolerance to relax the values. If you increase, you can have some results.
    Additional to that, in general, if you try to use a "pure" PID, you run into some numerical issues because of the transfer function has no limits and, also, if you try to have "KD" different than zero, it won't even run the simulation. To avoid this problem, use a value for the high frequency time constant higher than zero. This way, you won't run into this problem.
    If you still have questions, please feel free to reply with you actual code and version of LabVIEW that you use.
    Cheers!
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • Extract Signal Tone Information in Control & Simulation Loop

    Hi,
    I have a simple Block Diagram to try Control & Simulation Loop. I added a Sine Wave signal and a Waveform Chart connected to it. They work just fine.
    I tried to add a Extract Single Tone Information , from Signal Processing, and connect it to the output of the Sine Wave generator but I do not know how to create a proper Time Signal.
    I thought of storing the output of the Sine Wave in an array but I was unsuccessful since I could not add any shift register to this type of control loops.
    Any help or suggestions?
    Thanks
    Attachments:
    Control_n_Sim_Test.PNG ‏9 KB

    Hi Siamak,
    Thanks for your reply mate.
    However, when I built a same BD as you posted on, it somehow didn't work. I also attached a photo of my BD here.  I used the gauge to measure when I run the programme. The gauge shows there is no signal output after the "collector"VI (gauge no.13). would you please check it for me? Many thanks!
    BR
    Floyd
    Attachments:
    tone info extraction.png ‏134 KB

  • Maxon EPOS Simulation Loop

    Hello,
    I'm using LabVIEW 8.5.1 and I have modeled and simulated a plant I'm developing within a Simulation Loop (attached) and now I want to go and implement the system, but it doesn't appear to be as simple as just dropping the transfer functions and putting DAQ Output and Input VIs in as specified in the "Introduction to LabVIEW in 3 Hours for Control Design and Simulation" tutorial for this particular system. I have a Maxon RE-40 brushed DC motor and a HEDS 5450 encoder interfaced with an EPOS 24/5 positioning controller that communicates with my PC through an RS-232 cable. Can someone talk me through how I can communicate with this system with the VI I already built for simulation purposes?
    Thanks,
    Brian
    Attachments:
    Control System V8.vi ‏215 KB

    Well you have the simulation running right? The point of the transfer function is to represent the response of the physical system right? Well replace the transfer function with the routines for writing values to the system and reading the response that relates to the transfer function output.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Cycle/loop formation in simulation loop

    Hello
    I am having a problem where output of block 2 is input to block 1 and output of block 1 is input to block 2.
    There is a feedback node which allows to specify initial condition but it runs simulation only once. As far as I know while loop and simulation needs to be kept seperate.
    Shift register can be another method to upadte it every time. But then also my simulation loop will have while loop inside.
    Please see attched snapshot n it will give better idea
    T and q are input/output for eacjh other
    Thanks in advance. 
    Thanks & Regards,
    Kunal Raithatha.
    CTD - CLAD (I wish I can take off that A, and maybe use it later to replace D :-)
    Easy Tip :- "To copy an image to a VI icon, drag the image file and place it on the icon
    located in the upper right corner of the front panel or block diagram" ...If you know any
    more reply back.
    Attachments:
    Screen shot 2010-11-30 at 2.41.26 PM.png ‏12 KB

    As long as at least one of the outputs is fed indirectly by the inputs, then you will not have an algebraic loop. Otherwise, use the memory block which behaves like a shift register but takes into account the state of the simulation. The memory block is on the Utilities palette for Simulation.
    "There is a feedback node which allows to specify initial condition but it runs simulation only once"
    Do not use the feedback node; stick with the memory block. I am not sure what you mean about the simulation running only once, but the feedback node will not behave as you expect.
    Avoid trying to use while loops in your simulation. Do not try to introduce "states" (like shift registers) that are external to the simulation. Simulations do things like take minor steps along the way and sometimes even reject steps and start over, and your externally introduced state will be incorrect if this happens. For example, let's say you create a VI with a while loop that increments a value whenever the VI is executed. If the simulation decides to reject a step and take a smaller one, your increment will have already incremented and will not know to roll back its state.
    Hope that helps.
    Damon

  • 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

  • SMTP in problem

    I'm testing inbound connections using a port listener software. all ports are working, only port 25 fail this is what I use to route inbound connections: access-list outside_access_in extended permit tcp any host 63.x.y.26 eq 951 access-list outside_

  • Regarding Purchase Requisition Doc. Type

    Hi, I am facing a problem regarding PR.We have suppose 5 plants(such as A, B, C, D, E) and 5 Doc type(such as PRA, PRB, PRC,PRD,PRE) for Purchase Req. Now if i want a user can only take plant A while creating Purchasing Req. using PRA Doc. Type So th

  • Unable to apply syntax for upper case in pdf form

    Hi All, I am unable to apply syntax in adobe livecycle design to conver the case automatic in upper case. Please help me how to do this as I am selecting form calc , clien and pasting the script but it does not work. or please share me your email id

  • Cannot Open the URL of CWA with ISE

    Hi Folks, I have a problem when doing the CWA with ISE so that I can Provide the access of the network for the guests. Everything goes fine except the URL of the CWA: When the guests open the explorer and enter a domain after connecting the SSID, the

  • Can't Get Rid of Windows XP

    So I have this white macbook running only windows xp. There is no os x on this hard drive. No boot camp and no parallels. Solely runs on xp. I have the original recovery discs for os x tiger and i cant figure out how to get rid of windows and go back