Cleaned up
This commit is contained in:
@ -21,6 +21,8 @@ add_executable(Sim_C__
|
||||
src/services/Cost/TaxComponent.cpp
|
||||
src/services/Cost/TaxComponent.h
|
||||
src/helper/Curry.h
|
||||
src/enums/Aut.h
|
||||
src/config.h
|
||||
)
|
||||
find_package(doctest CONFIG REQUIRED)
|
||||
find_package(spdlog CONFIG REQUIRED)
|
||||
|
||||
16
src/Config.h
Normal file
16
src/Config.h
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by StanislausCichocki on 11.03.2025.
|
||||
//
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
#ifdef NDEBUG // Release mode
|
||||
#define LOG_DEBUG_INFO(...)
|
||||
#define LOG_DEBUG_ERROR(...)
|
||||
#else
|
||||
#define LOG_DEBUG_INFO(...) spdlog::info(__VA_ARGS__)
|
||||
#define LOG_DEBUG_ERROR(...) spdlog::error(__VA_ARGS__)
|
||||
#endif
|
||||
#define VALUE_COUNT (4*24*365)
|
||||
|
||||
#endif //CONFIG_H
|
||||
28
src/enums/Aut.h
Normal file
28
src/enums/Aut.h
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by StanislausCichocki on 11.03.2025.
|
||||
//
|
||||
|
||||
#ifndef AUT_H
|
||||
#define AUT_H
|
||||
|
||||
namespace Enums::AUT {
|
||||
enum GridLevel {
|
||||
GridLevel1,
|
||||
GridLevel2,
|
||||
GridLevel3,
|
||||
GridLevel4,
|
||||
GridLevel5,
|
||||
GridLevel6,
|
||||
GridLevel7WithP,
|
||||
GridLevel7WithoutP,
|
||||
GridLevel7Interruptable,
|
||||
};
|
||||
enum EegType {
|
||||
GEA,
|
||||
LocalEeg,
|
||||
RegionalEeg,
|
||||
BEG
|
||||
};
|
||||
}
|
||||
|
||||
#endif //AUT_H
|
||||
@ -20,39 +20,54 @@ void Building::Cost::set_special_rate_generation(float special_rate_generation)
|
||||
SpecialRateGeneration = special_rate_generation;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float> > &Building::Simulation_Values::community_coverage() {
|
||||
std::vector<float> &Building::Simulation_Values::community_coverage() {
|
||||
return CommunityCoverage;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::
|
||||
set_community_coverage(std::vector<std::unique_ptr<float> > community_coverage) {
|
||||
set_community_coverage(std::vector<float> community_coverage) {
|
||||
CommunityCoverage = std::move(community_coverage);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float> > &Building::Simulation_Values::own_usage() {
|
||||
std::vector<float> &Building::Simulation_Values::own_usage() {
|
||||
return OwnUsage;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_own_usage(std::vector<std::unique_ptr<float> > own_usage) {
|
||||
void Building::Simulation_Values::set_own_usage(std::vector<float> own_usage) {
|
||||
OwnUsage = std::move(own_usage);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float> > &Building::Simulation_Values::needed_con() {
|
||||
std::vector<float> &Building::Simulation_Values::needed_con() {
|
||||
return Needed_con;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_needed_con(std::vector<std::unique_ptr<float> > needed_con) {
|
||||
void Building::Simulation_Values::set_needed_con(std::vector<float> needed_con) {
|
||||
Needed_con = std::move(needed_con);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float> > &Building::Simulation_Values::needed_gen() {
|
||||
std::vector<float> &Building::Simulation_Values::needed_gen() {
|
||||
return NeededGen;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_needed_gen(std::vector<std::unique_ptr<float> > needed_gen) {
|
||||
void Building::Simulation_Values::set_needed_gen(std::vector<float> needed_gen) {
|
||||
NeededGen = std::move(needed_gen);
|
||||
}
|
||||
|
||||
float Building::Simulation_Values::relativeSelfConsumption() const {
|
||||
return RelativeSelfConsumption;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_relativeSelfConsumption(float const relativeSelfConsumption) {
|
||||
this->RelativeSelfConsumption = relativeSelfConsumption;
|
||||
}
|
||||
|
||||
float Building::Simulation_Values::relativeSelfGeneration() const {
|
||||
return RelativeGeneration;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_relativeSelfGeneration(float const relativeSelfGeneration) {
|
||||
this->RelativeGeneration = relativeSelfGeneration;
|
||||
}
|
||||
std::string Building::Metadata::name() const {
|
||||
return Name;
|
||||
}
|
||||
@ -77,19 +92,19 @@ void Building::Metadata::set_annual_generation(float annual_generation) {
|
||||
AnnualGeneration = annual_generation;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float> > &Building::Metadata::consumption_profile() {
|
||||
std::vector<float> &Building::Metadata::consumption_profile() {
|
||||
return ConsumptionProfile;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_consumption_profile(std::vector<std::unique_ptr<float> > consumption_profile) {
|
||||
void Building::Metadata::set_consumption_profile(std::vector<float> consumption_profile) {
|
||||
ConsumptionProfile = std::move(consumption_profile);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float> > &Building::Metadata::generation_profile() {
|
||||
std::vector<float> &Building::Metadata::generation_profile() {
|
||||
return GenerationProfile;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_generation_profile(std::vector<std::unique_ptr<float> > generation_profile) {
|
||||
void Building::Metadata::set_generation_profile(std::vector<float> generation_profile) {
|
||||
GenerationProfile = std::move(generation_profile);
|
||||
}
|
||||
|
||||
|
||||
@ -25,31 +25,39 @@ namespace Building {
|
||||
float special_rate_generation() const;
|
||||
|
||||
void set_special_rate_generation(float special_rate_generation);
|
||||
|
||||
};
|
||||
|
||||
class Simulation_Values {
|
||||
private:
|
||||
std::vector<std::unique_ptr<float> > CommunityCoverage;
|
||||
std::vector<std::unique_ptr<float> > OwnUsage;
|
||||
std::vector<std::unique_ptr<float> > Needed_con;
|
||||
std::vector<std::unique_ptr<float> > NeededGen;
|
||||
std::vector<float> CommunityCoverage;
|
||||
std::vector<float> OwnUsage;
|
||||
std::vector<float> Needed_con;
|
||||
std::vector<float> NeededGen;
|
||||
float RelativeSelfConsumption{0.0f};
|
||||
float RelativeGeneration{0.0f};
|
||||
|
||||
public:
|
||||
std::vector<std::unique_ptr<float> > &community_coverage();
|
||||
std::vector<float> &community_coverage();
|
||||
|
||||
void set_community_coverage(std::vector<std::unique_ptr<float> > community_coverage);
|
||||
void set_community_coverage(std::vector<float> community_coverage);
|
||||
|
||||
std::vector<std::unique_ptr<float> > &own_usage();
|
||||
std::vector<float> &own_usage();
|
||||
|
||||
void set_own_usage(std::vector<std::unique_ptr<float> > own_usage);
|
||||
void set_own_usage(std::vector<float> own_usage);
|
||||
|
||||
std::vector<std::unique_ptr<float> > &needed_con();
|
||||
std::vector<float> &needed_con();
|
||||
|
||||
void set_needed_con(std::vector<std::unique_ptr<float> > needed_con);
|
||||
void set_needed_con(std::vector<float> needed_con);
|
||||
|
||||
std::vector<std::unique_ptr<float> > &needed_gen();
|
||||
std::vector<float> &needed_gen();
|
||||
|
||||
void set_needed_gen(std::vector<std::unique_ptr<float> > needed_gen);
|
||||
void set_needed_gen(std::vector<float> needed_gen);
|
||||
|
||||
float relativeSelfConsumption() const;
|
||||
void set_relativeSelfConsumption(float relativeSelfConsumption);
|
||||
float relativeSelfGeneration() const;
|
||||
void set_relativeSelfGeneration(float relativeSelfGeneration);
|
||||
};
|
||||
|
||||
class Metadata {
|
||||
@ -57,8 +65,8 @@ namespace Building {
|
||||
std::string Name;
|
||||
float AnnualConsumption;
|
||||
float AnnualGeneration;
|
||||
std::vector<std::unique_ptr<float> > ConsumptionProfile;
|
||||
std::vector<std::unique_ptr<float> > GenerationProfile;
|
||||
std::vector<float> ConsumptionProfile;
|
||||
std::vector<float> GenerationProfile;
|
||||
std::string ConsumptionProfileName;
|
||||
std::string GenerationProfileName;
|
||||
short ConnectionPower;
|
||||
@ -77,13 +85,13 @@ namespace Building {
|
||||
|
||||
void set_annual_generation(float annual_generation);
|
||||
|
||||
std::vector<std::unique_ptr<float> > &consumption_profile();
|
||||
std::vector<float> &consumption_profile();
|
||||
|
||||
void set_consumption_profile(std::vector<std::unique_ptr<float> > consumption_profile);
|
||||
void set_consumption_profile(std::vector<float> consumption_profile);
|
||||
|
||||
std::vector<std::unique_ptr<float> > &generation_profile();
|
||||
std::vector<float> &generation_profile();
|
||||
|
||||
void set_generation_profile(std::vector<std::unique_ptr<float> > generation_profile);
|
||||
void set_generation_profile(std::vector<float> generation_profile);
|
||||
|
||||
std::string consumption_profile_name() const;
|
||||
|
||||
|
||||
@ -27,16 +27,41 @@ void Community::set_energy_tariff(const Energy_Tariff &energy_tariff) {
|
||||
energy_Tariff = energy_tariff;
|
||||
}
|
||||
|
||||
std::vector<float> Community::GenerationAvailable() const {
|
||||
return generationAvailable;
|
||||
}
|
||||
|
||||
void Community::set_generation_available(std::vector<float> &generationAvailable) {
|
||||
this->generationAvailable = generationAvailable;
|
||||
}
|
||||
|
||||
std::vector<float> Community::ConsumptionAvailable() const {
|
||||
return consumptionAvailable;
|
||||
}
|
||||
|
||||
void Community::set_consumption_available(std::vector<float> &consumptionAvailable) {
|
||||
this->consumptionAvailable = consumptionAvailable;
|
||||
}
|
||||
|
||||
std::vector<bool> Community::IsGenBiggerThanCon() const {
|
||||
return isGenBiggerThanCon;
|
||||
}
|
||||
|
||||
void Community::set_is_gen_bigger_than_con(std::vector<bool> &isGenBiggerThanCon) {
|
||||
this->isGenBiggerThanCon=isGenBiggerThanCon;
|
||||
}
|
||||
|
||||
auto Community::iterateBuildings(
|
||||
std::vector<std::unique_ptr<Community> > &Communities) -> std::function<std::function<void(
|
||||
const std::function<void(Building::Base &)> &)>(const std::function<void(Community &)> &)> {
|
||||
std::vector<std::unique_ptr<Community> > &Communities)
|
||||
-> std::function<std::function<void(const std::function<void(
|
||||
Community &, Building::Base &)> &)>(const std::function<void(Community &)> &)> {
|
||||
return [&](const std::function<void(Community &)> &func1) {
|
||||
return [&, func1](const std::function<void(Building::Base &)> &func2) {
|
||||
return [&, func1](const std::function<void(Community &, Building::Base &)> &func2) {
|
||||
iterateVector(Communities, func1);
|
||||
|
||||
iterateVector(Communities, [&](Community &community) {
|
||||
for (auto &building: community.buildings()) {
|
||||
func2(*building);
|
||||
func2(community, *building);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -7,12 +7,14 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../Config.h"
|
||||
#include "Building.h"
|
||||
#include "Energy_Tariff.h"
|
||||
|
||||
|
||||
class Community : public Model<Community> {
|
||||
public:
|
||||
Community():generationAvailable(VALUE_COUNT, 0.0f),consumptionAvailable(VALUE_COUNT,0.0f){};
|
||||
std::string name() const;
|
||||
|
||||
void set_name(const std::string &name);
|
||||
@ -25,13 +27,30 @@ public:
|
||||
|
||||
void set_energy_tariff(const Energy_Tariff &energy_tariff);
|
||||
|
||||
static std::function<std::function<void(const std::function<void(Building::Base &)> &)>
|
||||
(const std::function<void(Community &)> &)>
|
||||
std::vector<float> GenerationAvailable() const;
|
||||
|
||||
void set_generation_available(std::vector<float> &generationAvailable);
|
||||
|
||||
std::vector<float> ConsumptionAvailable() const;
|
||||
|
||||
void set_consumption_available(std::vector<float> &consumptionAvailable);
|
||||
|
||||
std::vector<bool> IsGenBiggerThanCon() const;
|
||||
|
||||
void set_is_gen_bigger_than_con(std::vector<bool> &isGenBiggerThanCon);
|
||||
|
||||
static std::function<std::function<void(const std::function<void(Community &, Building::Base &)> &)>(const std::
|
||||
function<void(
|
||||
Community &)> &)>
|
||||
iterateBuildings(std::vector<std::unique_ptr<Community> > &Communities);
|
||||
|
||||
private:
|
||||
std::string Name;
|
||||
std::vector<std::unique_ptr<Building::Base> > Buildings;
|
||||
std::vector<float> generationAvailable;
|
||||
std::vector<float> consumptionAvailable;
|
||||
std::vector<bool> isGenBiggerThanCon;
|
||||
|
||||
Energy_Tariff energy_Tariff;
|
||||
};
|
||||
|
||||
|
||||
@ -3,39 +3,48 @@
|
||||
//
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#ifdef NDEBUG // Release mode
|
||||
#define LOG_DEBUG_INFO(...)
|
||||
#define LOG_DEBUG_ERROR(...)
|
||||
#else
|
||||
#define LOG_DEBUG_INFO(...) spdlog::info(__VA_ARGS__)
|
||||
#define LOG_DEBUG_ERROR(...) spdlog::error(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#include "Surplus.h"
|
||||
#include "../model/Building.h"
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <ranges>
|
||||
#include <numeric>
|
||||
|
||||
void Surplus::CalculateSurplus() {
|
||||
auto iterateFunc = Community::iterateBuildings(communities);
|
||||
auto modifyCommunity = [](Community &c) {
|
||||
auto modifyCommunity = [this](Community &c) {
|
||||
this->consumptionAvailable=std::vector<float>(VALUE_COUNT, 00.f);
|
||||
this->generationAvailable=std::vector<float>(VALUE_COUNT, 00.f);
|
||||
this->isGenBigger=std::vector<bool>(VALUE_COUNT, false);
|
||||
LOG_DEBUG_INFO("Calculating Surplus for Community: {}", c.name());
|
||||
};
|
||||
auto modifyBuilding = [this](Building::Base &building) {
|
||||
LOG_DEBUG_INFO("Calculating Surplus for Community: {}", building.metadata()->name());
|
||||
CalculateBuildingSurplus(building);
|
||||
auto modifyBuildingSurplus = [this](Community &community, Building::Base &building) {
|
||||
LOG_DEBUG_INFO("Calculating Surplus for Building: {} in Community: {}",
|
||||
building.metadata()->name(), community.name());
|
||||
CalculateBuildingSurplus(community, building);
|
||||
};
|
||||
iterateFunc(modifyCommunity)(modifyBuilding);
|
||||
|
||||
//TODO Calculate Relative Values
|
||||
auto modifyBuildingSurplusCommunity = [this](Community &community, Building::Base &building) {
|
||||
LOG_DEBUG_INFO("Calculating Surplus for Building: {} in Community: {}",
|
||||
building.metadata()->name(), community.name());
|
||||
CalculateSurplusCommunity(community, building);
|
||||
};
|
||||
iterateFunc(modifyCommunity)(modifyBuildingSurplus);
|
||||
iterateFunc(modifyCommunity)(modifyBuildingSurplusCommunity);
|
||||
auto addCommunityValues = [this](Community &community) {
|
||||
community.set_consumption_available(this->consumptionAvailable);
|
||||
community.set_generation_available(this->generationAvailable);
|
||||
community.set_is_gen_bigger_than_con(this->isGenBigger);
|
||||
};
|
||||
iterateFunc(addCommunityValues);
|
||||
}
|
||||
|
||||
void Surplus::CalculateBuildingSurplus(Building::Base &building) {
|
||||
std::vector<std::unique_ptr<float> > ownCoverage;
|
||||
std::vector<std::unique_ptr<float> > neededConsumption;
|
||||
std::vector<std::unique_ptr<float> > neededGeneration;
|
||||
std::vector<std::unique_ptr<float> > ownUsage;
|
||||
|
||||
void Surplus::CalculateBuildingSurplus(Community &community, Building::Base &building) {
|
||||
std::vector<float> ownCoverage;
|
||||
std::vector<float> neededConsumption;
|
||||
std::vector<float> neededGeneration;
|
||||
std::vector<float> ownUsage;
|
||||
|
||||
const auto &consumption = building.metadata()->consumption_profile();
|
||||
const auto &generation = building.metadata()->generation_profile();
|
||||
@ -45,28 +54,58 @@ void Surplus::CalculateBuildingSurplus(Building::Base &building) {
|
||||
neededGeneration.reserve(consumption.size());
|
||||
ownUsage.reserve(consumption.size());
|
||||
|
||||
std::transform(consumption.begin(), consumption.end(),
|
||||
generation.begin(), std::back_inserter(ownCoverage),
|
||||
[&](const std::unique_ptr<float> &c, const std::unique_ptr<float> &g) {
|
||||
auto own_cov = std::make_unique<float>((c ? *c : 0.0f) - (g ? *g : 0.0f));
|
||||
ownCoverage.push_back(std::make_unique<float>(*own_cov));
|
||||
std::ranges::for_each(consumption, [&](auto c_ptr) {
|
||||
static size_t i = 0; // Keep track of index
|
||||
const float c = c_ptr ? c_ptr : 0.0f;
|
||||
const float g = (i < generation.size() && generation[i]) ? generation[i] : 0.0f;
|
||||
const float c_community = (i < consumptionAvailable.size() && consumptionAvailable[i])
|
||||
? consumptionAvailable[i]
|
||||
: 0.0f;
|
||||
const float g_community = (i < generationAvailable.size() && generationAvailable[i])
|
||||
? generationAvailable[i]
|
||||
: 0.0f;
|
||||
|
||||
neededConsumption.push_back(std::make_unique<float>(c && *c > 0.0f ? *c : 0.0f));
|
||||
neededGeneration.push_back(std::make_unique<float>(g && *g < 0.0f ? -*g : 0.0f));
|
||||
ownUsage.push_back(std::make_unique<float>((c ? *c : 0.0f) - *neededConsumption.back()));
|
||||
const auto ownCov = (c - g);
|
||||
const auto neededCons = ((c > 0.0f) ? c : 0.0f);
|
||||
const auto neededGen = ((g < 0.0f) ? -g : 0.0f);
|
||||
const auto ownUs = (c - neededCons);
|
||||
|
||||
return std::move(own_cov);
|
||||
const auto communityConsumption = c_community + neededCons;
|
||||
const auto generationConsumption = g_community + neededGen;
|
||||
|
||||
ownCoverage.push_back(ownCov);
|
||||
neededConsumption.push_back(neededCons);
|
||||
neededGeneration.push_back(neededGen);
|
||||
ownUsage.push_back(ownUs);
|
||||
this->consumptionAvailable[i] = communityConsumption;
|
||||
this->generationAvailable[i] = generationConsumption;
|
||||
this->isGenBigger[i] = generationAvailable[i] > consumptionAvailable[i];
|
||||
++i;
|
||||
});
|
||||
|
||||
building.values()->set_community_coverage(std::move(ownCoverage));
|
||||
building.values()->set_needed_con(std::move(neededGeneration));
|
||||
building.values()->set_needed_con(std::move(neededConsumption));
|
||||
building.values()->set_needed_gen(std::move(neededGeneration));
|
||||
building.values()->set_own_usage(std::move(ownUsage));
|
||||
|
||||
|
||||
std::transform(generationAvailable.begin(), generationAvailable.end(), consumptionAvailable.begin(),
|
||||
isGenBigger.begin(), [&](const float a, const float b) { return a > b; });
|
||||
if (building.metadata()->annual_consumption() > 0.0f) {
|
||||
building.values()->set_relativeSelfConsumption(
|
||||
std::accumulate(building.values()->own_usage().begin(), building.values()->own_usage().end(), 0.0f) /
|
||||
std::accumulate(building.metadata()->consumption_profile().begin(),
|
||||
building.metadata()->consumption_profile().end(), 0.0f));
|
||||
} else {
|
||||
building.values()->set_relativeSelfConsumption(0.0f);
|
||||
}
|
||||
if (building.metadata()->annual_generation() > 0.0f) {
|
||||
building.values()->set_relativeSelfGeneration(
|
||||
std::accumulate(building.values()->own_usage().begin(), building.values()->own_usage().end(), 0.0f) /
|
||||
std::accumulate(building.metadata()->generation_profile().begin(),
|
||||
building.metadata()->generation_profile().end(), 0.0f));
|
||||
} else {
|
||||
building.values()->set_relativeSelfGeneration(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void Surplus::CalculateSurplusCommunity(const Community &community, const Building::Base &base) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4,14 +4,13 @@
|
||||
|
||||
#ifndef SURPLUS_H
|
||||
#define SURPLUS_H
|
||||
#define VALUE_COUNT (4*24*365)
|
||||
#include <memory>
|
||||
|
||||
#include "../model/Community.h"
|
||||
#include "../Config.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class Community;
|
||||
|
||||
class Surplus {
|
||||
private:
|
||||
std::vector<std::unique_ptr<Community> > &communities;
|
||||
@ -28,7 +27,9 @@ public:
|
||||
|
||||
void CalculateSurplus();
|
||||
|
||||
void CalculateBuildingSurplus(Building::Base &);
|
||||
void CalculateBuildingSurplus(Community &community, Building::Base &);
|
||||
|
||||
void CalculateSurplusCommunity(const Community & community, const Building::Base & base);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -25,17 +25,17 @@ public:
|
||||
std::unique_ptr<Building::Simulation_Values> static create_test_simulation_values() {
|
||||
auto values = std::make_unique<Building::Simulation_Values>();
|
||||
|
||||
auto communityCoverage = std::vector<std::unique_ptr<float> >();
|
||||
auto ownUsage = std::vector<std::unique_ptr<float> >();
|
||||
auto neededCon = std::vector<std::unique_ptr<float> >();
|
||||
auto neededGen = std::vector<std::unique_ptr<float> >();
|
||||
auto communityCoverage = std::vector<float>();
|
||||
auto ownUsage = std::vector<float>();
|
||||
auto neededCon = std::vector<float>();
|
||||
auto neededGen = std::vector<float>();
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// Populate with test values
|
||||
communityCoverage.push_back(std::make_unique<float>(i * 10.0f));
|
||||
ownUsage.push_back(std::make_unique<float>(i * 5.0f));
|
||||
neededCon.push_back(std::make_unique<float>(i * 3.0f));
|
||||
neededGen.push_back(std::make_unique<float>(i * 2.0f));
|
||||
communityCoverage.push_back(i * 10.0f);
|
||||
ownUsage.push_back(i * 5.0f);
|
||||
neededCon.push_back(i * 3.0f);
|
||||
neededGen.push_back(i * 2.0f);
|
||||
}
|
||||
|
||||
values->set_community_coverage(std::move(communityCoverage));
|
||||
@ -56,13 +56,13 @@ public:
|
||||
metadata->set_connection_power(100);
|
||||
metadata->set_grid_power(50);
|
||||
|
||||
auto consumptionProfile = std::vector<std::unique_ptr<float> >();
|
||||
auto generationProfile = std::vector<std::unique_ptr<float> >();
|
||||
auto consumptionProfile = std::vector<float>();
|
||||
auto generationProfile = std::vector<float>();
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// Populate with test values
|
||||
consumptionProfile.push_back(std::make_unique<float>(i * 100.0f));
|
||||
generationProfile.push_back(std::make_unique<float>(i * 50.0f));
|
||||
consumptionProfile.push_back(i * 100.0f);
|
||||
generationProfile.push_back(i * 50.0f);
|
||||
}
|
||||
|
||||
metadata->set_consumption_profile(std::move(consumptionProfile));
|
||||
|
||||
@ -8,7 +8,9 @@
|
||||
|
||||
TEST_CASE("Testing add function") {
|
||||
std::vector<std::unique_ptr<Community> > communities;
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
communities.push_back(Factory::create_test_community());
|
||||
}
|
||||
Surplus surplus(communities);
|
||||
surplus.CalculateSurplus();
|
||||
CHECK(true);
|
||||
|
||||
Reference in New Issue
Block a user