added Models
This commit is contained in:
@ -5,4 +5,10 @@ set(CMAKE_CXX_STANDARD 26)
|
||||
|
||||
add_executable(Sim_C__
|
||||
src/main.cpp
|
||||
src/model/Community.cpp
|
||||
src/model/Community.h
|
||||
src/model/building/Building.cpp
|
||||
src/model/building/Building.h
|
||||
src/model/Energy_Tariff.cpp
|
||||
src/model/Energy_Tariff.h
|
||||
)
|
||||
|
||||
26
src/model/Community.cpp
Normal file
26
src/model/Community.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "Community.h"
|
||||
|
||||
std::string Community::name() const {
|
||||
return Name;
|
||||
}
|
||||
|
||||
void Community::set_name(const std::string& name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<Building::Base>>& Community::buildings() {
|
||||
return Buildings;
|
||||
}
|
||||
|
||||
// Use move semantics for efficiency
|
||||
void Community::set_buildings(std::vector<std::unique_ptr<Building::Base>> buildings) {
|
||||
Buildings = std::move(buildings);
|
||||
}
|
||||
|
||||
Energy_Tariff Community::energy_tariff() const {
|
||||
return energy_Tariff;
|
||||
}
|
||||
|
||||
void Community::set_energy_tariff(const Energy_Tariff& energy_tariff) {
|
||||
energy_Tariff = energy_tariff;
|
||||
}
|
||||
36
src/model/Community.h
Normal file
36
src/model/Community.h
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Created by Stani on 09/03/2025.
|
||||
//
|
||||
|
||||
#ifndef COMMUNITY_H
|
||||
#define COMMUNITY_H
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "building/Building.h"
|
||||
#include "Energy_Tariff.h"
|
||||
|
||||
|
||||
class Community {
|
||||
public:
|
||||
std::string name() const;
|
||||
|
||||
void set_name(const std::string &name);
|
||||
|
||||
std::vector<std::unique_ptr<Building::Base>>& buildings();
|
||||
|
||||
void set_buildings(std::vector<std::unique_ptr<Building::Base>> buildings);
|
||||
|
||||
Energy_Tariff energy_tariff() const;
|
||||
|
||||
void set_energy_tariff(const Energy_Tariff &energy_tariff);
|
||||
|
||||
private:
|
||||
std::string Name;
|
||||
std::vector<std::unique_ptr<Building::Base>> Buildings;
|
||||
Energy_Tariff energy_Tariff;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //COMMUNITY_H
|
||||
5
src/model/Energy_Tariff.cpp
Normal file
5
src/model/Energy_Tariff.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by Stani on 09/03/2025.
|
||||
//
|
||||
|
||||
#include "Energy_Tariff.h"
|
||||
16
src/model/Energy_Tariff.h
Normal file
16
src/model/Energy_Tariff.h
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Stani on 09/03/2025.
|
||||
//
|
||||
|
||||
#ifndef ENERGY_TARIFF_H
|
||||
#define ENERGY_TARIFF_H
|
||||
|
||||
|
||||
|
||||
class Energy_Tariff {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //ENERGY_TARIFF_H
|
||||
150
src/model/building/Building.cpp
Normal file
150
src/model/building/Building.cpp
Normal file
@ -0,0 +1,150 @@
|
||||
//
|
||||
// Created by Stani on 09/03/2025.
|
||||
//
|
||||
|
||||
#include "Building.h"
|
||||
|
||||
float Building::Cost::special_rate_consumption() const {
|
||||
return SpecialRateConsumption;
|
||||
}
|
||||
|
||||
void Building::Cost::set_special_rate_consumption(float special_rate_consumption) {
|
||||
SpecialRateConsumption = special_rate_consumption;
|
||||
}
|
||||
|
||||
float Building::Cost::special_rate_generation() const {
|
||||
return SpecialRateGeneration;
|
||||
}
|
||||
|
||||
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() {
|
||||
return CommunityCoverage;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::
|
||||
set_community_coverage(std::vector<std::unique_ptr<float>> community_coverage) {
|
||||
CommunityCoverage = std::move(community_coverage);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float>>& Building::Simulation_Values::own_usage() {
|
||||
return OwnUsage;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_own_usage(std::vector<std::unique_ptr<float>> own_usage) {
|
||||
OwnUsage = std::move(own_usage) ;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float>>& Building::Simulation_Values::needed_con() {
|
||||
return Needed_con;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_needed_con(std::vector<std::unique_ptr<float>> needed_con) {
|
||||
Needed_con = std::move(needed_con) ;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float>>& Building::Simulation_Values::needed_gen() {
|
||||
return NeededGen;
|
||||
}
|
||||
|
||||
void Building::Simulation_Values::set_needed_gen(std::vector<std::unique_ptr<float>> needed_gen) {
|
||||
NeededGen = std::move(needed_gen);
|
||||
}
|
||||
|
||||
std::string Building::Metadata::name() const {
|
||||
return Name;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_name(const std::string &name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
float Building::Metadata::annual_consumption() const {
|
||||
return AnnualConsumption;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_annual_consumption(float annual_consumption) {
|
||||
AnnualConsumption = annual_consumption;
|
||||
}
|
||||
|
||||
float Building::Metadata::annual_generation() const {
|
||||
return AnnualGeneration;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_annual_generation(float annual_generation) {
|
||||
AnnualGeneration = annual_generation;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float>>& Building::Metadata::consumption_profile() {
|
||||
return ConsumptionProfile;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_consumption_profile(std::vector<std::unique_ptr<float>> consumption_profile) {
|
||||
ConsumptionProfile = std::move(consumption_profile);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<float>>& Building::Metadata::generation_profile() {
|
||||
return GenerationProfile;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_generation_profile(std::vector<std::unique_ptr<float>> generation_profile) {
|
||||
GenerationProfile = std::move(generation_profile);
|
||||
}
|
||||
|
||||
std::string Building::Metadata::consumption_profile_name() const {
|
||||
return ConsumptionProfileName;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_consumption_profile_name(const std::string &consumption_profile_name) {
|
||||
ConsumptionProfileName = consumption_profile_name;
|
||||
}
|
||||
|
||||
std::string Building::Metadata::generation_profile_name() const {
|
||||
return GenerationProfileName;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_generation_profile_name(const std::string &generation_profile_name) {
|
||||
GenerationProfileName = generation_profile_name;
|
||||
}
|
||||
|
||||
short Building::Metadata::connection_power() const {
|
||||
return ConnectionPower;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_connection_power(short connection_power) {
|
||||
ConnectionPower = connection_power;
|
||||
}
|
||||
|
||||
short Building::Metadata::grid_power() const {
|
||||
return GridPower;
|
||||
}
|
||||
|
||||
void Building::Metadata::set_grid_power(short grid_power) {
|
||||
GridPower = grid_power;
|
||||
}
|
||||
|
||||
std::unique_ptr<Building::Cost>& Building::Base::cost() {
|
||||
return Cost;
|
||||
}
|
||||
|
||||
void Building::Base::set_cost(std::unique_ptr<Building::Cost> &cost) {
|
||||
Cost = std::move(cost);
|
||||
}
|
||||
|
||||
std::unique_ptr<Building::Simulation_Values>& Building::Base::values() {
|
||||
return Values;
|
||||
}
|
||||
|
||||
void Building::Base::set_values(std::unique_ptr<Simulation_Values> &values) {
|
||||
Values = std::move(values);
|
||||
}
|
||||
|
||||
std::unique_ptr<Building::Metadata>& Building::Base::metadata() {
|
||||
return Metadata;
|
||||
}
|
||||
|
||||
void Building::Base::set_metadata(std::unique_ptr<Building::Metadata> &metadata) {
|
||||
Metadata = std::move(metadata);
|
||||
}
|
||||
86
src/model/building/Building.h
Normal file
86
src/model/building/Building.h
Normal file
@ -0,0 +1,86 @@
|
||||
//
|
||||
// Created by Stani on 09/03/2025.
|
||||
//
|
||||
|
||||
#ifndef BUILDING_H
|
||||
#define BUILDING_H
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Building {
|
||||
class Cost {
|
||||
private:
|
||||
float SpecialRateConsumption;
|
||||
float SpecialRateGeneration;
|
||||
public:
|
||||
float special_rate_consumption() const;
|
||||
void set_special_rate_consumption(float special_rate_consumption);
|
||||
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;
|
||||
public:
|
||||
std::vector<std::unique_ptr<float>>& community_coverage();
|
||||
void set_community_coverage(std::vector<std::unique_ptr<float>> community_coverage);
|
||||
std::vector<std::unique_ptr<float>>& own_usage();
|
||||
void set_own_usage(std::vector<std::unique_ptr<float>> own_usage);
|
||||
std::vector<std::unique_ptr<float>>& needed_con();
|
||||
void set_needed_con(std::vector<std::unique_ptr<float>> needed_con);
|
||||
std::vector<std::unique_ptr<float>>& needed_gen();
|
||||
void set_needed_gen(std::vector<std::unique_ptr<float>> needed_gen);
|
||||
};
|
||||
class Metadata {
|
||||
private:
|
||||
std::string Name;
|
||||
float AnnualConsumption;
|
||||
float AnnualGeneration;
|
||||
std::vector<std::unique_ptr<float>> ConsumptionProfile;
|
||||
std::vector<std::unique_ptr<float>> GenerationProfile;
|
||||
std::string ConsumptionProfileName;
|
||||
std::string GenerationProfileName;
|
||||
short ConnectionPower;
|
||||
short GridPower;
|
||||
public:
|
||||
std::string name() const;
|
||||
void set_name(const std::string &name);
|
||||
float annual_consumption() const;
|
||||
void set_annual_consumption(float annual_consumption);
|
||||
float annual_generation() const;
|
||||
void set_annual_generation(float annual_generation);
|
||||
std::vector<std::unique_ptr<float>>& consumption_profile();
|
||||
void set_consumption_profile(std::vector<std::unique_ptr<float>> consumption_profile);
|
||||
std::vector<std::unique_ptr<float>>& generation_profile();
|
||||
void set_generation_profile(std::vector<std::unique_ptr<float>> generation_profile);
|
||||
std::string consumption_profile_name() const;
|
||||
void set_consumption_profile_name(const std::string &consumption_profile_name);
|
||||
std::string generation_profile_name() const;
|
||||
void set_generation_profile_name(const std::string &generation_profile_name);
|
||||
short connection_power() const;
|
||||
void set_connection_power(short connection_power);
|
||||
short grid_power() const;
|
||||
void set_grid_power(short grid_power);
|
||||
};
|
||||
|
||||
class Base {
|
||||
private:
|
||||
std::unique_ptr<Cost> Cost;
|
||||
std::unique_ptr<Simulation_Values> Values;
|
||||
std::unique_ptr<Metadata> Metadata;
|
||||
public:
|
||||
std::unique_ptr<Building::Cost>& cost();
|
||||
void set_cost(std::unique_ptr<Building::Cost> &cost);
|
||||
std::unique_ptr<Simulation_Values> & values();
|
||||
void set_values(std::unique_ptr<Simulation_Values> &values);
|
||||
std::unique_ptr<Building::Metadata> & metadata();
|
||||
void set_metadata(std::unique_ptr<Building::Metadata> &metadata);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //BUILDING_H
|
||||
Reference in New Issue
Block a user