/// <summary> /// Вычисляет значение параметра Расход на входе по Ходам Насоса с Аналогового сигнала /// </summary> /// <param name="pump1">Ходы насоса 1</param> /// <param name="pump2">Ходы насоса 2</param> /// <param name="diameter1">Диаметр цилиндра насоса 1</param> /// <param name="diameter2">Диаметр цилиндра насоса 2</param> public void Calculate(P0011 pump1, P11_1 pump2, P0014 diameter1, P14_1 diameter2) { float v = float.NaN; if (!float.IsNaN(pump1.Value)) { if (!float.IsNaN(diameter1.Value)) { v = CalculateFlow(pump1.Value, diameter1.Value) * scale_factor_1; } } if (!float.IsNaN(pump2.Value)) { if (!float.IsNaN(diameter2.Value)) { float v2 = CalculateFlow(pump2.Value, diameter2.Value) * scale_factor_2; if (!float.IsNaN(v2)) { if (float.IsNaN(v)) { v = 0; } v = v + v2; } } } _value = v; }
/// <summary> /// Вычисляет текущее значение Параметр Ходы Насоса 2 /// </summary> /// <param name="v1">Параметр Ходы Насоса 2 с Аналогового сигнала</param> /// <param name="v2">Параметр Ходы Насоса 2 АСУ</param> public void Calculate(P08_1 v1, P11_1 v2) { if (slim.TryEnterWriteLock(300)) { try { switch (_source) { case SourceMoving.Analog: _value = v1.Value; break; case SourceMoving.Asy: _value = v2.Value; break; default: break; } } finally { slim.ExitWriteLock(); } } }
/// <summary> /// Инициализирует новый экземпляр класса /// </summary> public Technology() { c_slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); cal_slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); p1 = new SGT.P0001(Guid.Empty); p2 = new SGT.P0002(Guid.Empty); p3 = new SGT.P0003(Guid.Empty); p4 = new SGT.P0004(Guid.Empty); p5 = new SGT.P0005(Guid.Empty); p6 = new SGT.P0006(Guid.Empty); p6_1 = new SGT.P06_1(Guid.Empty); p6_2 = new SGT.P06_2(Guid.Empty); p6_3 = new SGT.P06_3(Guid.Empty); p6_4 = new SGT.P06_4(Guid.Empty); p6_5 = new SGT.P06_5(Guid.Empty); p6_6 = new SGT.P06_6(Guid.Empty); p6_7 = new SGT.P06_7(Guid.Empty); p6_8 = new SGT.P06_8(Guid.Empty); p6_9 = new SGT.P06_9(Guid.Empty); p7 = new SGT.P0007(Guid.Empty); p7_1 = new SGT.P07_1(Guid.Empty); p7_2 = new SGT.P07_2(Guid.Empty); p7_3 = new SGT.P07_3(Guid.Empty); p7_4 = new SGT.P07_4(Guid.Empty); p7_5 = new SGT.P07_5(Guid.Empty); p7_6 = new SGT.P07_6(Guid.Empty); p7_7 = new SGT.P07_7(Guid.Empty); p7_8 = new SGT.P07_8(Guid.Empty); p7_9 = new SGT.P07_9(Guid.Empty); p7_10 = new SGT.P7_10(Guid.Empty); p7_11 = new SGT.P7_11(Guid.Empty); p7_12 = new SGT.P7_12(Guid.Empty); p7_13 = new SGT.P7_13(Guid.Empty); p8 = new SGT.P0008(Guid.Empty); p8_1 = new SGT.P08_1(Guid.Empty); p9 = new SGT.P0009(Guid.Empty); p9_1 = new SGT.P09_1(Guid.Empty); p9_2 = new SGT.P09_2(Guid.Empty); p9_3 = new SGT.P09_3(Guid.Empty); p9_4 = new SGT.P09_4(Guid.Empty); p9_5 = new SGT.P09_5(Guid.Empty); p9_6 = new SGT.P09_6(Guid.Empty); p9_7 = new SGT.P09_7(Guid.Empty); p9_8 = new SGT.P09_8(Guid.Empty); p9_9 = new SGT.P09_9(Guid.Empty); p9_10 = new SGT.P9_10(Guid.Empty); p9_11 = new SGT.P9_11(Guid.Empty); p9_12 = new SGT.P9_12(Guid.Empty); p9_13 = new SGT.P9_13(Guid.Empty); p10 = new P0010(Guid.Empty); p11 = new P0011(Guid.Empty); p11_1 = new P11_1(Guid.Empty); p12 = new P0012(Guid.Empty); p13 = new P0013(Guid.Empty); p14 = new P0014(Guid.Empty); p14_1 = new P14_1(Guid.Empty); p15 = new P0015(Guid.Empty); p16 = new P0016(Guid.Empty); p17 = new P0017(Guid.Empty); p18 = new P0018(Guid.Empty); p101 = new P0101(Guid.Empty); p102 = new P0102(Guid.Empty); p103 = new P0103(Guid.Empty); p104 = new P0104(Guid.Empty); p105 = new P0105(Guid.Empty); p106 = new P0106(Guid.Empty); p107 = new P0107(Guid.Empty); p108 = new P0108(Guid.Empty); p109 = new P0109(Guid.Empty); p110 = new P0110(Guid.Empty); p112 = new P0112(Guid.Empty); p113 = new P0113(Guid.Empty); p114 = new P0114(Guid.Empty); p116 = new P0116(Guid.Empty); p117 = new P0117(Guid.Empty); p118 = new P0118(Guid.Empty); p200 = new P0200(Guid.Empty); p201 = new P0201(Guid.Empty); p202 = new P0202(Guid.Empty); p203 = new P0203(Guid.Empty); p204 = new P0204(Guid.Empty); p205 = new P0205(Guid.Empty); p206 = new P0206(Guid.Empty); p207 = new P0207(Guid.Empty); p208 = new P0208(Guid.Empty); p209 = new P0209(Guid.Empty); p210 = new P0210(Guid.Empty); p211 = new P0211(Guid.Empty); p212 = new P0212(Guid.Empty); p213 = new P0213(Guid.Empty); currentTime = DateTime.MinValue; driller_console = -1; driller_console_weight_column = -1; }
/// <summary> /// Вычисляет значение параметра Расход на входе по Ходам Насоса с Аналогового сигнала /// </summary> /// <param name="pump1">Ходы насоса 1</param> /// <param name="pump2">Ходы насоса 2</param> /// <param name="diameter1">Диаметр цилиндра насоса 1</param> /// <param name="diameter2">Диаметр цилиндра насоса 2</param> public void Calculate(P0011 pump1, P11_1 pump2, P0014 diameter1, P14_1 diameter2) { float v = float.NaN; if (!float.IsNaN(pump1.Value)) { if (!float.IsNaN(diameter1.Value)) { v = CalculateFlow(pump1.Value, diameter1.Value) * scale_factor_1; } } if (!float.IsNaN(pump2.Value)) { if (!float.IsNaN(diameter2.Value)) { float v2 = CalculateFlow(pump2.Value, diameter2.Value) * scale_factor_2; if (!float.IsNaN(v2)) { if (float.IsNaN(v)) v = 0; v = v + v2; } } } _value = v; }