/// /// Copyright (c) 2017 Sensus Metering Systems /// namespace TBF.TestWizard { public enum TurningDirection { Clockwise, Counterclockwise, Count, } public class RoiData { /// Set by the wizard public int StyleIdx; public int TeethCount; public int R1; public int R2; public double PulsesPerLiter; public TurningDirection Direction; /// Calculated public int WidHgh; public int CxCy; public int R3; public int P1; public int P2; public int N; public double Q; /// [m3/h] public RoiData() { TeethCount = 1; R1 = 30; R2 = 80; PulsesPerLiter = 36.0; } /// /// Calculate additional data from data entered by the wizard /// public void Calculate() { WidHgh = 2 * R2 + 1; CxCy = R2; double acqTime; /// Duration of image sequence switch (StyleIdx) { default: case 0: R3 = (int)System.Math.Round(0.8 * R2); P1 = 1; P2 = 19; N = 10; acqTime = 3.0; break; case 1: R3 = 0; P1 = 1; P2 = 19; N = 10; acqTime = 3.0; break; case 2: R3 = 0; P1 = 1; P2 = 1; N = 10; acqTime = 3.0; break; } double vol = 360.0 / PulsesPerLiter; /// Liters per 1 rotation double flowLps = vol / acqTime; Q = 3.6 * flowLps; /// Convert to m3 / h } public string GetRoiParams() { return string.Format("{0} {0} {1} {1} {2} {3} {4} 0 360 360 {5} {6}", WidHgh, CxCy, R1, R2, R3, TeethCount, (Direction == TestWizard.TurningDirection.Clockwise) ? 1 : -1); } } }