curves
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
curves [2020/07/30 15:29] – atolstov | curves [2022/01/14 13:40] – ↷ Links adapted because of a move operation emozolyak | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{ network: | ||
======Curves====== | ======Curves====== | ||
+ | =====Introduction===== | ||
{{ : | {{ : | ||
Curve is a way to define output value from a pre-defined pair table of a discrete set of known data points. Such as standard or desired value. | Curve is a way to define output value from a pre-defined pair table of a discrete set of known data points. Such as standard or desired value. | ||
- | It can be represented as a black-box, where is some **INPUT x** have corresponding **OUTPUT y** = f(x) | + | Curve can be represented as a function f, which is a blackbox, where is some **INPUT x** have corresponding **OUTPUT y** = f(x) |
Curve is using a piecewise linear interpolation, | Curve is using a piecewise linear interpolation, | ||
Line 36: | Line 38: | ||
{{ : | {{ : | ||
+ | =====New curve creation===== | ||
Let's create a new curve. \\ | Let's create a new curve. \\ | ||
Click on "New curve" button.\\ | Click on "New curve" button.\\ | ||
Line 53: | Line 55: | ||
At the end, when all the rest of parameters set let's look at the result . In our example it would more precise approximation of sin(x) with 7 point defined\\ | At the end, when all the rest of parameters set let's look at the result . In our example it would more precise approximation of sin(x) with 7 point defined\\ | ||
{{ : | {{ : | ||
+ | =====Select a curve to put in register===== | ||
+ | To get the value you need: | ||
+ | - Have a curve | ||
+ | - Have a string register for dashboard element to put selected curve in it | ||
+ | - Optionally, have yet another string register for store that curve all the time | ||
+ | |||
+ | Now, it is time to create a register with value type " | ||
+ | |||
+ | Then, create a new dashboard. | ||
+ | {{ : | ||
+ | Click the "Add dashboard" | ||
+ | {{ : | ||
+ | Type in the Title and go on. | ||
+ | {{ : | ||
+ | Go to a visual editor. | ||
+ | |||
+ | |||
+ | To do this, there is a dashboard element " | ||
+ | {{ : | ||
+ | Drag' | ||
+ | {{ : | ||
+ | |||
+ | Pick a register to be used later in Lua script to get value. | ||
+ | {{ : | ||
+ | Let's test it. | ||
+ | Now, you need to put the curve to string register via dashboard. | ||
+ | {{ : | ||
+ | Click and select the one you want to pick. There is a icon for open curve editor. | ||
+ | {{ : | ||
+ | There is a picked one. | ||
+ | {{ : | ||
+ | | ||
+ | {{ : | ||
+ | |||
+ | =====Get value from the curve via Lua ===== | ||
To get the **OUTPUT y value** from existing(pre-created) curve, you need: | To get the **OUTPUT y value** from existing(pre-created) curve, you need: | ||
Line 98: | Line 135: | ||
<code lua - Getter> | <code lua - Getter> | ||
include " | include " | ||
+ | SAFE_VALUE = 10 | ||
function main (userId) | function main (userId) | ||
Line 104: | Line 142: | ||
current_hour = tonumber(t.hour) | current_hour = tonumber(t.hour) | ||
curve_status, | curve_status, | ||
- | WriteReg(" | + | |
+ | | ||
+ | else | ||
+ | WriteReg(" | ||
+ | end | ||
+ | | ||
end | end |
curves.txt · Last modified: 2024/06/03 08:45 by emozolyak