GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 73.3% 22 / 0 / 30
Functions: 100.0% 1 / 0 / 1
Branches: 58.3% 42 / 0 / 72

src/workflow/RunReportingMeasures.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "OSWorkflow.hpp"
7
8 #include "Util.hpp"
9
10 #include "../model/Model.hpp"
11 #include "../utilities/idf/Workspace.hpp"
12
13 #include "../utilities/filetypes/WorkflowJSON.hpp"
14 #include "../utilities/filetypes/RunOptions.hpp"
15 #include "../utilities/core/Filesystem.hpp"
16
17 namespace openstudio {
18
19 17 void OSWorkflow::runReportingMeasures() {
20 17 state = State::ReportingMeasures;
21
22 // halted workflow is handled in applyMeasures
23
24 // TODO: urbanopt
25
26
1/1
✓ Branch 1 taken 17 times.
17 auto runDirPath = workflowJSON.absoluteRunDir();
27
28 // Load simulation files as required. I suppose this is for the case where you only run post processing
29
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
17 if (!runner.halted()) { // && !urbanopt
30
2/3
✓ Branch 1 taken 17 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17 times.
17 if (model.numObjects() == 0) {
31 ✗ if (auto p = runDirPath / "in.osm"; openstudio::filesystem::is_regular_file(p)) {
32 ✗ LOG(Debug, "Attempting to load " << p);
33 ✗ model = openstudio::workflow::util::loadOSM(p);
34 ✗ }
35 }
36
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 11 times.
17 if (!workspace_) {
37
3/4
✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
12 if (auto p = runDirPath / "in.idf"; openstudio::filesystem::is_regular_file(p)) {
38
6/6
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 6 times.
6 LOG(Debug, "Attempting to load " << p);
39
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 workspace_ = openstudio::workflow::util::loadIDF(p);
40 6 }
41 }
42
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 11 times.
17 if (sqlPath.empty()) {
43
3/4
✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
12 if (auto p = runDirPath / "eplusout.sql"; openstudio::filesystem::is_regular_file(p)) {
44 ✗ sqlPath = p;
45 ✗ LOG(Debug, "Registered the sql filepath as " << p);
46 6 }
47 }
48
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 13 times.
17 if (epwPath.empty()) {
49
3/4
✓ Branch 1 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
8 if (auto p = runDirPath / "in.epw"; openstudio::filesystem::is_regular_file(p)) {
50 ✗ epwPath = p;
51 ✗ LOG(Debug, "Registered the EPW filepath as " << p);
52 4 }
53 }
54 }
55
56
5/5
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
✓ Branch 13 taken 17 times.
17 LOG(Info, "Beginning to execute Reporting Measures.");
57
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 16 times.
17 applyMeasures(MeasureType::ReportingMeasure, ApplyMeasureType::Regular);
58
5/5
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
✓ Branch 13 taken 16 times.
16 LOG(Info, "Finished applying Reporting Measures.");
59
60
1/1
✓ Branch 1 taken 16 times.
16 communicateMeasureAttributes();
61
62
1/1
✓ Branch 1 taken 16 times.
16 runExtractInputsAndOutputs();
63 // TODO
64 // # Parse the files generated by the local output adapter
65 // results, objective_functions = run_extract_inputs_and_outputs @registry[:run_dir], @logger
66 // @registry.register(:results) { results }
67
68 // # Send the objective function results to the output adapter
69 // @logger.debug "Objective Function JSON is #{objective_functions}"
70 // @output_adapter.communicate_objective_function objective_functions
71 17 }
72 } // namespace openstudio
73