### Author Topic: How to add diffrent positions to trace in satellite motioin applet  (Read 27056 times)

#### ahmedelshfie

• Hero Member
• Posts: 930
##### How to add diffrent positions to trace in satellite motioin applet
« on: October 11, 2011, 07:19:18 pm »
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,

#### Fu-Kwun Hwang

• Administrator
• Hero Member
• Posts: 3062
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #1 on: October 11, 2011, 08:03:20 pm »
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.

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #2 on: October 11, 2011, 09:00:58 pm »
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,
« Last Edit: October 11, 2011, 09:02:36 pm by ahmedelshfie »

#### lookang

• Hero Member
• Posts: 1772
• http://weelookang.blogspot.com
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #3 on: October 11, 2011, 09:33:17 pm »
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.

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!

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #4 on: October 11, 2011, 09:50:41 pm »
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.

#### Fu-Kwun Hwang

• Administrator
• Hero Member
• Posts: 3062
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #5 on: October 12, 2011, 12:32:15 am »
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)

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!

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #6 on: October 12, 2011, 12:44:53 am »
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.

#### Fu-Kwun Hwang

• Administrator
• Hero Member
• Posts: 3062
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #7 on: October 12, 2011, 08:49:08 am »
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.

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #8 on: October 13, 2011, 06:21:35 pm »
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,

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #9 on: October 14, 2011, 08:38:47 pm »
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,

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #10 on: October 17, 2011, 05:16:23 pm »
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

#### Fu-Kwun Hwang

• Administrator
• Hero Member
• Posts: 3062
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #11 on: October 17, 2011, 08:49:58 pm »
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.

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #12 on: October 18, 2011, 05:18:36 pm »
Thanks for the valuable information, is work fine now, i was search in wrong side.

#### ahmedelshfie

• Hero Member
• Posts: 930
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #13 on: October 18, 2011, 08:49:20 pm »
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,

#### Fu-Kwun Hwang

• Administrator
• Hero Member
• Posts: 3062
##### Re: How to add diffrent positions to trace in satellite motioin applet
« Reply #14 on: October 18, 2011, 11:47:56 pm »
The main parameters for the above simulation are x and y.
and \$r=sqrt{x^2+y^2}\$, \$   an   heta=frac{y}{-x}\$ (cta is the variable for \$   heta\$)

You can find the above relations from constraints page in EJS.
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

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

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

and add a new variable r in the variable page (so that you can use it in view too).