CDL - STATS and External Extra Sensors: Difference between pages
m (→Operation) |
|||
| Line 1: | Line 1: | ||
== Introduction == |
== Introduction == |
||
{|align=right |
|||
The STATS plots a statistic of a specific Plotvariable in the chart. The normal PLOT of that variable must be present. STATS implies the ALL or DAILY range specification. |
|||
|__TOC__ |
|||
RECENT PLOTS have no STATS defined (at the moment). |
|||
|} |
|||
Sensors which the user has available but which are not logged by CumulusMX, CumulusUtils has an option available to integrate these sensors with the standard CMX sensors and plot them in whatever combination you want. As an example I use [https://cumulus.hosiene.co.uk/viewtopic.php?t=20242 the Geiger Counter] which caused this addition to be implemented. |
|||
== Operation == |
|||
A STATistic is by definition a derivative of a series of a Plotvariable e.g. the ''Standard deviation'' or a ''running average''. A Mean in itself is a single value and single value statistics are not plottable as such. They are usually reported in other ways. To be able to use the STATS for a certain Plotvariable the statistic needs to be made available in the runtime of the compiler. Technically it might be possible to supply statistics through the EVAL functionality and in some cases that might work. In general that technique is disadvised. |
|||
#All conditions for the [[Extra Sensors]] module must be met. |
|||
#CumulusUtils must be run once with the command ''ExtraSensors'' or ''Website'' to create the required parameter in the section ''[ExtraSensors]'' in the inifile. |
|||
#Set the name (or names) for External Extra Sensor in the parameter ''ExternalExtraSensors'' in the section ExtraSensors in ''cumulusutils.ini'' (e.g. ExternalExtraSensors=GeigerCounter). |
|||
#Make sure you have a datafile(s) available in the data directory of CMX with the following name: ''<sensor name>yyyyMM'' e.g. ''GeigerCounter202203.txt'' |
|||
#Make sure you run ''UserAskedData'' to make sure the External Sensor Data are available for the website in the known JSON format. |
|||
The datafile(s) have the following plain text format: |
|||
== Statistical functions == |
|||
datetime,value |
|||
The STATS keyword requires a ''Plotvariable'' on which to apply the statistics and a method to apply and a statistical method to use. |
|||
(datetime format: ''dd/MM/yy, HH:mm'', value format: ''double'') |
|||
STATS [ALL||DAILY|RECENT|EXTRA] <[[Charts_Definition_Language_(CDL)#Plotvariables|Plotvariable]]> <Statistical method> |
|||
== Output == |
|||
The following statistical methods are available in the ChartsCompiler: |
|||
The output is completely integrated in the Extra Sensor module and can not be separated from it. |
|||
#SMA - Best explained in the external Wiki: [https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average Simple Moving Average] |
|||
== Inifile Parameters == |
|||
-- To be Expanded -- |
|||
The ''External Extra Sensor'' module has the following inifile parameter (see [[cumulusutils.ini]]): |
|||
[ExtraSensors] |
|||
=== Examples === |
|||
See [[Extra Sensors]] |
|||
[[File:Schermafbeelding 2021-05-21 154949.jpg|thumb|right]] |
|||
ExternalExtraSensors=GeigerCounter[, sensor2 [,sensor3]] => A comma separated list of strings naming one or more External Extra Sensors the user wishes to use |
|||
== Inner Working == |
|||
The following example shows the Rain for all days (all observations). |
|||
When all conditions for the Extra Sensors are met and an External sensor is defined, the External Sensor is added to the internal lists of both the [[Extra Sensors]] as the [[ChartsCompiler]] and the internal datastructures of the fixed names as defined in CDL are expanded. When using the plotvariable for the external sensor the same name is used as in the definition in the inifile. So for ''ExternalExtraSensors=GeigerCounter'', the user would e.g. see a chart definition appear (when the automatic mode is selected) as follows: |
|||
In addition the yearly cumulative curve is shown and the moving average (SMA - Simple Moving Average). See image on the right. |
|||
The period for the Moving Average is given by the user as value to the parameter : ''PeriodMovingAverage''= <value> (section [graphs] |
|||
Chart External Title Trend chart of Extra External Sensors |
|||
CHART DailyRain TITLE Rain with statistics |
|||
Plot Extra GeigerCounter |
|||
PLOT ALL DayRain colour CornflowerBlue as column |
|||
PLOT ALL SumDayRain EVAL [ SUM( DayRain ) ] COLOUR crimson AXIS Free |
|||
STATS ALL DayRain SMA colour green |
|||
EndChart |
EndChart |
||
If more than one external sensor, in automatic mode all would be plotted in the one chart named External. If that is not what you want then switch to manual mode - i.e set ''UserModificationExtraSensorCharts=true'' - modify your ''CutilsCharts.def'' and run again. All other working is the same as in the standard [[Extra Sensors]] module. |
|||
[[Category:CumulusUtils]] |
[[Category:CumulusUtils]] |
||
Revision as of 19:11, 21 August 2025
Introduction
Sensors which the user has available but which are not logged by CumulusMX, CumulusUtils has an option available to integrate these sensors with the standard CMX sensors and plot them in whatever combination you want. As an example I use the Geiger Counter which caused this addition to be implemented.
Operation
- All conditions for the Extra Sensors module must be met.
- CumulusUtils must be run once with the command ExtraSensors or Website to create the required parameter in the section [ExtraSensors] in the inifile.
- Set the name (or names) for External Extra Sensor in the parameter ExternalExtraSensors in the section ExtraSensors in cumulusutils.ini (e.g. ExternalExtraSensors=GeigerCounter).
- Make sure you have a datafile(s) available in the data directory of CMX with the following name: <sensor name>yyyyMM e.g. GeigerCounter202203.txt
- Make sure you run UserAskedData to make sure the External Sensor Data are available for the website in the known JSON format.
The datafile(s) have the following plain text format:
datetime,value
(datetime format: dd/MM/yy, HH:mm, value format: double)
Output
The output is completely integrated in the Extra Sensor module and can not be separated from it.
Inifile Parameters
The External Extra Sensor module has the following inifile parameter (see cumulusutils.ini):
[ExtraSensors] See Extra Sensors ExternalExtraSensors=GeigerCounter[, sensor2 [,sensor3]] => A comma separated list of strings naming one or more External Extra Sensors the user wishes to use
Inner Working
When all conditions for the Extra Sensors are met and an External sensor is defined, the External Sensor is added to the internal lists of both the Extra Sensors as the ChartsCompiler and the internal datastructures of the fixed names as defined in CDL are expanded. When using the plotvariable for the external sensor the same name is used as in the definition in the inifile. So for ExternalExtraSensors=GeigerCounter, the user would e.g. see a chart definition appear (when the automatic mode is selected) as follows:
Chart External Title Trend chart of Extra External Sensors Plot Extra GeigerCounter EndChart
If more than one external sensor, in automatic mode all would be plotted in the one chart named External. If that is not what you want then switch to manual mode - i.e set UserModificationExtraSensorCharts=true - modify your CutilsCharts.def and run again. All other working is the same as in the standard Extra Sensors module.