TC7.8 - Example of how to CreateLastValuesMean.R

Test Case Title

TC7.8 - Example of how to CreateLastValuesMean.R

Goal

TBD

Prerequisites

Using a PC with a web browser. You need credentials to access to the Node-Red application.

The following functionalities are available only for specific Snap4city users with specific privileges.

Expected successful result

TBD

Steps

 

 

It’s possible to compute the average on the last 2 hours of a specific measure on a specific sensor category using the function “lastHourMean”.

Function Parameters:

  • city (It's possible to choose a city between Helsinki and Antwerp)
  • sensorCategory (For each city is possible to choose the category of sensors)
  • varName (For each category is possible to choose (only) one numeric measure/variable)

If the chosen city is "Helsinki", it’s possible to select a sensorCategory between "Noise_level_sensor" and "Weather_sensor". The varName option related to "Noise_level_sensor" category is "noiseLAeq", while the varName options related to "Weather_sensor" are "airTemperature", "airHumidity" or "windSpeed".

Example:


If the chosen city is "Antwerp", the only sensorCategory to select is "Weather_sensor". The varName options related to "Weather_sensor" are "airTemperature", "airHumidity" or "windSpeed".

Example:


NB: It can be possible that for some serviceUri the chosen varName measures are all equal to "null". In this case the mean will be equal to NA and there will be a message in the Json string that states, "No Available Measures".   

The last saved average value can be get using the GetLastSavedValuesAvg2h.R script, using the function "GetLastSavedValuesAvg2h" and the function parameter city, and sensorCategory, varName

Example:  GetLastSavedValuesAvg2h (“Helsinki”, “Noise_level_sensor”, “noiseLAeq”)

Get: CreateLastValuesMean.R   https://www.snap4city.org/download/video/CreateLastValuesMean.R

Get: GetLastSavedValuesAvg2h.R  https://www.snap4city.org/download/video/GetLastSavedValuesAvg2h.R

 

TC7.8 - Example of how to CreateLastValuesMean.R | Snap4City

Error

×

Error message

  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Notice: Trying to get property of non-object in user_is_logged_in() (line 1576 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_is_logged_in() (line 1576 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in og_field_access() (line 578 of /var/www/html/drupal/sites/default/modules/og/og.module).
  • Notice: Trying to get property of non-object in user_access() (line 806 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 818 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 819 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 825 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 828 of /var/www/html/drupal/modules/user/user.module).
  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/drupal/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/drupal/includes/bootstrap.inc).
  • Error: __clone method called on non-object in og_user_access_entity() (line 2249 of /var/www/html/drupal/sites/default/modules/og/og.module).
The website encountered an unexpected error. Please try again later.