Skip to content

Commit

Permalink
cleaned-up dnp3demo import
Browse files Browse the repository at this point in the history
  • Loading branch information
kefeimo committed Oct 30, 2022
1 parent eb829a6 commit 49ebb36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 57 deletions.
21 changes: 2 additions & 19 deletions src/dnp3demo/control_workflow_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,12 @@
import random
import sys

from datetime import datetime
from pydnp3 import opendnp3
# from master import command_callback
from dnp3_python.dnp3station.station_utils import command_callback

# from master_cmd import MasterCmd
# from outstation_cmd import OutstationCmd

# from src.dnp3_python.master_new import MyMasterNew
# from dnp3_python.dnp3station.master_new import MyMasterNew

# from src.dnp3_python.outstation_new import MyOutStationNew
# from dnp3_python.dnp3station.outstation_new import MyOutStationNew
# from ..dnp3_python.station_utils import SOEHandler

from src.dnp3_python.dnp3station.master_new import MyMasterNew
from src.dnp3_python.dnp3station.outstation_new import MyOutStationNew


# import visitors
from dnp3_python.dnp3station.master_new import MyMasterNew
from dnp3_python.dnp3station.outstation_new import MyOutStationNew

from time import sleep

import datetime

stdout_stream = logging.StreamHandler(sys.stdout)
Expand Down
13 changes: 3 additions & 10 deletions src/dnp3demo/data_retrieval_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@
import random
import sys

from datetime import datetime
from pydnp3 import opendnp3


# from src.dnp3_python.master_new import MyMasterNew
# from dnp3_python.dnp3station.master_new import MyMasterNew
# from src.dnp3_python.outstation_new import MyOutStationNew
# from dnp3_python.dnp3station.outstation_new import MyOutStationNew

from src.dnp3_python.dnp3station.master_new import MyMasterNew
from src.dnp3_python.dnp3station.outstation_new import MyOutStationNew
from dnp3_python.dnp3station.master_new import MyMasterNew
from dnp3_python.dnp3station.outstation_new import MyOutStationNew

import datetime
from time import sleep
Expand All @@ -37,7 +30,7 @@ def main():
_log.debug('Initialization complete. Master Station in command loop.')

count = 0
while count < 10:
while count < 3:
sleep(1) # Note: hard-coded, master station query every 1 sec.

count += 1
Expand Down
8 changes: 2 additions & 6 deletions src/dnp3demo/data_retrieval_demo_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
import random
import sys

from datetime import datetime
from pydnp3 import opendnp3

# from src.dnp3_python.master_new import MyMasterNew
# from dnp3_python.dnp3station.master_new import MyMasterNew
from src.dnp3_python.dnp3station.master_new import MyMasterNew
# from ..dnp3_python.outstation_new import MyOutStationNew
from dnp3_python.dnp3station.master_new import MyMasterNew

import datetime
from time import sleep
Expand All @@ -31,7 +27,7 @@ def main():
# _log.debug('Initialization complete. OutStation in command loop.')

count = 0
while count < 50:
while count < 20:
sleep(3) # Note: hard-coded, master station query every 1 sec.

count += 1
Expand Down
25 changes: 3 additions & 22 deletions src/dnp3demo/data_retrieval_demo_outstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,8 @@
import random
import sys

from datetime import datetime
from pydnp3 import opendnp3, openpal
# from master import MyMaster, MyLogger, AppChannelListener, SOEHandler, MasterApplication
# from ..dnp3_python.master import command_callback, restart_callback

# from dnp3_python import asiodnp3 as asiodnp3

# from master_cmd import MasterCmd
# from master_new import MasterCmdNew
# from ..dnp3_python.master_new import MyMasterNew, MyLogger, AppChannelListener
# from outstation_cmd import OutstationCmd
# from src.dnp3_python.outstation_new import MyOutStationNew
# from dnp3_python.dnp3station.outstation_new import MyOutStationNew
# from dnp3_python import visitors
from src.dnp3_python.dnp3station.outstation_new import MyOutStationNew

from dnp3_python.dnp3station.outstation_new import MyOutStationNew

from time import sleep

Expand Down Expand Up @@ -48,7 +34,7 @@ def main():
_log.debug('Initialization complete. OutStation in command loop.')

count = 0
while count < 50:
while count < 20:
sleep(5) # Note: hard-coded, master station query every 1 sec.

count += 1
Expand Down Expand Up @@ -86,13 +72,8 @@ def main():
outstation_application.apply_update(opendnp3.Binary(True), i)

_log.debug('Exiting.')
# cmd_interface_outstation.do_quit("something")
# cmd_interface_master.do_quit("something")
# quit()
# quit()
# TODO: shutdown gracefully

outstation_application.shutdown()
# del outstation_application


if __name__ == '__main__':
Expand Down

0 comments on commit 49ebb36

Please sign in to comment.