=============== Developer Guide =============== ------------------- Tango device server ------------------- A :class:`~ska_mid_wms.MidWeatherMonitoring` device has been developed to publish Weather Monitoring Station data automatically to interested clients. Device properties ^^^^^^^^^^^^^^^^^ The following Tango device properties should be set: * *Host*: hostname of the Weather Station Modbus server * *Port*: port number to connect to A :class:`~ska_mid_wms.MidWeatherMonitoring` device will start in ``adminMode.OFFLINE`` and will need to be brought online e.g.: .. code-block:: bash dp = DeviceProxy("ska-mid/weather-monitoring/s1") dp.adminMode = 0 Device attributes ^^^^^^^^^^^^^^^^^ The :class:`~ska_mid_wms.MidWeatherMonitoring` Tango device uses the `ska-mid-wms-interface `_ package which publishes data for the following sensors: * windSpeed * windDirection * temperature * pressure * humidity * rainfall The Modbus addresses for these sensors are sourced from the same register section (for an Acromag 961EN-4006 the addresses are 9-14). For each of the default sensors the device server will create 4 attributes: * Engineering value - *""*. It is calculated from the ADC value using the following formula: .. math:: engineering\_value = (adc\_value - adc\_min) / (adc\_max - adc\_min) \\ * (engineering\_max - engineering\_min) + engineering\_min * ADC value read directly from the Acromag device - *"ADC"*. * The raw current reading from the sensor - *"Current"*. It is calculated from the ADC value using the following formula: .. math:: current\_value = (adc\_value - adc\_min) / (adc\_max - adc\_min) \\ * (current\_max - current\_min) + current\_min * The input signal status of the sensor read from the Acromag device - *"SignalStatus"* of type `InputSignalStatusEnum `_. There is also an extra attribute called the *rainfallRate*, which calculates the difference in absolute rainfall every minute (mm/min). Here are the current default attributes and their properties for the SKA-Mid Weather Monitoring Station Rev. B ICD issued 14 Feb 2025: +---------------+------------+--------+-------+--------+ | Attribute | Type | Unit | Min | Max | +===============+============+========+=======+========+ | windSpeed | float | m/s | 0.0 | 65.0 | +---------------+------------+--------+-------+--------+ | windDirection | float | ° | 0.0 | 360.0 | +---------------+------------+--------+-------+--------+ | temperature | float | °C | -50.0 | 50.0 | +---------------+------------+--------+-------+--------+ | pressure | float | mbar | 500.0 | 1100.0 | +---------------+------------+--------+-------+--------+ | humidity | float | % | 0.0 | 100.0 | +---------------+------------+--------+-------+--------+ | rainfall | float | mm | 0.0 | 100.0 | +---------------+------------+--------+-------+--------+ | rainfallRate | float | mm/min | 0.0 | 3.2 | +---------------+------------+--------+-------+--------+ | \*ADC | int | counts | 0 | 20000 | +---------------+------------+--------+-------+--------+ | \*Current | float | mA | 4.0 | 20.0 | +---------------+------------+--------+-------+--------+ | \*SignalStatus| Enum (int) | | 0 | 2 | +---------------+------------+--------+-------+--------+ ----------- Helm charts ----------- The repository contains a Helm chart for deploying :class:`~ska_mid_wms.MidWeatherMonitoring` Tango servers. Each individual device server pod configuration has been defined in ``charts/ska-mid-wms/weather_station_config.yaml``. By default, 5 devicer server instances are deployed to a Kubernetes cluster but is configurable in ``charts/ska-mid-wms/values.yaml`` under ``deviceServers.wms.station_ids`` - this list corresponds to the simulator instances that will be created. The :class:`~ska_mid_wms.MidWeatherMonitoring` pods expect ``Host`` and ``Port`` properties that are used to connect the pod to a weather station server. To connect to hardware simply provide the IP address and port number to connect to in the values file on ``modbus_server_hostnames`` and ``modbus_server_ports`` respectively. If the WMS simulator is used, the default values are set in the Helm chart and do not need to be changed. The length of these lists must match, and the order of the entries in these lists must correspond to the order of the station IDs in ``station_ids``. In the example below, the station ID is "1", will be used to connect to the modbus server running on "1.1.1.1:8080" .. code-block:: yaml deviceServers: wms: station_ids: ["1", "2"] modbus_server_hostnames:["1.1.1.1", "2.2.2.2"] modbus_server_ports: ["8080", "9000"] Deploying ^^^^^^^^^ Helm charts describe a Kubernetes configuration. To run a Helm chart locally it is recommended to use Minikube. The Helm chart is available from ``artefact.skao.int``. To check which remote repositories Helm knows of run: .. code-block:: bash helm repo list If ``https://artefact.skao.int/repository/helm-internal`` is not in the output, it needs to be added e.g.: .. code-block:: bash helm repo add ska-internal https://artefact.skao.int/repository/helm-internal Helm also needs to fetch the list of available packages: .. code-block:: bash helm repo update A chart can then be pulled locally (to specify a version use the ``--version`` option): .. code-block:: bash helm pull ska-internal/ska-mid-wms With Minikube started the chart can be deployed to the local cluster with: .. code-block:: bash helm install ska-mid-wms ska-internal/ska-mid-wms --create-namespace -n ska-mid-wms -f charts/ska-mid-wms/values.yaml To redeploy first delete the installation and run the ``install`` command again. .. code-block:: bash helm delete ska-mid-wms -n ska-mid-wms