forked from Honza0297/IMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloglib.c
More file actions
131 lines (120 loc) · 4.58 KB
/
loglib.c
File metadata and controls
131 lines (120 loc) · 4.58 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* @author Jan Beran (xberan43)
* Projekt do predmetu IMS na FIT VUT v Brne (2019/2020)
* @date 5.12.2019
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "modelib.h"
#include "loglib.h"
void logDay(int verbosity)
{
if(MlogFrequency > daily) return;
printf("======================\n"
"Daily log #%d\n"
"----------------------\n",Mdays);
printf("GHG [g CO2 eq.]: %lf\n", MdailyCF);
if(verbosity > 0)
{
printf("Production [kWh]: %ld\n",MdailyProductionKWH);
if(verbosity > 1)
{
}
}
printf("======================\n");
}
void logYear(int verbosity)
{
if(MlogFrequency > yearly) return;
static int flag = 1;
if(flag)
{
printf("####################################################\n"
"Yearly log #%d\n"
"----------------------\n", Myears);
if(verbosity>0)
{
printf("Percentage of each power plant type:\n"
"*Coal: %f %%\n"
"*Nuclear: %f %%\n"
"*Wind: %f %%\n"
"*Hydro: %f %%\n"
"*Biomass: %f %%\n"
"*Solar: %f %%\n"
"*Gas: %f %%\n"
"*Other: %f %%\n",
MactualPercentageProduceCoal, MactualPercentageProduceNuclear, MactualPercentageProduceWind,MactualPercentageProduceHydro,
MactualPercentageProduceBiomass, MactualPercentageProduceSolar, MactualPercentageProduceGas, MactualPercentageProduceOther);
if(verbosity > 1)
{
printf("Installed power of each power plant type:\n"
"*Coal: %lu kW\n"
"*Nuclear: %lu kW\n"
"*Wind: %lu kW\n"
"*Hydro: %lu kW\n"
"*Biomass: %lu kW\n"
"*Solar: %lu kW\n"
"*Gas: %lu kW\n"
"*Other: %lu kW\n",
MactualInstalledPowerKWCoal, MactualInstalledPowerKWNuclear, MactualInstalledPowerKWWind,MactualInstalledPowerKWHydro,
MactualInstalledPowerKWBiomass, MactualInstalledPowerKWSolar, MactualInstalledPowerKWGas, MactualInstalledPowerKWOther);
}
}
flag = 0;
}
else
{
printf("------------------------\n");
printf("GHG [g CO2 eq.]*10**9: %lf\n", MyearCF/1000000000.);
if(verbosity > 0)
{
printf("Production [GWh]: %ld\n",MyearlyProductionGWH);
if(verbosity > 1)
{
}
}
flag = 1;
}
}
void logTotal(int verbosity)
{
printf("**************************************\n"
"**************************************\n"
"Total log\n"
"----------------------\n");
printf("GHG [g CO2 eq.]*10**12: %lf\n", MfinalCFkg/1000000000.);
printf("Daily production [kWh] %ld\n", MdailyProductionKWH);
if(verbosity > 0)
{
printf("Years: %d\n", Myears);
printf("Percentage of each power plant type:\n"
"*Coal: %f %%\n"
"*Nuclear: %f %%\n"
"*Wind: %f %%\n"
"*Hydro: %f %%\n"
"*Biomass: %f %%\n"
"*Solar: %f %%\n"
"*Gas: %f %%\n"
"*Other: %f %%\n",
MactualPercentageProduceCoal, MactualPercentageProduceNuclear, MactualPercentageProduceWind,MactualPercentageProduceHydro,
MactualPercentageProduceBiomass, MactualPercentageProduceSolar, MactualPercentageProduceGas, MactualPercentageProduceOther);
if(verbosity > 1)
{
printf("------------------------\n");
printf("Installed power of each power plant type:\n"
"*Coal: %lu kW\n"
"*Nuclear: %lu kW\n"
"*Wind: %lu kW\n"
"*Hydro: %lu kW\n"
"*Biomass: %lu kW\n"
"*Solar: %lu kW\n"
"*Gas: %lu kW\n"
"*Other: %lu kW\n",
MactualInstalledPowerKWCoal, MactualInstalledPowerKWNuclear, MactualInstalledPowerKWWind,MactualInstalledPowerKWHydro,
MactualInstalledPowerKWBiomass, MactualInstalledPowerKWSolar, MactualInstalledPowerKWGas, MactualInstalledPowerKWOther);
}
}
printf("**************************************\n"
"**************************************\n");
}