APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Help Getting Started post and replies

Return to the Help Getting Started thread
Login to post to this thread

Help Getting Started
gary adams
1 Posts

I am trying to follow the instructions in the manual under Building a View to get started with EJS by constructing FunctionPlotter.  It seems as if this was supposed to work without defining variables; in fact the manual says "the variables have been autonomously created by the view".  But I found that I just got pink in the boxes for the variables in the View if I didn't define them in the Model first.  So, anyway, the output I get is just a straight line.  I then want to compare my resulting version of FunctionPlotter (which fails) with the one that is supposedly in _examples/Manual/View in the Simulations directory.  But I find that no such directory came with what I downloaded with EJS_4.3.7_140302.zip.  So I am a bit lost.  Any direction would be appreciated.  Thanks.   GBA

Replies to Help Getting Started

Re: Help Getting Started -
146 Posts

The EJS document is out of date.  Although EJS 4 allowed variables to be defined on the fly in the View, EjsS 5 now requires that model (global) variables be defined and initialized in Var Tables.   This change was made to standardize the API for Java and JavaScript View Elements and to reduce the possibility of programmer errors.  Some models were initializing variables in the both the View and in a Var Table and this produced inconsistent results.

You can download the EjsS source code for the Function Plotter examples from ComPADRE.



OSP Projects:
Open Source Physics - EJS Modeling
Physlet Physics
Physlet Quantum Physics
STP Book