-
Notifications
You must be signed in to change notification settings - Fork 1
/
solar_tracking.ic10
55 lines (45 loc) · 1.34 KB
/
solar_tracking.ic10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
alias Sensor d0 # Kit (Sensor) > Daylight Sensor
# Place daylight-sensor facing UP
alias Display d1 # Optional, Kit (Console)
alias PanelType1 d2 # Any controllable Solar Panel
alias PanelType2 d3 # Optional
alias AngleVertical r0
alias AngleHorizontal r1
alias CorrectionAngle r2
alias Panel1Hash r3
alias Panel2Hash r4
alias PanelOutput1 r5
alias PanelOutput2 r6
# define directions of sensor and panel power ports
define SENSORDATAANGLE 0
define PANELPOWERANGLE 90
# calculate horizontal correction
sub CorrectionAngle SENSORDATAANGLE PANELPOWERANGLE
sub CorrectionAngle CorrectionAngle 90
# load panel PrefabHash for later use
l Panel1Hash PanelType1 PrefabHash
bdns PanelType2 start
l Panel2Hash PanelType2 PrefabHash
# set Display to Power-mode
bdns Display start
s Display Mode 2
start:
yield
l AngleVertical Sensor Vertical
sub AngleVertical 90 AngleVertical
l AngleHorizontal Sensor Horizontal
add AngleHorizontal AngleHorizontal CorrectionAngle
bdns Display panelmove
lb PanelOutput1 Panel1Hash Charge Sum
bdns PanelType2 paneldisplay
lb PanelOutput2 Panel2Hash Charge Sum
add PanelOutput1 PanelOutput1 PanelOutput2
paneldisplay:
s Display Setting PanelOutput1
panelmove:
sb Panel1Hash Vertical AngleVertical
sb Panel1Hash Horizontal AngleHorizontal
bdns PanelType2 start
sb Panel2Hash Vertical AngleVertical
sb Panel2Hash Horizontal AngleHorizontal
j start