OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
HourlyMeteorology.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include <array>
14#include <istream>
15#include <string>
16#include <vector>
17
18namespace openswmm::climate {
19// Date/time marks the START of the hourly interval. Temperatures are °C,
20// humidity is percent, wind m/s and radiation W/m². All fields are required.
21// A terminal record represents one additional complete hour.
23 double date = 0;
24 std::array<double, 5> values{}; // temperature, RH, wind, Qsi, Qli
25};
26// Immutable daily source cache for independent surface clocks. Native
27// climate-file cursors can run ahead of a mesh/source consumer.
29 double date = 0, tmin = 70, tmax = 70, previous_max = 70, wind = 0;
30};
31
35public:
45 std::string read(std::istream& stream);
51 std::string load(const std::string& path);
63 std::string average(double start, double seconds, std::array<double, 5>& result) const;
67 bool empty() const noexcept { return records_.empty(); }
72 const std::vector<HourlyMetRecord>& records() const noexcept { return records_; }
73
74private:
75 std::vector<HourlyMetRecord> records_;
76};
77} // namespace openswmm::climate
Owned consecutive hourly records with interval-weighted means. Concurrent const queries are safe only...
Definition HourlyMeteorology.hpp:34
std::string read(std::istream &stream)
Replace the cache with validated consecutive hourly records from a stream.
Definition HourlyMeteorology.cpp:28
std::string average(double start, double seconds, std::array< double, 5 > &result) const
Compute duration-weighted means of hourly piecewise-constant weather.
Definition HourlyMeteorology.cpp:76
const std::vector< HourlyMetRecord > & records() const noexcept
Borrow immutable hourly starts and their complete-hour weather values.
Definition HourlyMeteorology.hpp:72
bool empty() const noexcept
Test whether any validated records are stored.
Definition HourlyMeteorology.hpp:67
std::string load(const std::string &path)
Open a text weather file and replace the cache through read().
Definition HourlyMeteorology.cpp:22
Definition Rk2RuntimeSources.hpp:19
Definition HourlyMeteorology.hpp:22
double date
Definition HourlyMeteorology.hpp:23
std::array< double, 5 > values
Definition HourlyMeteorology.hpp:24
Definition HourlyMeteorology.hpp:28
double previous_max
Definition HourlyMeteorology.hpp:29
double wind
Definition HourlyMeteorology.hpp:29
double tmax
Definition HourlyMeteorology.hpp:29
double date
Definition HourlyMeteorology.hpp:29
double tmin
Definition HourlyMeteorology.hpp:29