NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: Alex_10 on July 17, 2011, 05:29:32 pm



Title: Question about one error message./board:23-101-
Post by: Alex_10 on July 17, 2011, 05:29:32 pm
I have one question about one program that i'm programming in EJS:

I try to made the simulation of this program and i get one error "_view.drawingPanel3D.repaint(​);"


...i don't know what mean with this error message, because my simulation is in 2D and i don't have anything about 3D in my program.


This is the "applet source code" of my programm:

* Class : satelite_474Applet.java
* Generated using * Easy Java Simulations Version 4.3.3.2, build 110619. Visit http://www.um.es/fem/Ejs
*/

...package satelite_474_pkg;

import org.colos.ejs.library._Ejs​Constants;

public class satelite_474Applet extends org.colos.ejs.library.Laun​cherApplet {

static {



org.opensourcephysics.disp​lay.OSPRuntime.loadTransla​torTool = false;



org.opensourcephysics.disp​lay.OSPRuntime.loadExportT​ool = false;
}

public void init () {



super.init();



org.opensourcephysics.tool​s.ResourceLoader.addApplet​SearchPath("/");



org.opensourcephysics.tool​s.ResourceLoader.addSearch​Path(getCodeBase()+""); // This is for relative files



org.opensourcephysics.tool​s.ResourceLoader.addSearch​Path(""); // This is for relative files, too



//org.colos.ejs.library.Si​mulation.setPathToLibrary(​getCodeBase()); // This is for classes (such as EjsMatlab) which needs to know where the library is



satelite_474._addHtmlPageI​nfo("Página Intro","_default_","Página​ Intro","./satelite_474_Int​ro 1.html");



if (getParentFrame()!=null) {



_model = new satelite_474 ("drawingFrame",getParentF​rame(),getCodeBase(),this,​(String[])null,true);



_simulation = _model._getSimulation();



_view = _model._getView();



}



else {



_model = new satelite_474 (null,null,getCodeBase(),t​his,(String[])null,true);



_simulation = _model._getSimulation();



_view = _model._getView();



}



_simulation.initEmersion()​;
}
public void _reset() { ((satelite_474)_model)._re​set(); }
public void _initialize() { ((satelite_474)_model)._in​itialize(); }
public void stop() { ((satelite_474)_model)._on​Exit(); }
} // End of class satelite_474Applet
 

Someone could help me? thanks....


Title: Re: Question about one error message./board:23-101-
Post by: Fu-Kwun Hwang on July 17, 2011, 05:39:01 pm
Please upload your ejs source as attachement.

You should not compile ejs generated java file. You should use EJS to compile it for you!


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 17, 2011, 05:43:44 pm
I attach the .xml, i think that this is the file that you mean.

Thank you.


Title: Re: Question about one error message./board:23-101-
Post by: Fu-Kwun Hwang on July 17, 2011, 07:23:52 pm
1. You have defined many variables in variable panel, However, you did not provide initial values for many of those variables.
For example: You want satalite to rotate with angle o, but you never provide a value to variable o.

2. You defined a variables named as "drawingPanel3D". However, it is the same name for a 3D object(drawingPanel3D).
3. You have added two empty plottingPanel(without any GUI element in it).
There are too many strange setting in your ejs file and I do not know what you really want to do.
So I do not know how to correct it for you! 


Title: Re: Question about one error message./board:23-101-
Post by: lookang on July 18, 2011, 04:30:35 pm
I attach the .xml, i think that this is the file that you mean.

Thank you.

i think you need to remove all the codes that are creating the errors
for example
Incorrect value for transformation: ro:PosVol

i have removed all the errors, u need to put it back in with the appropriate syntax.

the key to programming in ejs could be to rename your project files at key implementation stages of new codes.

satellite_474.xml

do you have satellite_460 to share? i cannot get your source to run so i have little idea with your simulation aims to do and can do.


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 18, 2011, 05:01:53 pm
What do you mean with satellite_460?? How do you put out the error messages??  (thank you)

The salellite should turn and should be controlled for the wheel, the unic variable control is the Torque.



Title: Re: Question about one error message./board:23-101-
Post by: lookang on July 18, 2011, 05:21:43 pm
Can u find the search icon on ejs?
I look at the error codes generated from the console.
Use the search to identify the location of the search
For example "posvol"
It will show all instants where the "posvol" occur
Remove them or fix them.

It is ok not to have satellite 4xx.XML
Just start to save different versions now so if things screw up so badly, can always abandon the file n revert to older files.

Look at the new source codes for the details


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 18, 2011, 05:23:14 pm
How should i indicate the rotation of the satellite?? i wrote this "r:0,0 & ro:o" but doesn't work.


Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 18, 2011, 08:15:51 pm
May i misunderstanding something here, but when i check the xml source code, found that have many variables missed, uncompleted values, even the simulation doesn't running with me is always frozen,

by the way : I'm using the last version ejs 4.3.3.1


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 18, 2011, 08:26:38 pm
I attach the last version, anyway i don't get the rotation of the satellite.


Title: Re: Question about one error message./board:23-101-
Post by: lookang on July 18, 2011, 08:41:38 pm
Maybe u can read my source code from http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2204.0
I made a satellite too

Yes Ahmed it is not working yet


Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 19, 2011, 01:30:18 am
Well, i suggest that you can use some satellite motion examples in ntnu as a reference, applets created by prof Hwang, lookang, i believe this can help you
To watch what you miss variables page, here some examples URLs

http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=517.0 (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=517.0)

http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1877.0 (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1877.0)

http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1723.0 (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1723.0)

You can download the jar file and unzip, open xml source code using Ejs and look to variables to find what your project missed and what you need to add.











 


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 19, 2011, 10:18:10 pm
The first thing, thank you really much too all for the help. You did amazing things with EJS  :o!!! For me is new this word, but really interesting.

The second thing, i check the examples thet you sent me and the question is: do I need one string for make the rotation?

My simulation is more easy than yours, i call this object satellite, becuase in the text of the exercise was write satelite, but the real thing is that is one obeject who's move only with rotation. So..... for make the rotation (in my case that is 2D) i understood that i should create one variable string (in my case rotString "y:0").

Am i rigth?  ???


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 19, 2011, 10:20:53 pm
Could you send me more examples where one object made one move of rotation??? Thank you really much.


Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 19, 2011, 11:01:16 pm
May you attach images for what you want , for me can have idea, i can also modified applet for be like you want, but as i said will be helpful
that you attach some images show the object that you want, this help  professor Hwang, lookang and me to help  you.

For example here is a simple modified i done, the original applet created by prof Hwang.


Title: Re: Question about one error message./board:23-101-
Post by: lookang on July 20, 2011, 08:18:48 am
the applet above looks modified by ahmed! nice one :)
where is the link for the applet? it is on your board? i cannot find it


Title: RE: EJS Examples: how to import an image and let the image rotate!
Post by: Fu-Kwun Hwang on July 20, 2011, 11:20:57 am
You are welcomed to check out the following simple examples:
rotation of an image
What do you see? A frog or a horse? (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2033.0)
Fenakitiscopio (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2016.0)



Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 20, 2011, 05:05:50 pm
Thanks, yes in my board you can find at http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1723.0 (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1723.0)

For Alex_10, i hope this what you need, for you watch the applet you need to click on the eye image.

[eye][ejsapplet][/eye]
 


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 20, 2011, 10:40:00 pm
Thank you for all the things that you are sending me  ;)

I don't know miss something in my exercise but i thing i'm really close, know the satellite turn, but in one moment disappear.

I attach all the things that i have, all the information about the exercise, like this may be your answer are completily usefull for me.

1º I attach the picture of the thing that should turn, this object should have one move of rotation. Have two views but the simulation shuold be in 2D.

2º I attach the ecuations with that should have this object (satellite).

3º I attach my .xml

4º   Is a control system the angle "θ" of an axis of a satellite using a rotating wheel. To vary the angular velocity of the satellite "ω" changes the angular velocity of the wheel "v" by a motor located in the satellite.

Data:
     (Ω = v - ω) both are angular velocity.
     B = 1,01.10-6 (N.ms/rad) viscous friction coefficient.
     J1 = 13,6 kg.m2 moment of inertia of the satellite
     J2 = 13,6.10-4 kg.m2 moment of inertia of the flywheel.
     Je equivalent moment of inertia.
     T torque developed by the motor.

   


Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 20, 2011, 11:09:22 pm
Well, your XML code doesn't work with me, is frozen, i try find the reason to this error, however try look for the last applet and how rotate is work
look to variables pi,c and also look to Evolution page last variable is dc.








Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 22, 2011, 07:15:28 pm
The problem is that the simulation of Professor the move of rotational  is constant, mine is the state variable that specify the angular position.

I tried to add this variables, pi, period,.... I changed the intial values, the programm gives good the initial value, but the object disppier one second after starting the simulation.

I'm a little bit pissed with my program, I do not know what else I can change.  :-\


Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 22, 2011, 08:05:16 pm
You should to check the variable o initial value =20 , i believe this variable is the reason to object disappear when you run the applet, try check.

For example try delete o form first shape (open Satelite, down at transform you add variable o delete) and run the applet again.


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 22, 2011, 10:56:40 pm
I tried this before and doesn't work. I change all the variables, and the initial values....  ???


Title: Re: Question about one error message./board:23-101-
Post by: ahmedelshfie on July 22, 2011, 11:09:30 pm
Well, as i said in my last post to you watch object you have to delete o variable i already test this and later i run applet the object is appear. I'm gonna attach image please
Check image i attach down post.
You should to delete this variable and run applet again object will appear try it.


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 23, 2011, 06:54:04 pm
Yes this is true, but if you put out this variable the object doesn't move, is totally stop.


Title: Re: Question about one error message./board:23-101-
Post by: Fu-Kwun Hwang on July 23, 2011, 09:45:09 pm
Normally, transform is used to rotate the object or change it width or height (shape) ...etc.

If you want to move an object, you can define variable x,y and assign them to Pos X and Pos Y.
Then provide equation to specify how x,y should change with time.

e.g. if you define dx/dt=vx; then the object will move with velocity vx in x direction.


Title: Re: Question about one error message./board:23-101-
Post by: Alex_10 on July 23, 2011, 11:25:18 pm
I tried to do this also, but the problem is that i put the refence in the middle of the object, so in my case PosX = 0 and PosY = 0 all the time.

If i separate the componet x and the componet y, i would have to put the reference in a corner of the object. And i was searching this option for change the reference and i didn't find it.  ???


Title: Re: Question about one error message./board:23-101-
Post by: Fu-Kwun Hwang on July 24, 2011, 09:59:37 am
Pos X and Pos Y are (x,y) coordinate for center of the object.

The default for (x,y) is refer to middle of the object. (You can change Offset property to change it;s reference point).

You should define x,y and set Pos X, Pos Y properties to x and y.

You are welcomed to check out description for those properties at http://www.um.es/fem/EjsWiki/Main/ElementsShape2D