#EM Simulator
EM Simulator is a 3D simulation and visualization software written in C# and XNA for electric (and soon, magnetic) fields. The simulator allows you to place point charges in a 3D world and view the resulting vector field and field lines.
##System Requirements
EM Simulator uses XNA, and thus has specific system requirements:
- Windows XP or newer
- DirectX 9 or newer compatible graphics card (Intel integrated graphics may suffice - not tested)
In the future I plan to either rewrite EM Simulator in OpenGL or utilize Mono to achieve greater platform compatibility.
##Quick Setup Express setup:
- Download the latest build under releases.
- Unzip, and run setup.exe.
- The installer will automatically install the .NET Framework 4 and XNA, if necessary.
- The installer will then automatically start EM Simulator.
- Read below for a brief introduction of how to use.
- Enjoy!
##Getting started ###Controls
- W, A, S, D, Mouse
- Move and rotate the camera in space
- Esc
- Exit EM Simulator
- Tab
- Open EM Simulator console (see below)
- F11
- Toggle Fullscreen
- F12
- Take Screenshot
- Ctrl
- Free mouse
###Console The EM Simulator console is the primary way to interact with the world: you use it to add charges, toggle vectors and field lines on or off, delete charges, etc.
The console uses Python, specificaly IronPython as an interpreter.
Math Conventions: EM Simulator uses a left-handed, Y up coordinate system.
Open the console by pressing tab.
####Examples To get familiar with the console in EM Simulator, run these examples sequentially. Use the mouse and keyboard controlls to fully interact with EM Simulator, to get the best view of the charges and electric field in the world.
Electric dipole setup
addCharge(-10,0,0,-0.2)
addCharge(10,0,0,0.2)
Now view field lines instead of vectors
toggleLines()
toggleVectors()
Add a third charge
addCharge(-5,20,25,0.4)
Now view the vector field rather than the field lines
toggleVectors()
toggleLines()
##Console Command Documentation Please refer to the wiki page for documentaion and a full list of all available console commands.
##Scripting Documentation
The EM Simulator console uses Python as interpreter.
Thus, it can elegantly load and execute Python scripts, automating commands in the console.
To see a quick demo of script execution in action, simply type run("capacitor")
in the console, and after a few seconds it will generatea parallel plate capacitor.
To make your own Python scripts, write Python code as you normally would, and then make the same Python function calls as you do in the console. For example, consider the follow Python code, which generates a row of point charges:
for x in range(0, 10):
addCharge(x,0,0,0.05)
Then, run the command openContentDir()
which will open the Content directory in Windows Explorer.
Place your Python files in the Content directory!
They should then be recognized if you run lsScripts()