I am using Labview 2010 and have loaded the simulation module ( only have 15 days left before it expires. trying to see if the program will work before I spend $4K) and are trying to calculate the dynamic response index of a spring.
I have been able to complete the program in the simulation section (I think). I now need to feed an acceleration trace into the module which I have already captured at a sample rate of 100 k/s.
The test engineer has said that I need to add 500 ms of zero's to the front of the trace to ensure the system is stable before the acceteration trace is feed into the simulation module. I have alreay completed the reading and adding the zeros to the string.
I am having trouble feeding the trace into the control and simulation module.
The engineer says he has been able to do the calculation in MatLab and simulink (I think), as I have not used this program and we do not have a copy I am trying to do it in LabView.
I would add more, this forum is blocked by my work firewall.
If more information is required I will have to go back to work and get it.
Solved! Go to Solution.
To feed a buffered signal into your simulation, you need to use the function called "Simulation >> Utility >> Indexer". This will try to give the output based on the simulation time.
Look at this example:
C:\Program Files\National Instruments\LabVIEW 2010\examples\Control and Simulation\Simulation\Utilities\SimEx indexer.vi
To study how to use this feature.
Hope this helps.
By the way, we have several other examples in:
C:\Program Files\National Instruments\LabVIEW 2010\examples\Control and Simulation\Simulation
which tries to show how to use some details of the product. Also, we have several applications examples under:
C:\Program Files\National Instruments\LabVIEW 2010\examples\Control and Simulation\Case Studies
that also helps you to teach how to use LabVIEW and the LabVIEW Control Design and Simulation together.
Thank you I will try when I go back to work.
Will have to try and install the examples again when I search for the simulation I find the vi's, whgen I try to open them I get an error.
Maybe I left a box unchecked when I installed it on the laptop.
Because we have a network licence I am unable to install the simulation toolbox on my computer, I had to install a demo on an old lad top, struggles a bit, though it still runs.
That what happens when your computer support is 90 km away....
I tried it today.
I had the input to the simulation model correct.
The error was in the output from the simulation, as I required the maximum value from the calculation within the simulation. The value I was getting out was the last point of the data string.
I could use the waveform (I think) wire wich is in the simulation model when you graph the results.
The problem I have is how do you get the y data array from the wire. In self teaching LabView to myself I have not been required to do this.
I also tried to use the collector VI, I had the same problem as above, unable to get the y data array.
By looking at the graph and doing an estimation on the maximum value in the array and using a calculator, the result is close to what I am after.
Then probably the issue is related to how to properly code with LabVIEW Control and Simulation Loop. If you are getting only the last element it is because you need to accumulate the necessary vector to apply to the function. The Collector allows you to accumulate the point and give you accumulated signal. Then, you have to move your 'calculation' code outside the control and simulation loop since only ater the simulation is done is when you will receive all the signal for analysis.
Does it make sense?
Yes I did that, as I graphed it outside the loop.
How do you extract this from the wire, a little over my knowledge base at the moment.
If I understood correctly, you just need to use the "unbundle by name" function from "cluster, class & variants". This should allow you to access the Y data that is present in the cluster.
I have tried to undundle by name. All I get is a broken wire.
I have tried to use the collector from Express it works, the tarce dose not look like the graph from inside the simulation section as it places a spike in the trace at the start and upsets the result when it I extract the maximum from the trace.
I have just worked it out while I was trying to get a screen shot for you.
All you have to do is have an array to a cluster and then unbundle by name and then into the simulation collector, then unbundle by name outside the simulation and away I go.
I should have brought the lap top home in the first place.
As I am working out of the office at the moment.
I read the post on one Friday, try it and wait until the next Friday for help.
Any way thank you. Looks like work is going to have to buy me the simulation module, only 5 days left on the evalulation...
When I said to use the unbundle by name, I was thinking that you need to obtain the value after you did the simulation. Below shows how to use the collector and obtain the maximum of the vector.
Now, if the problem you are trying to get the maximum value on the wire while you are simulating, you can then use the function "vi.lib\ptbypt\Other Functions.llb\Array Max & Min PtByPt.vi", which you can find under "Signal processing >> Point-by-point >> Other functions pointbypoint". This provides you the maximum value each time step and if you have to restart, you just need to reinitialize the function. Also, you can have a 'sample lenght' for a 'sliding window' on your data.
Hopefully the snippet below would make it easy for you to see. (PS: you can just drag and drop this picture below into a new VI in LV 2010 and it will create this code for you to run.