Hi Larry Engelhardt! chance to make a similar video to Ejs introduction that talks about the debug EJS simulations?
i tried to follow the PDF instructions but i have never used eclipse before thus, beginners like myself face a challenge following the PDF. look forward to more video tutorials on Ejs soon :)
btw: great video Getting started with EJS, an excellent tutorial by Larry Engelhardt. http://swampfox.fmarion.edu/sites/swampfox.fmarion.edu.engelhardt/files/pdfs/EJS_Tutorial/EJS_Tutorial.html by Francis Marion University Larry Engelhardt mirror here http://www.compadre.org/osp/items/detail.cfm?ID=10316
i have a blog post http://weelookang.blogspot.com/2011/02/easy-java-simulation-tutorial.html to anyone interested to learn Ejs.
I have followed those steps for debbuging EJS programs with Eclipse and my project compiles and works fine. Thanks!
Now I would like to know how to run the numerical evolution of the equations (when you push the "play" button in a EJS simulation) but without any graphical interface (using the command line and saving automatically the results of the temporal evolution in a data file). Does anyone know how to run only the "simulation" by itself without all the graphic environment?
Re: Re: PDF describing how to debug EJS simulations -
Francisco Esquembre
237 Posts
Pablo,
EJS generates code that extends basic Java classes which send the order to the view to update itself automatically.
If you are of the hacker type :-) go and see the org.colos.ejs.library.Animation.java class and inspect the methods update() and step() there.
But there is another way of doing what you want (if I understood it well) for mortals. I'd recommend the following procedure.
There is a predefined method that allows you to prevent EJS to update the view: _setUpdateView(boolean _update)
By calling _setUpdateView(false), the simulation will run the model, but the view will not be affected by changes in it... until you call _setUpdateView(true).
Some people use this trick to let the model run very quickly until meeting a given condition, without waiting for the view for the lengthy process of updating itself every time.
One more thing... trails and traces will get ALL the values generated by the model, if only they will only display them when the UpdateView is set to true again.
Re: Re: Re: PDF describing how to debug EJS simulations -
Pablo Dominguez-Garcia
2 Posts
Thank you Francisco for your answer.
Yes, maybe I am of the hacker type. Mmm.. no, not really ;)
Ok, let's try some code. I have done this:
*********** public class Principal{
public static void main(String[] args) {
particulas_v11 p = new particulas_v11(null,null,null,null,(String[])null,false);
Simulation sim = p.getSimulation();
//Does not work sim.setFPS(1);
for (int i=0; i<1000; i++) sim.step();
}
***********
If I execute that, appears my EJS "simulation" and the simulation begins and stops when the for loop ends.
What I want to do is that, but without the limitation of the FPS and without any graphical interface. I would like to run the "simulation" in a remote computer, for example. This would be very useful for doing systematic measurements by varying the input data of the "simulation".