Building a Pinball Model in LabVIEW

Publisher:omicron25Latest update time:2012-09-07 Source: 21ic Keywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Modeling and simulating physical objects is a very popular scientific research method. Generally speaking, this application can be implemented using C language or Matlab . As a programming language, LabVIEW can also easily build models, especially the Simulation Module of 8.2 , which makes simulation modeling more convenient and intuitive. This article will take the implementation of a bouncing ball model as an example to introduce three ways to use LabVIEW to build models.


1. Simulation Module

The Simulation Module is relatively new to LabVIEW , but I believe it will have more powerful functions in future versions and will be more complete and easy to use. The program for modeling an elastic ball using this module is as follows:


Click to see full image


As you can see, the entire model has three adjustable parameters: elastic coefficient (the ratio of the ball's velocity to its original velocity when it hits the ground), initial velocity, and initial height. In the Simulation Loop , the gravitational acceleration g is first integrated to obtain the velocity value, and then integrated to obtain the position value. It also determines whether the position has passed the 0 point (i.e., whether it has hit the ground). If it has passed the 0 point, the velocity is multiplied by the elastic coefficient and the position is reset to 0 .


2. G Code

Without the Simulation Module , this simple physical model can be simulated using only LabVIEW G code. The following figure is a program written in LabVIEW :


Click to see full image


As can be seen from the figure, we use the For loop to make the simulation loop count 200 times , and the dt of each time is 0.1 . According to dt and the physical dynamics formula, we can get the current speed and position information, and then perform the zero detection as in the previous example, and perform the corresponding operation. It can be seen that programming with LabVIEW is a little cumbersome, mainly because there are too many mathematical operations, which makes the entire Diagram occupy too much space.


3. Mathscript

Mathscript is also a new feature of LabVIEW 8.2 . Currently, LabVIEW advocates a mixed programming method of text and graphics, which can take into account the advantages of both programming methods and maximize development efficiency. The following figure is a simulation code written in Mathscript :

Click to see full image


The entire Mathcript code is m - code, that is, as long as you can run these codes smoothly under Matlab , 90% of them can be directly pasted into this node to run. If you study the program carefully, you can see that its operation method is similar to that of G Code , but because of the use of text programming, the code is more efficient, which is also the biggest reason why hybrid programming is used.

The following is a comparison of the results of these three simulation methods:


Click to see full image


It can be seen that the algorithm of Simulation Module uses the professional Rounge-Kutta calculation method (ie Solver ), so it can be confirmed to be reliable in the actual simulation results. Then the other two methods can also make their simulation effects close to Simulation Module under the condition of reducing dt .

To summarize, modeling with LabVIEW is a relatively new method at present, but because LabVIEW has very powerful data acquisition functions, interface functions and other advantages, if these are integrated with modeling, it is very convenient to carry out advanced applications such as rapid prototyping and hardware-in-the-loop testing.

Keywords:LabVIEW Reference address:Building a Pinball Model in LabVIEW

Previous article:Amplitude and phase difference measurement based on Labview
Next article:Research on Timing in LabVIEW

Recommended ReadingLatest update time:2024-11-16 22:48

Delphi uses Labview and CompactRIO to develop power steering simulation feedback system
    “We developed a steering reaction force simulation system with complex algorithms using NI CompactRIO hardware and NI LabVIEW software in just two months.” challenge:     Develop a steering reaction force simulation system that can collect data from different sensors, perform calculations, match information, and
[Automotive Electronics]
Delphi uses Labview and CompactRIO to develop power steering simulation feedback system
Labview programming skills - how to generate 0--N different random numbers
I just browsed the VIHMOE forum and found a heated discussion on the issue of generating different random numbers. The basic method is to use random numbers between 0 and 1, such as different random numbers between 0 and 100, multiply them by 100, then find the same ones and filter them. In fact, MATHSCRIPT provides
[Test Measurement]
Labview programming skills - how to generate 0--N different random numbers
Design of Virtual Circuit Experiment Based on LabVIEW
Abstract: This paper uses LabVIEW to design common experimental modules in circuit courses. Each module gives a specific program design plan and is finally successfully run and debugged. The introduction of virtual instruments can not only save costs, but also update and adjust experimental methods and means to keep t
[Test Measurement]
Design of Virtual Circuit Experiment Based on LabVIEW
NI LabVIEW and DIAdem for Fast Telemetry Data Management
Use NI LabVIEW and DIAdem to generate custom DataPlugin files and integrate them with the NI DataMine application. "We have achieved tremendous efficiency gains in managing large data sets and specialized data using DIAdem and the DataPlugin architecture. This application has become the focal point of our analy
[Test Measurement]
NI LabVIEW and DIAdem for Fast Telemetry Data Management
FCT Functional Test System Based on PXI and LabVIEW
Challenge: Use PXI control boards and LabVIEW software to build a relatively complete PCB functional test (FCT) system. This system can be used to perform comprehensive and fully automatic tests on audio, video, and various static parameters (voltage, current, and frequency). For newly developed and produced PCBs, t
[Test Measurement]
FCT Functional Test System Based on PXI and LabVIEW
LabVIEW Bluetooth Control of Lego Hexapod Robot
  Figure 1 LabVIEW Bluetooth control of Lego hexapod robot   I. Introduction     In the previous article "A six-legged robot combining Arduino and LEGO", I explained how to use the 32-channel servo control board. The board comes with a servo control software. I used the software to control the 12 mini servos of the s
[Test Measurement]
LabVIEW Bluetooth Control of Lego Hexapod Robot
Photovoltaic Inverter Performance Monitoring System Based on LabVIEW
Photovoltaic inverter manufacturers usually provide users with performance parameters such as rated power, efficiency curve, power factor, etc., which can provide the necessary basic parameters for the engineering planning and infrastructure construction of photovoltaic power stations. However, after the photovoltaic p
[Test Measurement]
Photovoltaic Inverter Performance Monitoring System Based on LabVIEW
LabVIEW Robotics Module - Special Algorithms and APIs in the Robotics Palette
Overview This tutorial introduces the robotics algorithms that come with the LabVIEW Robotics Module software. From sensors to path planning, you can use this product to design the next generation of complex automation systems. The LabVIEW Robotics Module comes with a new, fully functional Robotics palette that
[Test Measurement]
LabVIEW Robotics Module - Special Algorithms and APIs in the Robotics Palette
Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号