Files
solarmotor/simulation.py
2026-01-15 18:36:56 +01:00

40 lines
934 B
Python

from helpers import print_status
import time
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
LOOP_DELAY = 0.005 # In seconds
# Testing embedding the mirrors in the world
board = Board()
world = World(board, tilt_deg=0)
source = Source(world, pos=(0, 50, 0))
target = Target(world, pos=(0, 50, 0))
# Create mirrors in a grid
for x in range(2):
for y in range(1):
mirror = Mirror(world, cluster_x=x, cluster_y=y)
world.add_mirror(mirror)
# Main
try:
while True:
#source.move(0, 0, 0.5)
#source.move(10 * math.sin(a * t), 10 * math.cos(a * t))
#print(source.pos)
#print(target.pos)
world.update_mirrors_from_source_target(source, target)
print_status(world)
time.sleep(LOOP_DELAY)
except KeyboardInterrupt:
pass