106 lines
3.5 KiB
C++
106 lines
3.5 KiB
C++
//
|
|
// Created by stani on 3/10/2025.
|
|
//
|
|
|
|
#ifndef FACTORY_H
|
|
#define FACTORY_H
|
|
#include <memory>
|
|
#include "../../src/model/Building.h"
|
|
#include "../../src/model/Community.h"
|
|
#include "../../src/model/Energy_Tariff.h"
|
|
|
|
namespace Building {
|
|
class Cost;
|
|
}
|
|
|
|
class Factory {
|
|
public:
|
|
std::unique_ptr<Building::Cost> static create_test_cost() {
|
|
auto cost = std::make_unique<Building::Cost>();
|
|
cost->set_special_rate_consumption(0.15f);
|
|
cost->set_special_rate_generation(0.10f);
|
|
return cost;
|
|
}
|
|
|
|
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> >();
|
|
|
|
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));
|
|
}
|
|
|
|
values->set_community_coverage(std::move(communityCoverage));
|
|
values->set_own_usage(std::move(ownUsage));
|
|
values->set_needed_con(std::move(neededCon));
|
|
values->set_needed_gen(std::move(neededGen));
|
|
|
|
return values;
|
|
}
|
|
|
|
std::unique_ptr<Building::Metadata> static create_test_metadata() {
|
|
auto metadata = std::make_unique<Building::Metadata>();
|
|
metadata->set_name("Test Building");
|
|
metadata->set_annual_consumption(12000.0f);
|
|
metadata->set_annual_generation(5000.0f);
|
|
metadata->set_consumption_profile_name("Profile_1");
|
|
metadata->set_generation_profile_name("Profile_2");
|
|
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> >();
|
|
|
|
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));
|
|
}
|
|
|
|
metadata->set_consumption_profile(std::move(consumptionProfile));
|
|
metadata->set_generation_profile(std::move(generationProfile));
|
|
|
|
return metadata;
|
|
}
|
|
|
|
std::unique_ptr<Building::Base> static create_test_building() {
|
|
auto building = std::make_unique<Building::Base>();
|
|
|
|
building->set_cost(create_test_cost());
|
|
building->set_values(create_test_simulation_values());
|
|
building->set_metadata(create_test_metadata());
|
|
|
|
return building;
|
|
}
|
|
|
|
Energy_Tariff static create_test_energy_tariff() {
|
|
return {};
|
|
}
|
|
|
|
std::unique_ptr<Community> static create_test_community() {
|
|
auto community = std::make_unique<Community>();
|
|
community->set_name("Test Community");
|
|
|
|
std::vector<std::unique_ptr<Building::Base> > buildings;
|
|
for (int i = 0; i < 3; i++) {
|
|
buildings.push_back(create_test_building());
|
|
}
|
|
|
|
community->set_buildings(std::move(buildings));
|
|
community->set_energy_tariff(create_test_energy_tariff());
|
|
|
|
return community;
|
|
}
|
|
};
|
|
|
|
|
|
#endif //FACTORY_H
|