Refactor all and add some tests for the calculations

This commit is contained in:
2026-01-15 16:12:08 +01:00
parent cc3371b73b
commit 2d067013b4
11 changed files with 161 additions and 102 deletions

View File

@@ -1,26 +1,27 @@
import time
# Solar module for simulation of world
import objects.solar as solar # Modeling of the world
from objects.generic import Source, Target
from objects.world import World
from objects.mirror import Mirror
from objects.board import Board
# Solar module for simulation of world
STEP = 10
LOOP_DELAY = 0.005 # In seconds
# Testing embedding the mirrors in the world
board = Board()
world = solar.World(board, tilt_deg=0)
world = World(board, tilt_deg=0)
HEIGHT = 30
source = solar.Source(world, pos=(0, 50, 0))
target = solar.Target(world, pos=(0, 50, 0))
source = Source(world, pos=(0, 50, 0))
target = Target(world, pos=(0, 50, 0))
# Create mirrors in a 3x2 grid
for x in range(2):
for y in range(1):
mirror = solar.Mirror(world, cluster_x=x, cluster_y=y)
mirror = Mirror(world, cluster_x=x, cluster_y=y)
world.add_mirror(mirror)
world.update_mirrors_from_source_target(source, target)
@@ -34,10 +35,10 @@ def print_status():
a = 1
t = time.time()
world.mirrors[0].phi.set_angle(180)
world.mirrors[0].theta.set_angle(180)
world.mirrors[1].phi.set_angle(0)
world.mirrors[1].theta.set_angle(0)
world.mirrors[0].motor_theta.set_angle(180)
world.mirrors[0].motor_phi.set_angle(180)
world.mirrors[1].motor_phi.set_angle(0)
world.mirrors[1].motor_theta.set_angle(0)
print_status()