Note that there are some explanatory texts on larger screens.

plurals
  1. POSignal value classification by limits from database
    primarykey
    data
    text
    <p>Given some signals I need to find out the state of a machine with configured min and max limits. I plan to build a table with the following structure (and example data) </p> <pre><code>| StateID | SignalID | min | max | |---------|----------|-----|-----| | 1 | 1 | 1 | 2 | | 1 | 3 | 2 | 3 | | 2 | 2 | 0 | 4 | | 3 | 2 | 5 | 9 | </code></pre> <p>thus I can find possible states by those lines valid (in the sense that the value of SignalID is between min and max). The intersection of valid states for all signal should then result in the correct state (assuming the table is complete in that way). But - as for some states maybe there is no affinity to a given signal - I think one must first iterize over the states - what somehow seems to be inefficient, or?<br> Some examples from the given table above (where fulfilled means, the SignalValue is between min and max): </p> <ul> <li>(1,2,3) -> 1 (row 1 and 2 are fulfilled) or -> 2 (row 3 fulfilled)</li> <li>(2,9,2) -> 1 (row 1 and 2 are fulfilled) or -> 3 (row 4 fulfilled)</li> <li>(3,1,3) -> 2 (only row 3 fulfilled)</li> <li>(3,8,2) -> 3 (only row 4 fulfilled)</li> </ul> <p>Starting over I have some questions:</p> <ol> <li>Can I change something in the table structure (or logic) to optimize it? </li> <li>How can I handle a state which is NOT depending on a signal WITHOUT adding a line with min=-infinity and max=infinity for that state?</li> <li>As the number of states and signals is dynamic - how to do the corresponding query efficient? Can the intersection (of a dynamic count of results) be done in SQL?</li> </ol> <p>Thanks for any ideas and help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload