LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Particle Collision in a Box

Hi,

 

So I have been trying to use LabVIEW to simulate a box full of a defined number of particles. These particles will then collide with the wall and each other in elastic collisions. I have managed to have the VI create particles with random speed and velocity and detect when it hits the wall. This can be seen below.

 

Any suggestions on ways in which I can go forward with this detecting the particle-particle collisions it would be much appreciated.MutliParticle2D.png

Jordan.

0 Kudos
Message 1 of 5
(3,378 Views)

@ImNotDave wrote:

I have managed to have the VI create particles with random speed and velocity and detect when it hits the wall. This can be seen below.


 

No, you did not "manage" much except plagiarizing my old code without giving proper credit or linking to the original source (and see also my example here and others in that thread). This is not polite. If the code is derived, you should always give links to the original discussion so we don't need to start from scratch or marvel at your my cool code.

 

Here is a picture of my original VI. Looks mostly familiar, right? All you added is a FOR loop.

 

 

bouncer.png

 

 

In any case, managing ball collisions is a much more complicated problem. Basically you need to check proximity of all possible ball pairs and then calculate the reflection vectors for each "close" pair as a function of both speeds and trajectories (angles, offsets, etc) and ball sizes (note that the current code assumes infinitely small balls, even thought the point style is bigger).  Do you fully understand my code? What have you tried so far?

 

Message 2 of 5
(3,344 Views)

You might be better off starting with examples of billiard ball physics simulations, such as this open source one here: https://www.myphysicslab.com/engine2D/billiards-en.html

 

Once you understand that, the physics and collision detection methods used can be implemented in LabVIEW.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
Message 3 of 5
(3,334 Views)

@ImNotDave wrote:

Any suggestions on ways in which I can go forward with this detecting the particle-particle collisions it would be much appreciated.


Do you want to add collision detection to the simulation, or is the simulation done and now you want to make a (vision?) algorithm to detect collisions?

0 Kudos
Message 4 of 5
(3,298 Views)

So, first correct the code to remove friction and simulate purely elastic collisions in a vacuum. An additional term for each particle would be size (fixed) and spinning rate (positive or negative, initially zero or random, but potentially non-zero after collisions), then work out the math for collisions as a function of the state of the participants. If you want to ignore spin, you could just approximate each ball (i.e. disk in 2D) and the walls (i.e lines in 2D) with steep potentials and do a pure dynamics simulation with a very fine time increment, updating the graph at a slower rate. Note that the problem complexity grows steeply with the number of particles, so start with a small number. There are many other ways to do all that, of course. This is a nice project. 

0 Kudos
Message 5 of 5
(3,262 Views)