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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Co
Smart Grid Modell
Commits
0ef66acd
Commit
0ef66acd
authored
4 years ago
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
Subscribe to all data changes
parent
e61f31fe
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/apps/smart_grid/SmartOpcServer.cpp
+10
-0
10 additions, 0 deletions
src/apps/smart_grid/SmartOpcServer.cpp
with
10 additions
and
0 deletions
src/apps/smart_grid/SmartOpcServer.cpp
+
10
−
0
View file @
0ef66acd
...
@@ -90,10 +90,20 @@ void SmartOpcServer::run_server()
...
@@ -90,10 +90,20 @@ void SmartOpcServer::run_server()
auto
sub_production_enabled
=
m_server
.
CreateSubscription
(
100
,
subcl_production_enabled
);
auto
sub_production_enabled
=
m_server
.
CreateSubscription
(
100
,
subcl_production_enabled
);
sub_production_enabled
->
SubscribeDataChange
(
m_producing
);
sub_production_enabled
->
SubscribeDataChange
(
m_producing
);
SubClientSimModeEnabled
subcl_sim_mode_enabled
{
m_state_machine
};
auto
sub_sim_mode_enabled
=
m_server
.
CreateSubscription
(
100
,
subcl_sim_mode_enabled
);
sub_sim_mode_enabled
->
SubscribeDataChange
(
m_sim_mode_enabled
);
while
(
true
)
while
(
true
)
{
{
m_state_machine
.
run
();
m_state_machine
.
run
();
// update opc objects
m_time
.
SetValue
(
Variant
(
m_state_machine
.
m_model
.
get_time
()));
m_excess_power
.
SetValue
(
Variant
(
m_state_machine
.
m_model
.
get_excess_power
()));
m_producing
.
SetValue
(
Variant
(
m_state_machine
.
m_model
.
get_producing_state
()));
m_sim_mode_enabled
.
SetValue
(
Variant
(
m_state_machine
.
is_sim_mode_enabled
()));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
}
}
}
}
\ No newline at end of file
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