04-17-2013 01:09 PM - edited 04-17-2013 01:15 PM
I know there are lots of forum posts about 2nd-order solvers, but I can't seem to find one that I can apply to my particular problem.
I'm developing a software model of a pendulum attached to a movable (along one axis) support. My end goal is to simulate the pendulum's response - given a set of initial conditions - following an impulse to the support.
The ODE has the form: Θ"(t) + x''(t)*cos[Θ(t)] + sin[Θ(t)] = 0
where x(t) is a function independent of Θ.
I've been playing around with the ODE Solver.vi and a few of the model construction VIs in the Control Design & Sim toolkit. I've made a few disparate bits of progress, but I can't see a clearly-defined end in sight. Any input would be appreciated.
Cheers,
Solved! Go to Solution.
04-18-2013 02:05 PM
hello theflyingmountaineer,
You stated that you have tried a few things like the ODE Solver.vi and the Control Design & Sim toolkit. Can you describe what you have tried and if you have some specific purpose for using these tools I'd love to try and accomidate that.
I believe that if you break your 2nd order ODE into 2 first order ODE's there are a variety of way that you can solve the equation. Here is an article that explains why I am talking about.
http://zone.ni.com/reference/en-XX/help/371361J-01/lvanlsconcepts/solving_odes/
and here is a document that shows the different solvers in LabVIEW
http://zone.ni.com/reference/en-XX/help/371361J-01/lvanlsconcepts/ode_solvers_in_labview/
04-19-2013 11:06 AM
Hello
Have you seen this shipping example?
C:\Program Files (x86)\National Instruments\LabVIEW 2012\examples\Control and Simulation\Case Studies\Nonlinear\Pendulum\SimEx Nonlinear and Linear Pendulum Simulation.vi
It describes how to obtain a nonlinear simulation of the pendulum using LabVIEW ODE Solver and the Contro and Simulation Loop and, also, gives you how to define the linear simulation using the Control Design functions and the linearization functions of Simulation.
Notice that this example was added in 2012. Hope this helps...
04-19-2013 12:13 PM
Thanks, Barp. That example is actually where I got the most useful information about addressing this problem. Unfortunately I didn't find it until after I posted..... I've always been terrible about using the Example Finder
I accomplished most of what I was after by following the example's paradigm of creating a subsystem representative of the 2nd-order equation and passing parameters to it inside of a simulation loop. Below is the pendulum subsystem along with the equation it represents. As far as I can tell, feedback conditions are handled automatically in simulations as it was unnecessary for me to place feedback nodes in the wires.
Here is the implementation inside the simulation loop:
The waveform chart is plotting the stimulus and response signals of the subsystem.
The little piece of code at the beginning () was my implementation of an iteration counter. The simulation loops are a strange beast and I had to figure out a way to step through my stimulus array inside the loop. Using the Simulation Time function and step size parameter, one is able to track the current "iteration" of the simulation loop.
This is also my first time really delving into the features of the CDS toolkit, and I found the 3-hour ppt course (http://www.ni.com/white-paper/5855/en) very helpful.
04-19-2013 12:36 PM
On the index part of the array, you should use the 'indexer' function. It will do the indexing of the array taking into account time and the variable step size. This example would help you understand how to use the Indexer:
C:\Program Files (x86)\National Instruments\LabVIEW 2012\examples\Control and Simulation\Simulation\Utilities\SimEx indexer.vi
04-19-2013 12:38 PM
Nice!! Thank you!