05-02-2019 05:27 PM
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.
Jordan.
05-02-2019 08:31 PM - edited 05-02-2019 08:36 PM
@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.
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?
05-02-2019 09:00 PM
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.
05-03-2019 03:41 AM
@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?
05-03-2019 11:34 AM
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.