3D Visualisation tool of PSO particles under Borland C++ Builder 6 and OpenGL
How to Use a 3D visulaisation tool to represent particles evolution in a 3D search space.
Executable and sources are provided.
Let's start for presenting a screen capture of the application :
Each particle appears as a triangular 3D fly with an arrow in front representing its actual speed.
While in animation mode, you can see them evolving in the search space, looking for the global minima.
You can choose a particular particle which will appear in brown colour.
The particle that holds the global best appear in red. Other particles appear in pink with a blue speed arrow.
A yellow triangle (with its shadow on the ground) represents the target view point. This view point can be moved in the 3 directions and we can rotate the camera up and down, left and right around it.
The optimisation example is about the 3 angles alpha0, alpha1 and alpha2 of a multi level power electronic inverter. We compute them to apply a desired fundamental RMS component and to eliminate the first harmonics 5th and 7th. The optimisation results are provided into the data files (.dat).
The aim of this tool is to visualize, the particle swarm while it is searching over the whole place.
Programme usage
We provide 2 files : best08.dat and outgraph.dat containing the precalculated particles position and speeds.
You load the file by the menu command, then you animate.
You can stop the animation or run it step by step for better understanding of the evolution of the swarm.
This program can be used to display in 3D any object mouvement. Please refer to the program reading file function or to the file outgraph.dat format.
The camera view can be changed using 2 modes :
Mouse right button mode (when clicked):
UP zpos-=CameraMoveStep; get away from the scene.
DOWN zpos+=CameraMoveStep; get closer to the scene.
LEFT xpos-=CameraMoveStep; lateral moves.
RIGHT xpos+=CameraMoveStep;
PRIOR ypos-=CameraMoveStep;
NEXT ypos+=CameraMoveStep;
W CameraMoveStep*=1.5f; increase camera move step.
X CameraMoveStep/=1.5f; decrease camera move step (allows getting closer to objects).
Mouse move rotation up, down, left and right.
Mouse weel get closer to / away from the scene.
Normal mode (whithout clicking the mouse right button, clicking toggles between modes):
UP zpos-=CameraMoveStep; get away from the scene.
DOWN zpos+=CameraMoveStep; get closer to the scene.
LEFT xpos-=CameraMoveStep; lateral moves.
RIGHT xpos+=CameraMoveStep;
PRIOR ypos-=CameraMoveStep;
NEXT ypos+=CameraMoveStep;
W CameraMoveStep*=1.5f; increase camera move step.
X CameraMoveStep/=1.5f; decrease camera move step (allows getting closer to objects).
Z rotation up {
xrot+= 2.0f;
if (xrot>180) xrot-= 360.0f;
}
S rotation down {
xrot-= 2.0f;
if (xrot<-180.0) xrot+= 360.0f;
}
Q rotation left {
yrot+= 2.0f;
if (yrot>180) yrot-= 360.0f;
}
D rotation right {
yrot-= 2.0f;
if (yrot<-180) yrot+= 360.0f;
Other tasks:
A Animate : Start / Stop the animation which will show the evolution of particles through epochs.
The animation speed can be changed using the scroller. The epoch can also be fixed directly with the other scroller.
From menu Reset default View.
From menu Display a view option window.
From menu Start a video capture of the animation in compressed format.
Download :
If you want to compile it again, you will need Borland C++ Builder 6 and : pso_opengl_src.arj Sources in Borland C++ Builder 6.
For a direct use click below : pso_opengl.zipThe executable, ready to use.