lixiaojun
2022-08-18 9d0a6e97890b44f2b71d2425684082100bed07a9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Model
{
    /// <summary>
    /// 二元系数换算
    /// </summary>
    public class TwiceRatioMatrix : JsonModel<TwiceRatioMatrix> 
    {
        //表达式
        private const string _expression = "ax²+bx+c";
 
        /// <summary>
        /// 系数A
        /// </summary>
        public double RatioA { get; set; } = 0;
 
        /// <summary>
        /// 系数B
        /// </summary>
        public double RatioB { get; set; } = 1;
 
        /// <summary>
        /// 系数C
        /// </summary>
        public double RatioC { get; set; } = 0;
 
        /// <summary>
        /// 换算
        /// </summary>
        public double Matrix(double value)
        {
            return RatioA * Math.Pow(value, 2) + RatioB * value + RatioC;
        }
 
        /// <summary>
        /// 获取表达式
        /// </summary>
        public string GetExpression()
        {
            return _expression;
        }
    }
}