summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBernhard Tittelbach <xro@realraum.at>2012-03-21 22:50:49 +0000
committerBernhard Tittelbach <xro@realraum.at>2012-03-21 22:50:49 +0000
commit2bcf9badbea62c73de533985510e5f569c4bf30f (patch)
tree75f9bb62c26da6267c5b00d91a6526131c35e43f /tools
parentmake windows compatible (diff)
improve simduration auto settings
git-svn-id: https://svn.spreadspace.org/mur.sat@326 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools')
-rwxr-xr-xtools/photodiodesim/pd_sim.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/photodiodesim/pd_sim.py b/tools/photodiodesim/pd_sim.py
index 7ff61c8..4416971 100755
--- a/tools/photodiodesim/pd_sim.py
+++ b/tools/photodiodesim/pd_sim.py
@@ -23,8 +23,8 @@ earth = [0,-1,-1]
earth_reflection_intensity = 0.10 * sun_intensity # 0 to turn earth off ;-)
moon_reflection_intensity = 0.07 * sun_intensity # 0 to turn moon off ;-)
orbit_height = 310e3 #m
-numsamples = 1000
-numperiods = 8
+numsamples = 10000
+numperiods = 4
sensors = np.matrix([
[ 1,0,0],
[ -1,0,0],
@@ -35,14 +35,15 @@ sensors = np.matrix([
])
#calculate simduration so we see numperiods periods of the smalest angular speed
-simduration = numperiods*np.pi / min(filter(lambda x: x>0.0,[w_x,w_y,w_z])) if w_x or w_y or w_z else 1.0 #in seconds
+w_xyz = np.matrix([w_x,w_y,w_z])
+duration_full_period = np.prod(np.pi / np.array(filter(lambda x: x>0.0,w_xyz))) if w_x or w_y or w_z else 1.0
+simduration = numperiods* duration_full_period #in seconds
simtimestep = simduration / numsamples #s
#calculate angle between normalvector of earthdisc and edge of earthdisc as seen from satellite
earth_radius = 6e6 #m
earth_distance = earth_radius + orbit_height #m
angle_earthdisc_visible = np.arcsin(float(earth_radius) / earth_distance )
assert(angle_earthdisc_visible < np.pi/2.0)
-w_xyz = np.matrix([w_x,w_y,w_z])
simtimeline = np.arange(0,simduration,simtimestep)
angular_speed_sum_vectors = ( w_xyz.transpose() * simtimeline ).transpose() % (2 *np.pi)
sun = sun / np.linalg.norm(sun)
@@ -53,17 +54,16 @@ angle_sun_earth = np.arccos(max(min(np.dot(sun,earth),1.0),-1.0))
print "Simulation Input:"
print "  Duration:", simduration
print "  Step Size:", simtimestep
-print "  Angular Speed x-axis [rad/s]:", w_x
-print "  Angular Speed y-axis [rad/s]:", w_y
-print "  Angular Speed z-axis [rad/s]:", w_z
+print "  Angular Speed x-axis: %.3f [rad/s] period: %.3f [s]" % (w_x, np.pi / w_x)
+print "  Angular Speed y-axis: %.3f [rad/s] period: %.3f [s]" % (w_y, np.pi/ w_y)
+print "  Angular Speed z-axis: %.3f [rad/s] period: %.3f [s]" % (w_z, np.pi/w_z)
+print "  Full period %.3f [s]" % duration_full_period
print " Earth " + ("Light intensity: %f" % earth_reflection_intensity if earth_reflection_intensity else "is switched OFF")
print " Sphere surface, covered by Earth as seen from satellite: %.2f %%" % ((earth_radius**2) / (4.0 * earth_distance**2) * 100.0)
print " Satellite " + (u"Is (!) " if angle_sun_earth < angle_earthdisc_visible else u"is not") + u" in Earth's shadow (Angle Sun-Earth: %d°)" % (angle_sun_earth /np.pi*180.0)
print ""
-
-
def getRotationMatrix(angles):
x_angle = angles[0,0]
y_angle = angles[0,1]