|
Instrument Neutral Distributed Interface INDI 2.2.5
|
Provides interface to implement weather reporting and safety monitoring functionality. More...
#include <indiweatherinterface.h>
Protected Types | |
| enum | { MIN_OK , MAX_OK , PERCENT_WARNING , FLIP_RANGE_TEST } |
Protected Member Functions | |
| WeatherInterface (DefaultDevice *defaultDevice) | |
| virtual | ~WeatherInterface () |
| void | initProperties (const char *statusGroup, const char *paramsGroup) |
| Initialize focuser properties. It is recommended to call this function within initProperties() of your primary device. | |
| bool | updateProperties () |
| updateProperties Define or Delete Rotator properties based on the connection status of the base device | |
| bool | processNumber (const char *dev, const char *name, double values[], char *names[], int n) |
| Process weather number properties. | |
| bool | processSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) |
| Process weather switch properties. | |
| void | checkWeatherUpdate () |
| checkWeatherUpdate Calls updateWeather and update critical parameters accordingly. | |
| virtual IPState | updateWeather () |
| updateWeather Update weather conditions from device or service. The function should not change the state of any property in the device as this is handled by Weather. It should only update the raw values. | |
| virtual bool | saveConfigItems (FILE *fp) |
| saveConfigItems Save parameters ranges in the config file. | |
| void | addParameter (std::string name, std::string label, double numMinOk, double numMaxOk, double percWarning, bool flipWarning=false) |
| Add a physical weather measurable parameter to the weather driver. | |
| bool | setCriticalParameter (std::string name) |
| setCriticalParameter Set parameter that is considered critical to the operation of the observatory. The parameter state can affect the overall weather driver state which signals the client to take appropriate action depending on the severity of the state. | |
| void | setParameterValue (std::string name, double value) |
| setParameterValue Update weather parameter value | |
| IPState | checkParameterState (const std::string ¶m) const |
| Checks the given parameter against the defined bounds. | |
| bool | syncCriticalParameters () |
| Synchronize and update the state of all critical parameters. | |
Protected Attributes | |
| INDI::PropertyNumber | ParametersNP {0} |
| std::vector< INDI::PropertyNumber > | ParametersRangeNP |
| INDI::PropertyLight | critialParametersLP {0} |
| INDI::PropertyLight | SafetyStatusLP {1} |
| INDI::PropertyNumber | UpdatePeriodNP {1} |
| INDI::PropertySwitch | RefreshSP {1} |
| INDI::PropertySwitch | OverrideSP {1} |
Provides interface to implement weather reporting and safety monitoring functionality.
The WeatherInterface class provides a comprehensive framework for implementing weather monitoring and observatory safety systems. It allows devices to report weather conditions and determine if the environment is safe for observatory operations.
The weather functionality can be implemented in two ways:
The interface provides:
Weather parameters represent physical measurements such as:
Each parameter has configurable ranges that determine its state:
The interface supports two models for evaluating parameters:
The flipped model is useful for parameters where extreme values indicate good conditions (e.g., cloud sensors where very low/high readings indicate clear skies).
When developing a driver:
In your driver, call the necessary weather interface functions:
| Function | Where to call it from your driver |
|---|---|
| WI::initProperties | initProperties() |
| WI::updateProperties | updateProperties() |
| WI::processNumber | ISNewNumber(...) Check if the property name contains WEATHER_* and then call WI::processNumber(..) for such properties |
| WI::processSwitch | ISNewSwitch(...) Check if the property name contains WEATHER_* and then call WI::processSwitch(..) for such properties |
You must implement the updateWeather() method to update the raw values of your weather parameters. This method should not change the state of any property, as that is handled by the WeatherInterface.
A typical implementation would:
The INDI Pegasus Ultimate Power Box driver is a good example of an actual implementation of a weather interface within an auxiliary driver.
Definition at line 132 of file indiweatherinterface.h.
|
protected |
| Enumerator | |
|---|---|
| MIN_OK | |
| MAX_OK | |
| PERCENT_WARNING | |
| FLIP_RANGE_TEST | |
Definition at line 286 of file indiweatherinterface.h.
|
explicitprotected |
Definition at line 32 of file indiweatherinterface.cpp.
|
protectedvirtual |
Definition at line 39 of file indiweatherinterface.cpp.
|
protected |
Add a physical weather measurable parameter to the weather driver.
The weather value has three zones:
The warning zone is calculated as a percentage of the range between min and max values. For example, if min=0, max=100, and percWarning=10, then:
| name | Name of parameter |
| label | Label of parameter (in GUI) |
| numMinOk | minimum Ok range value. |
| numMaxOk | maximum Ok range value. |
| percWarning | percentage for Warning. |
| flipWarning | boolean indicating if range warning should be flipped to in-bounds, rather than out-of-bounds. When true, the evaluation model is flipped so that values outside min/max limits are considered GOOD, values in warning zones are WARNING, and values in the middle zone are DANGER. This is useful for parameters where extreme values indicate good conditions. |
The weather value has three zones:
The warning zone is calculated as a percentage of the range between min and max values. For example, if min=0, max=100, and percWarning=10, then:
| name | Name of parameter |
| label | Label of parameter (in GUI) |
| numMinOk | minimum Ok range value. |
| numMaxOk | maximum Ok range value. |
| percWarning | percentage for Warning. |
| flipWarning | boolean indicating if range warning should be flipped to in-bounds, rather than out-of-bounds |
Definition at line 313 of file indiweatherinterface.cpp.
|
protected |
Checks the given parameter against the defined bounds.
This method evaluates a parameter's value against its defined ranges and determines its state. The state can be one of:
There are two models for parameter evaluation:
The flipped model is useful for parameters where values below minimum or above maximum are actually good conditions (e.g., certain atmospheric measurements where extreme values indicate clear conditions).
| param | Name of parameter to check |
This method evaluates a parameter's value against its defined ranges and determines its state. The state can be one of:
There are two models for parameter evaluation:
The flipped model is useful for parameters where values below minimum or above maximum are actually good conditions (e.g., certain atmospheric measurements where extreme values indicate clear conditions).
| name | Name of parameter to check |
Definition at line 404 of file indiweatherinterface.cpp.
|
protected |
checkWeatherUpdate Calls updateWeather and update critical parameters accordingly.
Definition at line 124 of file indiweatherinterface.cpp.
|
protected |
Initialize focuser properties. It is recommended to call this function within initProperties() of your primary device.
| statusGroup | group for status properties |
| paramsGroup | group for parameter properties |
Definition at line 43 of file indiweatherinterface.cpp.
|
protected |
Process weather number properties.
Definition at line 244 of file indiweatherinterface.cpp.
|
protected |
Process weather switch properties.
Definition at line 195 of file indiweatherinterface.cpp.
|
protectedvirtual |
saveConfigItems Save parameters ranges in the config file.
Save parameters ranges in the config file.
| fp | pointer to open config file |
This method saves the update period and all parameter ranges to the configuration file.
| fp | Pointer to open config file |
Reimplemented in WunderGround, IndiAstrolink4, IndiAstroLink4mini2, PegasusFlatMasterNeo, WandererBoxPlusV3, WandererBoxProV3, CelestronDewPower, myDewControllerPro, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, TerransPowerBoxProV2, LX200_OnStep, AAGSolo, OpenWeatherMap, UranusMeteo, WeatherSafetyAlpaca, WeatherSafetyProxy, WeatherFlow, WeatherSimulator, WeatherWatcher, and INDI::Weather.
Definition at line 566 of file indiweatherinterface.cpp.
|
protected |
setCriticalParameter Set parameter that is considered critical to the operation of the observatory. The parameter state can affect the overall weather driver state which signals the client to take appropriate action depending on the severity of the state.
Set parameter that is considered critical to the operation of the observatory.
| name | Name of critical parameter. |
The parameter state can affect the overall weather driver state which signals the client to take appropriate action depending on the severity of the state.
| name | Name of critical parameter. |
Definition at line 348 of file indiweatherinterface.cpp.
|
protected |
setParameterValue Update weather parameter value
Update weather parameter value.
| name | name of weather parameter |
| value | new value of weather parameter; |
| name | name of weather parameter |
| value | new value of weather parameter |
Definition at line 332 of file indiweatherinterface.cpp.
|
protected |
Synchronize and update the state of all critical parameters.
This method checks the state of all critical parameters and updates their individual states as well as the overall state of the weather system. The overall state is determined by the worst individual state.
Definition at line 465 of file indiweatherinterface.cpp.
|
protected |
updateProperties Define or Delete Rotator properties based on the connection status of the base device
Definition at line 79 of file indiweatherinterface.cpp.
|
protectedvirtual |
updateWeather Update weather conditions from device or service. The function should not change the state of any property in the device as this is handled by Weather. It should only update the raw values.
Reimplemented in WunderGround, IndiAstrolink4, IndiAstroLink4mini2, PegasusFlatMasterNeo, WandererBoxPlusV3, WandererBoxProV3, CelestronDewPower, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, TerransPowerBoxProV2, LX200_OnStep, AAGSolo, HitechWeather, MBox, OpenWeatherMap, UranusMeteo, Vantage, WeatherSafetyAlpaca, WeatherSafetyProxy, WeatherFlow, WeatherSimulator, and WeatherWatcher.
Definition at line 286 of file indiweatherinterface.cpp.
|
protected |
Definition at line 295 of file indiweatherinterface.h.
|
protected |
Definition at line 306 of file indiweatherinterface.h.
|
protected |
Definition at line 282 of file indiweatherinterface.h.
|
protected |
Definition at line 285 of file indiweatherinterface.h.
|
protected |
Definition at line 303 of file indiweatherinterface.h.
|
protected |
Definition at line 298 of file indiweatherinterface.h.
|
protected |
Definition at line 301 of file indiweatherinterface.h.