-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolar_energy_source.cpp
More file actions
39 lines (35 loc) · 860 Bytes
/
solar_energy_source.cpp
File metadata and controls
39 lines (35 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @project VUT FIT - IMS project
* @author Juraj Holub <xholub40@stud.fit.vutbr.cz>
* @author Matej Parobek <xparob00@stud.fit.vutbr.cz>
* @date November 2019
*/
#include "solar_energy_source.h"
SolarEnergySource::SolarEnergySource
(
YearCycle *yearCycle,
MonthlyEnergyFlow *monthlyEnergyFlow,
Store *dailyEnergyConsumption,
Statistics *statistics
)
{
this->yearCycle = yearCycle;
this->monthlyEnergyFlow = monthlyEnergyFlow;
this->dailyEnergyConsumption = dailyEnergyConsumption;
this->statistics = statistics;
}
void SolarEnergySource::Behavior()
{
statistics->consumeEnergy();
if (dailyEnergyConsumption->Full())
{
statistics->wasteSolarEnergy();
}
else
{
Enter(*dailyEnergyConsumption, 1);
statistics->consumeSolarEnergy();
Wait(1); // wait one day to release daily consumption
Leave(*dailyEnergyConsumption, 1);
}
}