添加计算的测量
From Senfi Docs
Contents
先决条件
计算的测量是需要进行设计和逻辑编程,才能使其正常运作。如果这是您第一次创建计算的测量,请先阅读本指南。
你应该
- 记下输入测量值。
- 记下要输出的参数。
- 确定要使用或重复使用的一组标签。确保有一个标签组合,可以唯一地标识输出这些参数的单元/仪器/设备。
- 准备好计算的测量的脚本。
- (可选)为您的计算的测量提供一组测试数据
Adding a New Computed Measurement
- Login to the CMS
- Go to the Computed Measurement tab
- Click the + button to add a new computed measurement.
- Give the measurement a descriptive name. This will be shown to users of the dashboard.
- Specify a measurement code.
- Select your Input Measurements
- Add tags.
- Add metrics and specify the type of each metric.
- Write the computed measurement script. See Writing the Computed Measurement Script for more details.
- (Optional) Test the computed measurement. See Testing the Computed Measurement for more details.
- Save when done.
Note: The computed measurement will be instantiated and run immediately upon saving.
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.
- Fill in init(), the initialization function
- Fill in compute(), the computation function
- Declare any global variables, if your script requires them
Note: You should not modify the function signatures of the initialization or computation functions.
Tip: The script editor will interactively notify you of any syntax errors in your script.
Testing the Computed Measurement
- Enter sample measurement data in the Testing Value editor
- Click the TEST button
- After 5 seconds, review the test output in the Testing Output panel and any console messages in the Testing Console panel.