What you learn today
- Horizontal and Vertical
- Read panel output
- The daylight sensor as a model
A solar panel costs no fuel, but it only delivers what the sun gives – and only when it faces the right way. Before we track panels automatically in a few weeks, you get to know them.
What a panel reports
| LogicType | Meaning |
|---|---|
Charge | what it currently produces, in W |
Maximum | what it could produce at most in this sun, in W |
Ratio | how well it is aligned and unshaded, 0 to 1 |
Horizontal | rotation in degrees, 0 to 360 |
Vertical | tilt in degrees, 15 to 165 |
A simple panel is rated at 500 W. That is not a hard limit: the game passes the raw output on undamped up to 1.4 times that (up to 1.6 times in a storm) and only damps what lies above. On Mars a panel therefore ends up at about 512 W under a clear sky. At night, shaded or damaged it is less. Ratio tells you whether a weak result is down to the sun or to the alignment: if Maximum is high but Ratio low, the panel points the wrong way.
Setting panels
Horizontal and Vertical can be written. With sb or sbn you set a whole field at once:
sbn PANEL HASH("Dach") Horizontal 90
sbn PANEL HASH("Dach") Vertical 60
The panel does not accept values outside its limits: below 15 degrees of tilt it becomes 15, above 165 it becomes 165. A newly built panel stands at 0 degrees rotation and 90 degrees tilt.
Only panels with a joint can be turned. Flat and angled panels (StructureSolarPanelFlat, StructureSolarPanel45 and their heavy variants) have none – Horizontal and Vertical move nothing there.
The output of a field
Outputs add up, so Sum is right here. For the alignment you take the average:
lbn output PANEL HASH("Dach") Charge Sum
lbn quality PANEL HASH("Dach") Ratio Average
The daylight sensor as the model
The daylight sensor (StructureDaylightSensor) reports where the sun is: Horizontal, Vertical and SolarAngle. Like a panel it measures relative to its own orientation. If you build it aligned the same way as your panels, you can later transfer its angles to the panels – that is the tracking that comes in the advanced part.
Average of Ratio over not a single panel is NaN, while Sum of Charge is 0. If the field is missing, the sum looks like “night”. So check the average with snan.
One name for a whole field: it is called “Dach” even if it has twelve panels. One name, one line of code.
Exercise
Task
A solar status for the roof field. On the network: solar panels “Dach”, LED displays “Solarleistung” and “Ausrichtung”, wall light “Solar aus”.
- Before the loop: all panels “Dach” to
Horizontal90 andVertical60. - “Solarleistung”: sum of
Charge, Mode Power. - “Ausrichtung”: average
Ratio, Mode Percent; if the field is missing, 0. - “Solar aus” is on when the sum is below 1 W or the field is missing.
Hints
Hint 1
Before the loop: two sbn PANEL HASH("Dach") … and both modes.
Hint 2
Output with Sum, alignment with Average.
Hint 3
If the field is missing, only the average is NaN – snan on that.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in