Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Smart Grid Modell
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Co
Smart Grid Modell
Commits
f059ae1f
Commit
f059ae1f
authored
4 years ago
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
Update
parent
9bd0a3fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/smg_server.cpp
+11
-6
11 additions, 6 deletions
src/smg_server.cpp
with
11 additions
and
6 deletions
src/smg_server.cpp
+
11
−
6
View file @
f059ae1f
...
@@ -80,6 +80,13 @@ public:
...
@@ -80,6 +80,13 @@ public:
print_states
();
print_states
();
}
}
float
excess_power
()
{
auto
sum_prod
=
m_production
.
conventional
+
m_production
.
renewable
.
solar
+
m_production
.
renewable
.
wind
;
auto
sum_used
=
m_usage
.
industry
+
m_usage
.
village
;
return
sum_prod
-
sum_used
;
}
private
:
private
:
void
update_time
()
void
update_time
()
{
{
...
@@ -101,16 +108,12 @@ private:
...
@@ -101,16 +108,12 @@ private:
double
wind_by_sun
=
m_sun
*
5.0
/
100.0
;
// wind by sun should by 5 max.
double
wind_by_sun
=
m_sun
*
5.0
/
100.0
;
// wind by sun should by 5 max.
auto
random_wind
=
((
std
::
rand
()
*
1.0
)
/
RAND_MAX
)
*
7.0
;
auto
random_wind
=
((
std
::
rand
()
*
1.0
)
/
RAND_MAX
)
*
7.0
;
m_wind
=
power_wind
[
static_cast
<
int
>
(
wind_by_sun
+
random_wind
)];
m_wind
=
power_wind
[
static_cast
<
int
>
(
wind_by_sun
+
random_wind
)];
spdlog
::
debug
(
"wind: {} {} {}"
,
random_wind
,
wind_by_sun
,
m_wind
);
}
}
void
update_power_production
()
void
update_power_production
()
{
{
m_production
.
renewable
.
solar
=
m_sun
*
solar_size
;
m_production
.
renewable
.
solar
=
m_sun
*
solar_size
;
spdlog
::
debug
(
"wind power {} {}"
,
m_production
.
renewable
.
wind
,
m_wind
);
m_production
.
renewable
.
wind
=
m_wind
*
windpark_size
;
m_production
.
renewable
.
wind
=
m_wind
*
windpark_size
;
m_production
.
conventional
=
MaxPower
::
conventional
;
m_production
.
conventional
=
MaxPower
::
conventional
;
spdlog
::
debug
(
"wind power {} {}"
,
m_production
.
renewable
.
wind
,
m_wind
);
}
}
void
update_power_consumption
()
void
update_power_consumption
()
{
{
...
@@ -142,6 +145,7 @@ private:
...
@@ -142,6 +145,7 @@ private:
spdlog
::
debug
(
"Time <{}> Sun <{}> Wind<{}>"
,
m_time
,
m_sun
,
m_wind
);
spdlog
::
debug
(
"Time <{}> Sun <{}> Wind<{}>"
,
m_time
,
m_sun
,
m_wind
);
spdlog
::
debug
(
"Power Conv <{}> Solar <{}> Wind<{}>"
,
m_production
.
conventional
,
m_production
.
renewable
.
solar
,
m_production
.
renewable
.
wind
);
spdlog
::
debug
(
"Power Conv <{}> Solar <{}> Wind<{}>"
,
m_production
.
conventional
,
m_production
.
renewable
.
solar
,
m_production
.
renewable
.
wind
);
spdlog
::
debug
(
"Usage Village<{}> Industry<{}>"
,
m_usage
.
village
,
m_usage
.
industry
);
spdlog
::
debug
(
"Usage Village<{}> Industry<{}>"
,
m_usage
.
village
,
m_usage
.
industry
);
spdlog
::
debug
(
"excess_power<{}>"
,
excess_power
());
}
}
};
};
...
@@ -163,6 +167,7 @@ void run_sim()
...
@@ -163,6 +167,7 @@ void run_sim()
spdlog
::
debug
(
"Modell created"
);
spdlog
::
debug
(
"Modell created"
);
modell
.
put_modell_into_state
(
SmartGridModell
::
DefaultState
::
Off
);
modell
.
put_modell_into_state
(
SmartGridModell
::
DefaultState
::
Off
);
Day
day
{};
Day
day
{};
bool
active
{
true
};
bool
active
{
true
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment