Difference between revisions of "Adding a computed measurement"

From Senfi Docs
Jump to: navigation, search
Line 27: Line 27:
 
=== Writing the Computed Measurement Script ===
 
=== Writing the Computed Measurement Script ===
  
Blah
+
Fill in the script of your computed measurement in the '''Script''' editor. When you add a new computed measurement, a template script will be pre-filled for you. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 +
# Fill in '''init()''', the initialization function
 +
# Fill in '''compute()''', the computation function
 +
# Declare any global variables, if you script requires them
  
 +
Tip: The script editor will interactively notify you of any syntax errors in your script
  
 +
Note: You should not modify the function signatures of the initialization or computation functions.
  
 
=== Testing the Computed Measurement ===
 
=== Testing the Computed Measurement ===
  
Blah
+
# Enter sample measurement data in the '''Testing Value''' editor
 
+
# Click the '''TEST''' button
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
adasdd
+
After you click the TEST button, your script and sample data will be submitted and executed. The CMS will wait for up to 5 seconds for your script to execute, and the output data from your script, if any, will be shown in the '''Testing Output''' panel.
 +
Any console messages that your script calls will be shown in the '''Testing Console''' panel.

Revision as of 09:12, 17 September 2019

Pre-requisites

A computed measurement requires design and scripting in order for it to work correctly. If this is your first time creating a computed measurement, please read this guide first.

You should also be similar with the basic measurements and its concepts. Please read this section if you require a refresher.

You should

  • Note down the source measurements.
  • Note down the metrics you want to output.
  • Decide on a set of tags to use or re-use. Make sure that there is a combination of tags that will uniquely identify the unit/device/equipment that outputs those metrics.
  • Have the computed measurement script ready.
  • (Optional) Have a set of test data for your computed measurement

Adding a New Computed Measurement

  1. Login to the CMS
  2. Go to the Computed Measurement tab
  3. Click the + button to add a new computed measurement.
  4. Give the measurement a descriptive name. This will be shown to users of the dashboard.
  5. Specify a measurement code.
  6. Select your Source Measurements
  7. Add tags.
  8. Add metrics and specify the type of each metric.
  9. Write the computed measurement script. See Writing the Computed Measurement Script for more details.
  10. (Optional) Test the computed measurement. See Testing the Computed Measurement for more details.
  11. Save when done.

Writing the Computed Measurement Script

Fill in the script of your computed measurement in the Script editor. When you add a new computed measurement, a template script will be pre-filled for you.

  1. Fill in init(), the initialization function
  2. Fill in compute(), the computation function
  3. Declare any global variables, if you script requires them
Tip: The script editor will interactively notify you of any syntax errors in your script
Note: You should not modify the function signatures of the initialization or computation functions.

Testing the Computed Measurement

  1. Enter sample measurement data in the Testing Value editor
  2. Click the TEST button

After you click the TEST button, your script and sample data will be submitted and executed. The CMS will wait for up to 5 seconds for your script to execute, and the output data from your script, if any, will be shown in the Testing Output panel. Any console messages that your script calls will be shown in the Testing Console panel.