NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
November 23, 2017, 04:42:05 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
"That their main business was not put into the mind knowledge which was not there before, but to turn the mind's eye towards light so that it might see for itself." ...Plato's advice to educators(429-347BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: How to add diffrent positions to trace in satellite motioin applet  (Read 18618 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
on: October 11, 2011, 06:19:18 pm » posted from:-,-,BRAZIL

Hi prof,
i try to add slider for have diffrent positions to satellite so will be have also diffrent velocity, for example when satellite be near from earth velocity will be more fast and when be far
velocity will be more slowly, what i need to do that add slider for me control space between satellite and earth to can shown the diffrent velocity when change positions of satellite.
In case that i talk is this satellite motion at http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2244.0
Also i need to know how when i change position the satellite trace change automatic too.

thanks,
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: October 11, 2011, 07:03:20 pm » posted from:Idrija,Bohinj,Slovenia

You need to decide what will changed when the satellite position is changed.
(because this is not going to happened in real world, it can only happened in simulated virtual world).
For example: you can keep angular momentum is the same i.e. L=r*m*v=m*r^2*\omega to be a constant.
or you can keep velocity to be  a constant.e. v=r*\omega to be a constant, or even with any change in velocity.
The easiest way is to change property of satellite: let it become drag-able. You can pause the simulation, then drag the satellite to other position, and start the simulation again.
Or you can use slider to change it distant to the center of the simulation region.

The trace will follow automatically, since it x, y properties are assigned to x,y in the model.
Try it out first, I will try to help  if you can not do it by yourself.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #2 on: October 11, 2011, 08:00:58 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

I change value of satellite image to draggable and add at variables page v=R*w also i attach two image for what i add to you can watch.
but the part that is
Quote
For example: you can keep angular momentum is the same i.e. L=r*m*v=m*r^2*\omega to be a constant.
I didn't know where i can add this value.
other thing after i change satellite image to draggable, when i drag the satellite to change postion happend like zoom to the applet, (but this not happend all times).

thanks,


* satellite image.JPG (56.4 KB, 743x306 - viewed 582 times.)

* velocity.JPG (16.94 KB, 502x99 - viewed 564 times.)
« Last Edit: October 11, 2011, 08:02:36 pm by ahmedelshfie » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #3 on: October 11, 2011, 08:33:17 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

Hi prof,
i try to add slider for have diffrent positions to satellite

thanks,

Hi ahmed
is this what u want?

so will be have also diffrent velocity, for example when satellite be near from earth velocity will be more fast and when be far
velocity will be more slowly, what i need to do that add slider for me control space between satellite and earth to can shown the diffrent velocity when change positions of satellite.
In case that i talk is this satellite motion at http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2244.0
Also i need to know how when i change position the satellite trace change automatic too.
prof hwang already has physics equation inside if u just want to change the initial position of y it is quite easy, check the jar file.

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • Please feel free to post your ideas about how to use the simulation for better teaching and learning.
  • Post questions to be asked to help students to think, to explore.
  • Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!


* ahmed.png (588.01 KB, 582x541 - viewed 792 times.)
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #4 on: October 11, 2011, 08:50:41 pm » posted from:-,-,BRAZIL

first thx for help prof, but the jar file that you upload is diffrent what i need to do, for change postion of satellite, will also change velocity of satellite also trace as prof hwang say follow
satellite with any postion, in your modification if you notice when drag slider applet zooming too much, and velocity of satellite doesn't change even near or far earth.
i tried follow and understand steps that prof hwang explain.

Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #5 on: October 11, 2011, 11:32:15 pm » posted from:Idrija,Bohinj,Slovenia

You can drag the satellite and simulate different trajectory.
You can also check the show velocity to change the velocity,too!

I just modify the satellite image (set draggable to true)!

This simulation can be used to illustrate kepler's 2nd law,too.
The # of trace points is the same (mean the same time interval), howevwr, the angle spread out is different.
It move much faster when it is closer to the earth, it move slower when it is far away from the earth.
However, the area is the same (from center of the earth, to both end of the trace)

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • Please feel free to post your ideas about how to use the simulation for better teaching and learning.
  • Post questions to be asked to help students to think, to explore.
  • Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!


* kepler3law.jpg (18.1 KB, 701x475 - viewed 629 times.)

* kepler3law2.jpg (20.07 KB, 700x477 - viewed 595 times.)

* kepler3law3.jpg (17.52 KB, 697x473 - viewed 603 times.)
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #6 on: October 11, 2011, 11:44:53 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

I do the same set satellite image draggable but also i add at variables page  v=R*w
So do you think is not necessary add V just set dragable to true.


* v.JPG (17.21 KB, 649x83 - viewed 584 times.)
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #7 on: October 12, 2011, 07:49:08 am » posted from:Idrija,Bohinj,Slovenia

It is useless if you just added variable in the model without using it as a constraint.
You will find it make no difference in the simulation if you remove it.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #8 on: October 13, 2011, 05:21:35 pm » posted from:-,-,BRAZIL

I understand, now prof i test the applet to watch the movement with diffrent positions, however is work fine but I'm now test the calculate the applet when change postion, some cases
The satellite move too fast when i keep he in the center of earth.
Thanks,
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #9 on: October 14, 2011, 07:38:47 pm » posted from:-,-,BRAZIL

hi prof, i have question: how when i drag satellite from postion to another make trace no drag together satellite and just work after i finish drag satellite to the new postion,
i want when change satellite postion trace stop still i keep satellite at the new postion that i choose trace back work without connect with the last trace postion.
I'm attached image for the applet and mark the error with red colour.
thanks, 


* error.JPG (177.07 KB, 668x540 - viewed 652 times.)
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #10 on: October 17, 2011, 04:16:23 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

prof hwang, i tried many ways to find how i can drag the satellite with tarce follow he, as the image that i attach in my last post, i tried to know how i can do it.
Please any ideas will be helpful to me.
thanks
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #11 on: October 17, 2011, 07:49:58 pm » posted from:Idrija,Bohinj,Slovenia

There are two properties which control tracedrawing:
1. Active: when it is true , a new point will be added to trace for each time step
2. Connected: when it is true, a segment will be draw to connect between last point and new added point.

You need to set Connect to false when drag.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #12 on: October 18, 2011, 04:18:36 pm » posted from:-,-,BRAZIL

Thanks for the valuable information, is work fine now, i was search in wrong side.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #13 on: October 18, 2011, 07:49:20 pm » posted from:-,-,BRAZIL

Hi porf, i have other question, for example if i want to control by value to change postion of the satellite not by drag using mouse, however
for example at applet y=R*2 so i change the value to y=R*1.5 the satellite become near from the earth.
How i can add three diffrent postions to satellite for i can change value using value input not using drag satellite image, for example i put 1.5 and click enter so satellite postion change to
this postion also if i change the value fro 1.5 to for example 2 etc..
thanks,
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #14 on: October 18, 2011, 10:47:56 pm » posted from:Idrija,Bohinj,Slovenia

The main parameters for the above simulation are x and y.
and r=\sqrt{x^2+y^2}, \tan\theta=\frac{y}{-x} (cta is the variable for \theta)

You can find the above relations from constraints page in EJS.
Code:
cta=-Math.atan2(x,y);
 r=Math.sqrt(x*x+y*y);

If you want to add slider or numerical input for r (to change r by slider or numerical input).
you need to add code (at On drag property: i.e what need to be changed when the slider were dragged).

You can add the following code for the Drag Action for the slider

Code:
cta=-Math.atan2(x,y);
 x=-Math.sin(cta);
 y=Math.cos(cta);

However, you need to change
Code:
double r,r2,r3,cst;
in Custom page to
Code:
double r2,r3,cst;

and add a new variable r in the variable page (so that you can use it in view too).
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #15 on: October 18, 2011, 11:33:33 pm » posted from:-,-,BRAZIL

Thanks prof, i follow all the steps the you explain in your last post, and slider work but it's normal that space between trace and other not be equal, i tried to make the space between
each trace and the other be equal for applet be more simple, for example if we have 3 diffrent tracks what i tried to do is be space between the three trace be equal slider move satellite normal, but when i move satellite to other postion using slider the space of the trace old and the new Trace that follow satellite not be equal, be diffrent, i really need to when change satellite to diffrent postion space be equal between all traces.
i really need help in this point too, i also attach the XML file to you can watch what i add.
PS: I'm not sure the slider if work completely right or no.
Thanks,


*** There are 1 more attached files. You need to login to acces it!
« Last Edit: October 19, 2011, 12:20:58 am by ahmedelshfie » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #16 on: October 19, 2011, 07:44:56 am » posted from:Idrija,Bohinj,Slovenia

1.  The satellite should be at location larger than the radius of the earth, so the range for r should not be from 0 to 1.
You need to change the minimumk value.
2. The velocity is kept the same , and the radius is changed. The gravitation force is different for different r.
So the trace will not be similar. It is the physics which decide the trajectory.

Please check out kepler motion and select fixed Kinetic energy from the menu (the same as your case.)

And you should find different trajectories for different r (You can drag velocity vector in the simulation to change r).

You will also need to change velocity if you want similar shape trajectory.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #17 on: October 19, 2011, 04:58:17 pm » posted from:-,-,BRAZIL

thanks too much porf for help, but i still have some questions:-
1. when i drag slider to change satellite is running too fast, what the value you suggest for me set at the minmum and mixmum value?

2.this part
Quote
You will also need to change velocity if you want similar shape trajectory.
did you mean velocity in this case is r and how i change velocity at the applet for me have similar trajectory?

3. when drag slider trajectory change as he follow the satellite, but how i can add 3 diffrent levels at slider that give three different trajectory at applet with equal space for example slider v begin by value 0.5 and center by value 1 and finish by value 1.5 each value change trajectory and in this case will have 3 diffrent trajectory with equal space.

thanks too for help.



Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #18 on: October 19, 2011, 05:45:40 pm » posted from:Taipei,T'ai-pei,Taiwan

The only thing I can say is:
The minimum value should be larger than the radius of the earth.
The maximum depend on how fast (\vec{v} and direction)and where you set it.

It is a easy problem only if it is a circular motion.
Gravitation force provide the necessary force \frac{GMm}{r^2}=m\frac{v^2}{r}
So  you can set v=\sqrt{\frac{GM}{r}}

It would become a very difficult problem if it is not circular motion.
Draw the effective potential might help(like the potential in the kepler motion page.

Remember: It is the physics law combine with initial values which decide the trajectory.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #19 on: October 19, 2011, 07:36:22 pm » posted from:-,-,BRAZIL

well, i set v=\sqrt{\frac{GM}{r}}, but how i can know the radius of the earth for i can decide the minmum value at slider?
the other part i understand.

thanks

Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #20 on: October 20, 2011, 02:51:12 pm » posted from:Taipei,T'ai-pei,Taiwan

It is not the real radius for our earth. It is the radius of the image for the earth used in the simulation.
The size x,y for the earth is twice the radius of the earth in your simulation.
You should be able to find it from property for earth's image used in EJS.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #21 on: October 20, 2011, 10:20:08 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

Dear porf hwang, thanks too much for help and support, your guide was helpful to me, i have just comment about trace, after you explain to me about the i set connected
to false i drag satellite first time work fine and trace not follow he, but when i drag for second time or more appear again that trace follow satellite to the next point i drag, how i can solve this for be can drag many times without happend it.

thanks,
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #22 on: October 21, 2011, 08:23:47 pm » posted from:Idrija,Bohinj,Slovenia

Just set connected to false would not do the job.

You do not want the trace(connected and active to false) when it is being dragged, and you want connected to be true when it is playing.

You can do the following to solve the problem:

1. add the following to drag action for the satellite
Code:
t=0;

2. set connected to t>dt , and set active to t>0
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #23 on: October 21, 2011, 10:34:25 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

Dear porf hwnag, thanks too much, you the hero, he is work fine and hte probelm be solved.
Thanks again  Cheesy
Logged
Pages: [1]   Go Up
  Print  
"That their main business was not put into the mind knowledge which was not there before, but to turn the mind's eye towards light so that it might see for itself." ...Plato's advice to educators(429-347BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
How to make the trace in a plot to clear after _initialize()
Questions related to EJS
lookang 3 6702 Last post February 16, 2009, 05:16:07 pm
by Fu-Kwun Hwang
Lesson 2: How to add trace x-t/ vx-t
EJS tutorial (How to create simulation with EJS)
Fu-Kwun Hwang 0 7478 Last post March 16, 2009, 09:59:53 pm
by Fu-Kwun Hwang
how to use the memory of Trace component
Questions related to EJS
Fred Chuit 3 5023 Last post October 10, 2009, 08:35:13 pm
by Fred Chuit
It is fun to play with prism. (light trace and intensity due to refraction)
optics
ahmedelshfie 2 7583 Last post March 05, 2016, 10:57:15 pm
by anolovers
Adding Ghost Trace images
Question related to Physics or physics related simulation
mickey2times 10 14903 Last post September 26, 2010, 11:16:55 am
by DonaSima
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 1.11 seconds with 22 queries.since 2011/06/15