Skip to content

Commit afd7cdf

Browse files
apply formatting
1 parent d66a05a commit afd7cdf

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

include/fluxgraph/model/thermal_mass.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ class ThermalMassModel : public IModel {
6565
double initial_temp_; // Initial temp for reset (degC)
6666
ThermalIntegrationMethod integration_method_;
6767

68-
double derivative(double temperature, double net_power,
69-
double ambient) const;
68+
double derivative(double temperature, double net_power, double ambient) const;
7069
};
7170

7271
} // namespace fluxgraph

src/model/thermal_mass.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "fluxgraph/model/thermal_mass.hpp"
22
#include <limits>
3-
#include <stdexcept>
43
#include <sstream>
4+
#include <stdexcept>
55

66
namespace fluxgraph {
77

@@ -30,9 +30,9 @@ parse_thermal_integration_method(const std::string &method_name) {
3030
return ThermalIntegrationMethod::Rk4;
3131
}
3232

33-
throw std::invalid_argument(
34-
"Unknown thermal integration method '" + method_name +
35-
"' (expected one of: forward_euler, rk4)");
33+
throw std::invalid_argument("Unknown thermal integration method '" +
34+
method_name +
35+
"' (expected one of: forward_euler, rk4)");
3636
}
3737

3838
ThermalMassModel::ThermalMassModel(const std::string &id, double thermal_mass,
@@ -67,8 +67,10 @@ void ThermalMassModel::tick(double dt, SignalStore &store) {
6767
} else {
6868
// Classic RK4 with fixed inputs over the tick interval.
6969
const double k1 = derivative(temperature_, net_power, ambient);
70-
const double k2 = derivative(temperature_ + 0.5 * dt * k1, net_power, ambient);
71-
const double k3 = derivative(temperature_ + 0.5 * dt * k2, net_power, ambient);
70+
const double k2 =
71+
derivative(temperature_ + 0.5 * dt * k1, net_power, ambient);
72+
const double k3 =
73+
derivative(temperature_ + 0.5 * dt * k2, net_power, ambient);
7274
const double k4 = derivative(temperature_ + dt * k3, net_power, ambient);
7375
temperature_ += (dt / 6.0) * (k1 + 2.0 * k2 + 2.0 * k3 + k4);
7476
}

tests/unit/compiler_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ TEST(GraphCompilerTest, ParseThermalMassModelWithRk4) {
289289
EXPECT_NE(model->describe().find("method=rk4"), std::string::npos);
290290
}
291291

292-
TEST(GraphCompilerTest, ParseThermalMassModelWithInvalidIntegrationMethodThrows) {
292+
TEST(GraphCompilerTest,
293+
ParseThermalMassModelWithInvalidIntegrationMethodThrows) {
293294
ModelSpec spec;
294295
spec.id = "chamber_air";
295296
spec.type = "thermal_mass";

tests/unit/thermal_mass_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ TEST_F(ThermalMassTest, ExplicitForwardEulerMatchesDefault) {
133133
ThermalMassModel default_compare("default_compare", 1000.0, 10.0, 25.0,
134134
"model/temperature", "model/heating_power",
135135
"model/ambient_temp", *default_ns);
136-
ThermalMassModel explicit_compare(
137-
"explicit_compare", 1000.0, 10.0, 25.0, "model/temperature",
138-
"model/heating_power", "model/ambient_temp", *explicit_ns,
139-
ThermalIntegrationMethod::ForwardEuler);
136+
ThermalMassModel explicit_compare("explicit_compare", 1000.0, 10.0, 25.0,
137+
"model/temperature", "model/heating_power",
138+
"model/ambient_temp", *explicit_ns,
139+
ThermalIntegrationMethod::ForwardEuler);
140140

141141
for (int i = 0; i < 100; ++i) {
142142
const double power = (i < 50) ? 100.0 : 0.0;

0 commit comments

Comments
 (0)