Skip to content

Commit

Permalink
Implement test LG12
Browse files Browse the repository at this point in the history
Co-authored-by: Ema Ikeda <e.mc2ikeda@gmail.com>
Co-authored-by: Emily Su <emilysu36@gmail.com>
Co-authored-by: Sean Fite <sean.fite@bellevuecollege.edu>
  • Loading branch information
4 people committed Feb 16, 2024
1 parent 81333c4 commit c94524c
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 3 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
reading,start time,end time
1217049.70876807,2022-08-18 00:00:00,2022-08-19 00:00:00
1074816.23931175,2022-08-19 00:00:00,2022-08-20 00:00:00
1230470.03833035,2022-08-20 00:00:00,2022-08-21 00:00:00
1207204.24534047,2022-08-21 00:00:00,2022-08-22 00:00:00
1167990.19738264,2022-08-22 00:00:00,2022-08-23 00:00:00
1200088.9514608,2022-08-23 00:00:00,2022-08-24 00:00:00
1212061.75781043,2022-08-24 00:00:00,2022-08-25 00:00:00
1190114.78231046,2022-08-25 00:00:00,2022-08-26 00:00:00
1110070.71164773,2022-08-26 00:00:00,2022-08-27 00:00:00
1197108.68857332,2022-08-27 00:00:00,2022-08-28 00:00:00
1182465.47439173,2022-08-28 00:00:00,2022-08-29 00:00:00
1117631.11738696,2022-08-29 00:00:00,2022-08-30 00:00:00
1220940.50962005,2022-08-30 00:00:00,2022-08-31 00:00:00
1173138.79591009,2022-08-31 00:00:00,2022-09-01 00:00:00
1146264.95706604,2022-09-01 00:00:00,2022-09-02 00:00:00
1237275.93516171,2022-09-02 00:00:00,2022-09-03 00:00:00
1240559.71070338,2022-09-03 00:00:00,2022-09-04 00:00:00
1186346.46313584,2022-09-04 00:00:00,2022-09-05 00:00:00
1106333.13391602,2022-09-05 00:00:00,2022-09-06 00:00:00
1206134.30014155,2022-09-06 00:00:00,2022-09-07 00:00:00
1210961.81468917,2022-09-07 00:00:00,2022-09-08 00:00:00
1163805.4183873,2022-09-08 00:00:00,2022-09-09 00:00:00
1199210.27978998,2022-09-09 00:00:00,2022-09-10 00:00:00
1181835.66578547,2022-09-10 00:00:00,2022-09-11 00:00:00
1279009.40866603,2022-09-11 00:00:00,2022-09-12 00:00:00
1186404.15270677,2022-09-12 00:00:00,2022-09-13 00:00:00
1220131.06075724,2022-09-13 00:00:00,2022-09-14 00:00:00
1148758.83403653,2022-09-14 00:00:00,2022-09-15 00:00:00
1209323.4912985,2022-09-15 00:00:00,2022-09-16 00:00:00
1160534.04620859,2022-09-16 00:00:00,2022-09-17 00:00:00
1225462.13716919,2022-09-17 00:00:00,2022-09-18 00:00:00
1233540.86610297,2022-09-18 00:00:00,2022-09-19 00:00:00
1173102.43931028,2022-09-19 00:00:00,2022-09-20 00:00:00
1298073.33853691,2022-09-20 00:00:00,2022-09-21 00:00:00
1152769.30358345,2022-09-21 00:00:00,2022-09-22 00:00:00
1241481.80483129,2022-09-22 00:00:00,2022-09-23 00:00:00
1140011.51095177,2022-09-23 00:00:00,2022-09-24 00:00:00
1137959.81647094,2022-09-24 00:00:00,2022-09-25 00:00:00
1212314.79472313,2022-09-25 00:00:00,2022-09-26 00:00:00
1155282.6586905,2022-09-26 00:00:00,2022-09-27 00:00:00
1146200.89628229,2022-09-27 00:00:00,2022-09-28 00:00:00
1193982.05892233,2022-09-28 00:00:00,2022-09-29 00:00:00
1232850.48708648,2022-09-29 00:00:00,2022-09-30 00:00:00
1197422.80768879,2022-09-30 00:00:00,2022-10-01 00:00:00
1171831.82936227,2022-10-01 00:00:00,2022-10-02 00:00:00
1198546.01086708,2022-10-02 00:00:00,2022-10-03 00:00:00
1151158.94421247,2022-10-03 00:00:00,2022-10-04 00:00:00
1197310.07704531,2022-10-04 00:00:00,2022-10-05 00:00:00
1178559.76697746,2022-10-05 00:00:00,2022-10-06 00:00:00
1205409.79268725,2022-10-06 00:00:00,2022-10-07 00:00:00
1233291.838432,2022-10-07 00:00:00,2022-10-08 00:00:00
1171780.82035551,2022-10-08 00:00:00,2022-10-09 00:00:00
1103330.33576191,2022-10-09 00:00:00,2022-10-10 00:00:00
1181466.83029771,2022-10-10 00:00:00,2022-10-11 00:00:00
1167764.36182518,2022-10-11 00:00:00,2022-10-12 00:00:00
1234244.96481406,2022-10-12 00:00:00,2022-10-13 00:00:00
1208956.8290443,2022-10-13 00:00:00,2022-10-14 00:00:00
1189256.37745467,2022-10-14 00:00:00,2022-10-15 00:00:00
1150036.55176725,2022-10-15 00:00:00,2022-10-16 00:00:00
1174758.94317436,2022-10-16 00:00:00,2022-10-17 00:00:00
1202418.8653961,2022-10-17 00:00:00,2022-10-18 00:00:00
1173049.54602506,2022-10-18 00:00:00,2022-10-19 00:00:00
1132704.73379777,2022-10-19 00:00:00,2022-10-20 00:00:00
1198030.00023068,2022-10-20 00:00:00,2022-10-21 00:00:00
1220756.0029897,2022-10-21 00:00:00,2022-10-22 00:00:00
1156456.84532195,2022-10-22 00:00:00,2022-10-23 00:00:00
1197608.25932123,2022-10-23 00:00:00,2022-10-24 00:00:00
1258565.45757183,2022-10-24 00:00:00,2022-10-25 00:00:00
1299239.40092041,2022-10-25 00:00:00,2022-10-26 00:00:00
1136917.94242589,2022-10-26 00:00:00,2022-10-27 00:00:00
1146553.53140625,2022-10-27 00:00:00,2022-10-28 00:00:00
1201173.13800929,2022-10-28 00:00:00,2022-10-29 00:00:00
1279277.07870141,2022-10-29 00:00:00,2022-10-30 00:00:00
1187280.31860224,2022-10-30 00:00:00,2022-10-31 00:00:00
1111829.00809469,2022-10-31 00:00:00,2022-11-01 00:00:00
14 changes: 13 additions & 1 deletion src/server/test/web/readingsLineGroupQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,19 @@ mocha.describe('readings API', () => {

// Add LG11 here

// Add LG12 here
mocha.it('LG12: should have daily points for 15 + 20 minute reading intervals and quantity units with +-inf start/end time & kWh as BTU chained', async () => {
// Load the data into the database
await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWhGroups, groupDatakWh);
// Get the unit ID since the DB could use any value.
const unitId = await getUnitId('BTU');
// Load the expected response data from the corresponding csv file
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_line_group_ri_15-20_mu_kWh_gu_BTU_st_-inf_et_inf.csv');
// Create a request to the API for unbounded reading times and save the response
const res = await chai.request(app).get(`/api/unitReadings/line/groups/${GROUP_ID}`)
.query({ timeInterval: ETERNITY.toString(), graphicUnitId: unitId });
// Check that the API reading is equal to what it is expected to equal
expectReadingToEqualExpected(res, expected, GROUP_ID);
});

// Add LG13 here

Expand Down
39 changes: 39 additions & 0 deletions src/server/util/readingsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,29 @@ const unitDatakWh = [
displayable: Unit.displayableType.NONE,
preferredDisplay: false,
note: 'special unit'
},
{
name: 'MJ',
identifier: 'megaJoules',
unitRepresent: Unit.unitRepresentType.QUANTITY,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable:
Unit.displayableType.ALL,
preferredDisplay: false,
note: 'MJ'
},
{
name: 'BTU',
identifier: '',
unitRepresent: Unit.unitRepresentType.QUANTITY,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable: Unit.displayableType.ALL,
preferredDisplay: true,
note: 'OED created standard unit'
}
];
const conversionDatakWh = [
Expand All @@ -194,6 +217,22 @@ const conversionDatakWh = [
slope: 1,
intercept: 0,
note: 'Electric_Utility → kWh'
},
{
sourceName: 'kWh',
destinationName: 'MJ',
bidirectional: true,
slope: 3.6,
intercept: 0,
note: 'kWh → MJ'
},
{
sourceName: 'MJ',
destinationName: 'BTU',
bidirectional: true,
slope: 947.8,
intercept: 0,
note: 'MJ → BTU'
}
];
const meterDatakWh = [
Expand Down

0 comments on commit c94524c

Please sign in to comment.