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
f318369a
Commit
f318369a
authored
4 years ago
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
Sample value change
parent
41515285
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/opc_server.cpp
+4
-4
4 additions, 4 deletions
src/opc_server.cpp
src/smg_server.cpp
+28
-32
28 additions, 32 deletions
src/smg_server.cpp
with
32 additions
and
36 deletions
src/opc_server.cpp
+
4
−
4
View file @
f318369a
...
@@ -7,13 +7,13 @@
...
@@ -7,13 +7,13 @@
using
namespace
OpcUa
;
using
namespace
OpcUa
;
UaServer
server
;
UaServer
server
;
Node
renewable
;
std
::
vector
<
OpcUa
::
Variant
>
my_method
(
NodeId
context
,
std
::
vector
<
OpcUa
::
Variant
>
arguments
)
std
::
vector
<
OpcUa
::
Variant
>
my_method
(
NodeId
context
,
std
::
vector
<
OpcUa
::
Variant
>
arguments
)
{
{
std
::
cout
<<
"Method triggered"
<<
std
::
endl
;
std
::
cout
<<
"Method triggered"
<<
std
::
endl
;
Node
vat
=
server
.
GetNode
(
"renewable_power"
)
;
std
::
cout
<<
renewable
.
GetValue
().
ToString
()
<<
std
::
endl
;
std
::
cout
<<
vat
.
ToString
()
<<
std
::
endl
;
std
::
vector
<
OpcUa
::
Variant
>
result
;
std
::
vector
<
OpcUa
::
Variant
>
result
;
result
.
push_back
(
Variant
(
static_cast
<
uint8_t
>
(
0
)));
result
.
push_back
(
Variant
(
static_cast
<
uint8_t
>
(
0
)));
return
result
;
return
result
;
...
@@ -22,7 +22,7 @@ std::vector<OpcUa::Variant> my_method(NodeId context, std::vector<OpcUa::Variant
...
@@ -22,7 +22,7 @@ std::vector<OpcUa::Variant> my_method(NodeId context, std::vector<OpcUa::Variant
void
add_nodes_to
(
uint32_t
idx
,
Node
&
objects
)
void
add_nodes_to
(
uint32_t
idx
,
Node
&
objects
)
{
{
Node
smart_grid
=
objects
.
AddFolder
(
idx
,
"smart_grid"
);
Node
smart_grid
=
objects
.
AddFolder
(
idx
,
"smart_grid"
);
Node
renewable
=
smart_grid
.
AddVariable
(
idx
,
"renewable_power"
,
Variant
(
42.0
));
renewable
=
smart_grid
.
AddVariable
(
idx
,
"renewable_power"
,
Variant
(
42.0
));
Node
prop
=
smart_grid
.
AddProperty
(
idx
,
"a_property_thin"
,
Variant
(
"something"
));
Node
prop
=
smart_grid
.
AddProperty
(
idx
,
"a_property_thin"
,
Variant
(
"something"
));
Node
method
=
smart_grid
.
AddMethod
(
idx
,
"trigger_method_x"
,
my_method
);
Node
method
=
smart_grid
.
AddMethod
(
idx
,
"trigger_method_x"
,
my_method
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/smg_server.cpp
+
28
−
32
View file @
f318369a
...
@@ -51,38 +51,34 @@ void run_sim()
...
@@ -51,38 +51,34 @@ void run_sim()
bool
active
{
true
};
bool
active
{
true
};
while
(
active
)
while
(
active
)
{
{
switch
(
main_state
)
// switch (main_state)
{
// {
case
MainState
::
Simulation
:
// case MainState::Simulation:
switch
(
sim_state
)
// switch (sim_state)
{
// {
case
SimState
::
Entry
:
// case SimState::Entry:
modell
.
put_modell_into_state
(
SmartGridModell
::
DefaultState
::
Off
);
// modell.put_modell_into_state(SmartGridModell::DefaultState::Off);
sim_state
=
SimState
::
Do
;
// sim_state = SimState::Do;
break
;
// break;
case
SimState
::
Do
:
// case SimState::Do:
auto
exit_state
=
sim_state_do
(
modell
,
day
);
// auto exit_state = sim_state_do(modell, day);
if
(
exit_state
==
true
)
// if (exit_state == true)
{
// {
sim_state
=
SimState
::
Exit
;
// sim_state = SimState::Exit;
}
// }
break
;
// break;
case
SimState
::
Exit
:
// case SimState::Exit:
modell
.
put_modell_into_state
(
SmartGridModell
::
DefaultState
::
Off
);
// modell.put_modell_into_state(SmartGridModell::DefaultState::Off);
sim_state
=
SimState
::
Entry
;
// sim_state = SimState::Entry;
main_state
=
MainState
::
ManualControl
;
// main_state = MainState::ManualControl;
break
;
// break;
}
// }
break
;
// break;
case
MainState
::
ManualControl
:
// case MainState::ManualControl:
break
;
// break;
}
// }
}
}
modell
.
put_modell_into_state
(
SmartGridModell
::
DefaultState
::
Off
);
modell
.
put_modell_into_state
(
SmartGridModell
::
DefaultState
::
Off
);
...
...
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