Programming - First steps
P.
98 of 349
With the picture function, we add a wind indicator which shows the wind directions in Germany.
[
Webserver
]
picture(9)[DOUBLE,ZOOMGRAF]($Wind directions$,$http://wwwdyn.zdf.de/ext/weather/wind-brd-0.jpg$)
We also place a temperature profile of the last 24 hours with the timechart function.
[
Webserver
]
mtimechart(8)[QUAD,NOAUTOSCALE,48,-10,45]( $Outdoor temperature$,LEFTGRAF, ChartBuffer1)
In order for the timechart to know which values it should represent, we must make the following
configurations:
timebufferconfig
(
ChartBufferID, MemTyp, Laenge, DataTyp
)
MemTyp
indicates whether the memory is written in the ring (0) or linear (1). The length of the max.
Recording of the time series is indicated with length (0u16 to 65565u16).
DataType
represents a
representative number of the time series, e.g. 0f16 for 16-bit numbers or 3% for u08 values.
Now the time series have to be "filled" with data. The function
timebufferadd
(
ChartBufferID, Daten
)
does this task.
After the time series has been recorded for some time in the Enertex® EibPC, it must be ensured
that these values are not lost even when the program is restarted or rebooted. The functions
timebufferstore
(
ChartBufferID
)
timebufferread
(
ChartBufferID
)
are created for this task.
timebufferstore
permanently stores the values of the timebuffer with the
ChartBufferID
into the flash memory of the Enertex® EibPC,
timebufferread
reads back a stored
buffer.
button(ELEVATION)[WEATHER]$Height angle in °$ button(SunAltitude)[UP]$Altitude of sun$
button(AZIMUTH)[WEATHER]$AZIMUTH$ pbutton(23)[CLOCK]$Highest altitude of sun:$
[
EibPC
]
//mtimechart
Len=35040u16
Datatyp=3.3f16
MemTyp=0
timebufferconfig(ChartBuffer1, MemTyp, Len,"Outdoor temperature-14/6/3" )
if mtime(0,0) or mtime(15,0) or mtime(30,0) or mtime(45,0) then
{timebufferadd(ChartBuffer1,"Outdoor temperature-14/6/3")
} endif
if chtime(01,00,00) then {
timebufferstore(ChartBuffer1)
} endif
if systemstart() then {
timebufferread(ChartBuffer1)
} endif
Thus, the temperature profile would be displayed correctly. By using the timechart even better, we
add the sun's course. For this we need the azimuth angle and the elevation angle of the sun. We get
these two data through the functions
azimuth
()
Height of elevation:
elevation
()
The Enertex® EibPC must know the geographic location and latitude of the location. These can be
entered in the Enertex® EibStudio (see page 150). To get to your coordinates and further
information,
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]