论文部分内容阅读
针对大坝安全监测系统中存在的相关点测值实时计算问题,提出了一种基于正则表达式和条件分支的本地化的用户自定义公式计算方法,即首先通过基于栈的正则表达式,分析与检验自定义公式的合法性和结构,确定运算顺序,然后迭代地匹配出本点嵌套引用的其他测点测值定义、用户自定义函数符,并替换成数值或者系统函数调用,从而完成整个公式的运算。同时,实现基于条件分支的计算功能,使相关点计算过程中,可以按指定的条件选择相应的分支自定义公式进行计算。实践证明,本方法具有任意层相关点嵌套计算、常见数学函数支持、支持条件分支计算等优点,是一种具有良好工程应用价值的轻量级的计算方法。
In order to solve the problem of real-time calculation of relevant point value in dam safety monitoring system, a local user-defined formula calculation method based on regular expression and conditional branch is proposed. Firstly, based on the stack-based regular expression, And verify the legitimacy and structure of the custom formula, determine the order of operations, and then iteratively match the other point measurement definitions of this point nested reference, the user-defined function symbol, and replaced with a numeric or system function call to complete Calculation of the entire formula. At the same time, the calculation function based on conditional branches is realized, so that during the calculation of the relevant points, the corresponding branch custom formula can be selected according to the specified conditions for calculation. Practice has proved that this method has the advantages of nested calculation at any layer, support of common mathematical functions and support of conditional branch calculation, which is a lightweight calculation method with good engineering application value.