OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
UebConfig.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include "UebSnow.hpp"
15#include <array>
16#include <map>
17#include <optional>
18#include <string>
19#include <vector>
20
21namespace openswmm::surface {
22enum class SnowKind { DegreeDay, Ueb };
29 enum class Mode { Computed, Timeseries, File };
31 std::string series;
32 bool authored = false;
33};
35 double latitude = 0, longitude = 0, timezone = 0, elevation = 0;
36};
37struct SnowConfig {
39 bool model_authored = false;
41 double step = 3600;
43 double bc_a = .8, bc_c = 2.4;
44 // NaN/unspecified is represented explicitly: never invent a temperature range.
45 std::array<std::optional<double>, 12> monthly_range;
46 std::optional<ClimateSite> site;
49 std::map<int, SnowpackConfig> packs;
50
55 SnowKind modelFor(int pack) const {
56 const auto it = packs.find(pack);
57 return it == packs.end() ? model : it->second.model;
58 }
59
63 bool hasTemperatureRows() const;
64};
65
66// Shared by the input reader and public option setters. A failed update leaves
67// the configuration unchanged. Tokens exclude the section name.
86std::string setUebOption(SnowConfig& config, const std::vector<std::string>& tokens,
87 bool validate = true);
95std::vector<std::string> uebOptionRows(const SnowConfig& config);
102std::optional<std::string> uebOptionValue(const SnowConfig& config, const std::string& key);
118std::string setSnowTemperature(SnowConfig& config, const std::vector<std::string>& tokens);
131std::string setSnowpackUeb(SnowConfig& config, int pack, const std::vector<std::string>& tokens);
132} // namespace openswmm::surface
Carrier for an external file reference in a SWMM model.
Utah Energy Balance snow accumulation and energy integration.
Definition GroundHeat.hpp:19
std::optional< std::string > uebOptionValue(const SnowConfig &cfg, const std::string &name)
Read a scalar UEB option's effective value, including its default.
Definition UebConfig.cpp:169
std::string setSnowpackUeb(SnowConfig &cfg, int pack, const std::vector< std::string > &tok)
Replace one pack's optional UEB site/model override from authored tokens.
Definition UebConfig.cpp:257
std::string setSnowTemperature(SnowConfig &cfg, const std::vector< std::string > &tok)
Parse one snow-related TEMPERATURE row and publish a copied candidate.
Definition UebConfig.cpp:186
std::string setUebOption(SnowConfig &cfg, const std::vector< std::string > &tok, bool validate)
Parse one UEB_OPTIONS row into a candidate configuration then publish it.
Definition UebConfig.cpp:92
std::vector< std::string > uebOptionRows(const SnowConfig &cfg)
Serialize nondefault UEB_OPTIONS settings in deterministic schema order.
Definition UebConfig.cpp:149
SnowKind
Definition UebConfig.hpp:22
@ Ueb
Definition UebConfig.hpp:22
@ DegreeDay
Definition UebConfig.hpp:22
Two-string carrier for any external file path that appears in a SWMM .inp file.
Definition FilePathPair.hpp:63
Definition UebConfig.hpp:34
double timezone
Definition UebConfig.hpp:35
double elevation
Definition UebConfig.hpp:35
double latitude
Definition UebConfig.hpp:35
double longitude
Definition UebConfig.hpp:35
Definition UebConfig.hpp:28
Mode
Definition UebConfig.hpp:29
@ File
Definition UebConfig.hpp:29
@ Computed
Definition UebConfig.hpp:29
@ Timeseries
Definition UebConfig.hpp:29
std::string series
Definition UebConfig.hpp:31
Mode mode
Definition UebConfig.hpp:30
bool authored
Definition UebConfig.hpp:32
Definition UebConfig.hpp:37
bool division_temperature
Definition UebConfig.hpp:40
bool model_authored
Definition UebConfig.hpp:39
ueb::Parameters parameters
Definition UebConfig.hpp:42
bool hasTemperatureRows() const
Test whether nondefault/authored temperature-section snow rows should exist.
Definition UebConfig.cpp:88
SnowKind modelFor(int pack) const
Resolve a per-pack model override or the global snow-model fallback.
Definition UebConfig.hpp:55
double step
Definition UebConfig.hpp:41
std::array< std::optional< double >, 12 > monthly_range
Definition UebConfig.hpp:45
RadiationSource shortwave
Definition UebConfig.hpp:47
RadiationSource longwave
Definition UebConfig.hpp:47
double bc_a
Definition UebConfig.hpp:43
double bc_c
Definition UebConfig.hpp:43
SnowKind model
Definition UebConfig.hpp:38
std::map< int, SnowpackConfig > packs
Definition UebConfig.hpp:49
std::optional< ClimateSite > site
Definition UebConfig.hpp:46
FilePathPair met_file
Definition UebConfig.hpp:48
Definition UebConfig.hpp:23
ueb::Site site
Definition UebConfig.hpp:25
SnowKind model
Definition UebConfig.hpp:24
double initial_energy
Definition UebConfig.hpp:26
Point UEB material, radiation and integration parameters. Temperatures are Celsius,...
Definition UebSnow.hpp:23
Per-column environmental settings. forest is canopy fraction, drift a snow multiplier,...
Definition UebSnow.hpp:48