9439
|
1 package test.bundu; |
|
2 |
|
3 import java.io.IOException; |
|
4 import java.util.ArrayList; |
|
5 import java.util.List; |
|
6 |
|
7 import org.dive4elements.river.client.shared.exceptions.ServerException; |
|
8 import org.junit.Test; |
|
9 |
|
10 import test.AbstractBerechnungsartenTester; |
9567
|
11 import test.FilenameSupplier; |
9439
|
12 import test.ICalcMode; |
|
13 |
9570
|
14 //@Ignore |
9439
|
15 public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester { |
|
16 |
9567
|
17 private static final String BUNDU_WST_DEFAULT_EXPORT_MODE = "bundu_wst_export"; |
|
18 private static final String BUNDU_WSPL_LONGITUDINAL_SECTION_MODE = "bundu_wspl_longitudinal_section"; |
|
19 |
|
20 private static final String BUNDU_BEZUGSWST_AUTO_FIX_CHOICE = "state.bundu.wst.fix.auto"; |
|
21 |
9439
|
22 public static enum CalcMode implements ICalcMode { |
|
23 bundu_bezugswst, // |
|
24 // der Vollständigkeit halber |
|
25 bundu_analysis, bundu_vollmer |
|
26 }; |
|
27 |
9567
|
28 final FilenameSupplier BEZUGSWST_FILE = new FilenameSupplier("/bundu/bezugswst/bezugswst.csv"); |
|
29 final FilenameSupplier BEZUGSWST_02_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_02.csv"); |
|
30 final FilenameSupplier BEZUGSWST_02_CHART_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_02_chart.csv"); |
|
31 final FilenameSupplier BEZUGSWST_03_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_03.csv"); // |
9439
|
32 |
9442
|
33 // public static final LinkedHashMap<String, String> getMapValues(final FLYSConstants MSG) { |
|
34 // final LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>(); |
|
35 // mapValues.put("0", MSG.gauge_mnq()); |
|
36 // mapValues.put("1", MSG.gauge_mq()); |
|
37 // mapValues.put("2", MSG.gauge_mhq()); |
|
38 // mapValues.put("3", MSG.gauge_hq5()); |
|
39 // return mapValues; |
|
40 // } |
9439
|
41 |
9567
|
42 // @Test |
|
43 public void testBezugswst_HELLO_WORLD() throws ServerException, IOException { |
|
44 |
9442
|
45 /* WQ-Input */ |
9567
|
46 // FIXME: normally provided by state, but we do not have access to server-side at this point. |
9439
|
47 final List<Segment> segments = new ArrayList<Segment>(); |
9442
|
48 // gauge, fromKm, toKm, Q-Input |
9567
|
49 segments.add(new Segment("Köln", 670., 703.3, 1060.)); |
|
50 segments.add(new Segment("Düsseldorf", 703.4, 710., 1090.)); |
9439
|
51 |
9442
|
52 /* Abflussklassen */ |
|
53 // MSG won't work here! |
|
54 // final LinkedHashMap<String, String> map = FixGaugeSelectPanel.getMapValues(MSG); |
|
55 // final String mnq = MSG.gauge_mnq(); |
|
56 // final String hq5 = MSG.gauge_hq5(); |
9439
|
57 |
9442
|
58 final String abflussklasseFrom = "0"; // map.get(mnq); |
|
59 final String abflussklasseTo = "3";// map.get(hq5); |
|
60 |
|
61 /* Function */ |
|
62 // from FixFunctionSelect: |
|
63 // funcDesc.put("log", "W(Q) = m*ln(Q + b)"); |
|
64 // funcDesc.put("linear", "W(Q) = m * Q + b"); |
|
65 // funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)"); |
|
66 // funcDesc.put("exp", "W(Q) = m * a^Q + b"); |
|
67 // funcDesc.put("quad", "W(Q) = n*Q^2+m*Q+b"); |
|
68 // funcDesc.put("pow", "W(Q) = a * Q^c + d"); |
|
69 // funcDesc.put("sq-pow", "S(Q) = a * Q^b"); |
|
70 |
|
71 final String function = "log"; |
|
72 |
|
73 /* calc-choice (has to be set due to state-transition-conditions) */ |
|
74 // state.bundu.wst.calc.manual |
|
75 // state.bundu.wst.calc.auto |
|
76 final String calcChoice = "state.bundu.wst.calc.auto"; |
|
77 |
|
78 /* fixation-choice (has to be set due to state-transition-conditions) */ |
|
79 // "state.bundu.wst.fix.auto" |
|
80 // state.bundu.wst.fix.manual; |
|
81 final String fixChoice = "state.bundu.wst.fix.auto"; |
|
82 |
|
83 /* Soundings */ |
|
84 // --> Debug at ParameterMatrixPanel.getData |
9567
|
85 final String sounding = "single-95"; // TESTs |
9442
|
86 /* events - have to be set also when auto is selected */ |
|
87 // --> get ids by debugging FixCalculation line 73 (constructor) |
9439
|
88 final int[] events = new int[] { 1465, 1466, 1452, 1453, 1472, 1473, 1478, 1479, 1604, 1605, 1317, 1318, 1353, 1354, 1596, 1597, 1323, 1324, 1345, 1346, |
9442
|
89 1330, 1331, 1458, 1459 }; |
9439
|
90 |
9567
|
91 final boolean preprocessing = false; |
|
92 final boolean missingVolume = false; |
|
93 |
9570
|
94 new BunduBezugswstRunner(super.testFolder, 670.0, 710., 100., River.Rhein, 2014, fixChoice, function, abflussklasseFrom, abflussklasseTo, events, 40, |
|
95 segments, calcChoice, preprocessing, missingVolume, null, null, sounding)// |
9567
|
96 .addOutputTest(this.BEZUGSWST_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null)// |
|
97 .runTest(); |
|
98 } |
|
99 |
|
100 @Test |
|
101 public void testBezugswst02() throws ServerException, IOException { |
|
102 |
|
103 final List<Segment> segments = new ArrayList<Segment>(); |
|
104 // gauge, fromKm, toKm, Q-Input |
|
105 segments.add(new Segment("Maxau", 336.2, 384.8, 1257.)); |
|
106 segments.add(new Segment("Speyer", 384.9, 428.1, 1278.)); |
|
107 segments.add(new Segment("Worms", 428.2, 496.6, 1418.)); |
|
108 segments.add(new Segment("Mainz", 496.7, 529.1, 1605.)); |
|
109 segments.add(new Segment("Kaub", 529.2, 585.7, 1659.)); |
|
110 segments.add(new Segment("Koblenz", 585.8, 592.3, 1715.)); |
|
111 segments.add(new Segment("Andernach", 592.4, 621, 2030.)); |
|
112 |
|
113 final String fixChoice = "state.bundu.wst.fix.auto"; |
|
114 |
|
115 final String calcChoice = "state.bundu.wst.calc.manual"; |
|
116 |
|
117 final String abflussklasseFrom = "0"; // map.get(mnq); |
|
118 final String abflussklasseTo = "3";// map.get(hq5); |
|
119 |
|
120 final int[] events = new int[] { 1524, 1523, 1522, 1521, 1520, 1519, 1518, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1311, 1302, 1301, 1300, 1299, 1298, |
|
121 1297, 1296, 1397, 1396, 1395, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1566, 1565, 1564, 1563, 1540, 1539, 1538, 1537, 1536, 1535, 1534, |
|
122 1533, 1494, 1493, 1492, 1491, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1407, 1406, 1405, 1404, 1440, 1441, 1442, 1443, 1567, 1568, 1569, |
|
123 1570, 1500, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1498, 1362, 1398, 1399, 1400, 1444, 1445, 1446, 1401, 1402, 1403, 1363, 1447, 1448, |
|
124 1449, 1364, 1501, 1365, 1367, 1368, 1369, 1366, 1370, 1371, 1495, 1496, 1497, 1295, 1408, 1409, 1410, 1490, 1360, 1422, 1428, 1411, 1412, 1413, |
|
125 1437, 1438, 1439, 1450, 1361, 1424, 1431, 1423, 1432, 1433, 1503, 1504, 1505, 1506, 1507, 1499, 1429, 1430, 1571, 1572, 1573, 1434, 1435, 1427, |
|
126 1436, 1307, 1303, 1304, 1305, 1308, 1508, 1509, 1510, 1511, 1512, 1309, 1574, 1575, 1576, 1577, 1578, 1579, 1310, 1314, 1315, 1372, 1373, 1374, |
|
127 1375, 1376, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588 |
|
128 |
|
129 }; |
|
130 |
|
131 // --> Debug at ParameterMatrixPanel.getData |
|
132 final String sounding = "single-83"; // 2006 |
|
133 |
|
134 final boolean preprocessing = true; |
|
135 final boolean missingVolume = true; |
|
136 |
9570
|
137 new BunduBezugswstRunner(super.testFolder, 336.2, 621., 100, River.Rhein, 2010, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 10, |
|
138 segments, calcChoice, preprocessing, missingVolume, 400., 401., sounding)// |
9567
|
139 .addOutputTest(this.BEZUGSWST_02_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) // |
|
140 .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no currentKM |
|
141 .runTest(); |
|
142 } |
|
143 |
|
144 @Test |
|
145 public void testBezugswst03() throws ServerException, IOException { |
|
146 /* WQ-Input */ |
|
147 final List<Segment> segments = new ArrayList<Segment>(); |
|
148 |
|
149 segments.add(new Segment("Worms", 428.2, 496.6, 487.)); |
|
150 segments.add(new Segment("Mainz", 496.7, 529.2, 583.)); |
|
151 |
|
152 final String fixChoice = BunduBerechnungsartenTester.BUNDU_BEZUGSWST_AUTO_FIX_CHOICE; |
|
153 final String calcChoice = "state.bundu.wst.calc.manual"; |
|
154 |
|
155 final String abflussklasseFrom = "0"; // map.get(mnq); |
|
156 final String abflussklasseTo = "3";// map.get(hq5); |
|
157 |
|
158 // FIXME auto auswahl? |
|
159 // --> get ids by debugging FixCalculation line 73 (constructor) |
|
160 final int[] events = new int[] { 1440, 1569, 1570, 1543, 1544, 1545, 1399, 1400, 1444, 1402, 1403, 1368, 1369, 1496, 1497, 1409, 1410, 1428, 1412, 1413, |
|
161 1437, 1424, 1431, 1504, 1505, 1429, 1572, 1573, 1434, 1427, 1304, 1305, 1509, 1510, 1575, 1576, 1578, 1579, 1315, 1373, 1374, 1581, 1582, 1584, |
|
162 1585, 1587, 1588, 1590, 1591, 1514, 1515, 1415, 1416 }; |
|
163 |
|
164 // --> Debug at ParameterMatrixPanel.getData |
|
165 final String sounding = "single-103"; // |
|
166 |
|
167 final boolean preprocessing = true; |
|
168 final boolean missingVolume = true; |
|
169 |
9570
|
170 new BunduBezugswstRunner(super.testFolder, 430., 500., 100, River.Rhein, 2014, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 40, |
|
171 segments, calcChoice, preprocessing, missingVolume, 430., 480., sounding)// |
9567
|
172 .addOutputTest(this.BEZUGSWST_03_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) // |
|
173 // .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no |
|
174 // currentKM |
|
175 .runTest(); |
9439
|
176 } |
|
177 } |