4
lixiaojun
2024-08-08 f8dc11ea4cf77079f91652ba90b1643778c46f7b
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Yw.EPAnet.Calcu
{
 
    public class LinkModel : BaseModel
    {
        public LinkModel() { }
 
        public LinkModel(LinkModel model) : base(model)
        {
            this.Node1 = model.Node1;
            this.Node2 = model.Node2;
            this.Diameter = model.Diameter;
            this.Length = model.Length;
            this.Roughness = model.Roughness;
            this.MinorLoss = model.MinorLoss;
 
        }
        /// <summary>
        /// Node1
        /// </summary>
        public virtual string Node1 { get; set; }
 
        /// <summary>
        /// Node2
        /// </summary>
        public virtual string Node2 { get; set; }
 
 
 
 
 
 
        /// <summary>
        /// 口径
        /// </summary>
        public virtual float Diameter { get; set; }
 
        /// <summary>
        /// 长度
        /// </summary>
        public virtual float Length { get; set; }
 
        /// <summary>
        /// 海森威廉系数
        /// </summary>
        public virtual float Roughness { get; set; }
 
        /// <summary>
        /// 局部阻力系数
        /// </summary>
        public virtual float MinorLoss { get; set; }
 
        public virtual string ToStatusString()
        {
            if (Status == ObjectEnum.StatusType.CLOSED)
            {
                return $"{ID}\tCLOSED\r\n";
            }
            return "";
        }
    }
 
    public class LinkCalcModel : LinkModel
    {
        public LinkCalcModel() { }
 
        public LinkCalcModel(LinkCalcModel model) : base(model)
        {
            this.Node1 = model.Node1;
            this.Node2 = model.Node2;
            this.Diameter = model.Diameter;
            this.Length = model.Length;
            this.Roughness = model.Roughness;
            this.MinorLoss = model.MinorLoss;
        }
 
        public string Node1
        {
            get
            {
                if (_StartNode != null) return _StartNode.ID;
                return base.Node1;
            }
            set
            {
 
                base.Node1 = value;
            }
        }
 
        public string Node2
        {
            get
            {
                if (_EndNode != null) return _EndNode.ID;
                return base.Node2;
            }
            set
            {
                base.Node2 = value;
            }
        }
 
 
        private NodeCalcModel _StartNode;
 
        public NodeCalcModel StartNode
        {
            get { return _StartNode; }
            set { _StartNode = value; if (_StartNode != null) this.Node1 = _StartNode.ID; }
        }
 
        private NodeCalcModel _EndNode;
 
        public NodeCalcModel EndNode
        {
            get { return _EndNode; }
            set { _EndNode = value; if (_EndNode != null) this.Node2 = _EndNode.ID; }
        }
 
        /// <summary>
        /// 长度
        /// </summary>
        public float Length
        {
            get
            {
                if (base.Length > 0) return base.Length;
                else
                {
                    if (_StartNode != null && _EndNode != null)
                    {
                        ////求_StartNode到_EndNode的距离
                        return (float)Math.Sqrt(Math.Pow(_StartNode.X - _EndNode.X, 2) + Math.Pow(_StartNode.Y - _EndNode.Y, 2) + Math.Pow(_StartNode.Elev - _EndNode.Elev, 2));
                    }
                    else
                    {
                        return 0;
                    }
                }
            }
            set
            {
                base.Length = value;
            }
        }
 
        //实际需水量
        [Category("计算结果")]
        [DisplayName("流量(m³/h)")]
        [Browsable(true)]
        public float EN_FLOW { get; set; } = float.NaN;
 
        //实际需水量
        [Category("计算结果")]
        [DisplayName("流速(m/s)")]
        [Browsable(true)]
        public float EN_VELOCITY { get; set; } = float.NaN;
        //实际需水量
        [Category("计算结果")]
        [DisplayName("水头损失(m)")]
        [Browsable(true)]
        public float EN_HEADLOSS { get; set; } = float.NaN;
 
        [Category("计算结果")]
        [DisplayName("沿程水损(m)")]
        [Browsable(true)]
        public float EN_HEADLOSS_LINE { get; set; } = float.NaN;
 
        [Category("计算结果")]
        [DisplayName("局部水损(m)")]
        [Browsable(true)]
        public float EN_HEADLOSS_MINOR { get; set; } = float.NaN;
        //实际需水量
        [Category("计算结果")]
        [DisplayName("当前状态")]
        [Browsable(false)]
        public float EN_STATUS { get; set; } = float.NaN;
        [Category("其他参数")]
        [Description("选中")]
        [DisplayName("选中")]
        [Browsable(false)]
        public bool Selected { get; set; }
 
        [Category("其他参数")]
        [Description("鼠标悬于上方")]
        [DisplayName("鼠标悬于上方")]
        [Browsable(false)]
        public bool Hovered { get; set; }
    }
 
 
 
}