Skip to content
Snippets Groups Projects
Select Git revision
  • ff44e24fe8e89255ccfbbe09842c7932190c4da7
  • master default protected
  • L2SS-1914-fix_job_dispatch
  • TMSS-3170
  • TMSS-3167
  • TMSS-3161
  • TMSS-3158-Front-End-Only-Allow-Changing-Again
  • TMSS-3133
  • TMSS-3319-Fix-Templates
  • test-fix-deploy
  • TMSS-3134
  • TMSS-2872
  • defer-state
  • add-custom-monitoring-points
  • TMSS-3101-Front-End-Only
  • TMSS-984-choices
  • SDC-1400-Front-End-Only
  • TMSS-3079-PII
  • TMSS-2936
  • check-for-max-244-subbands
  • TMSS-2927---Front-End-Only-PXII
  • Before-Remove-TMSS
  • LOFAR-Release-4_4_318 protected
  • LOFAR-Release-4_4_317 protected
  • LOFAR-Release-4_4_316 protected
  • LOFAR-Release-4_4_315 protected
  • LOFAR-Release-4_4_314 protected
  • LOFAR-Release-4_4_313 protected
  • LOFAR-Release-4_4_312 protected
  • LOFAR-Release-4_4_311 protected
  • LOFAR-Release-4_4_310 protected
  • LOFAR-Release-4_4_309 protected
  • LOFAR-Release-4_4_308 protected
  • LOFAR-Release-4_4_307 protected
  • LOFAR-Release-4_4_306 protected
  • LOFAR-Release-4_4_304 protected
  • LOFAR-Release-4_4_303 protected
  • LOFAR-Release-4_4_302 protected
  • LOFAR-Release-4_4_301 protected
  • LOFAR-Release-4_4_300 protected
  • LOFAR-Release-4_4_299 protected
41 results

chartresourceusagecontroller.js

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    MCU_debug_access.py 2.28 KiB
    #! /usr/bin/env python3
    
    # this script connects to a server (specified in this file) and prints any debug messages the server has
    # The server stores its most recent degug messages in a buffer. This client polls that buffer every 2 seconds
    # The client checks for duplicates and prints any new debug messages.
    # currently a small issue where the order is incorrect when the server buffer jumps back from max_pos to 0
    
    import sys
    import time
    import logging
    
    host = "localhost"
    port = 62000
    
    sys.path.insert(0, "..")
    
    from opcua import Client
    
    if __name__ == "__main__":
    	logging.basicConfig(level=logging.WARNING) #INFO ERROR WARNING NOTSET DEBUG
    
    	# for now, just connect to this client
    	client = Client("opc.tcp://{}:{}/".format(host, port))
    
    	try:
    		# connect to client
    		client.connect()
    		print("I'm in")
    
    		# get the root node
    		root = client.get_root_node()
    
    		# get the debug node
    		debug_node = root.get_child(["0:Objects", "1:Debug_redirect"])
    
    		# get the debug messages
    		debug_msg = debug_node.get_children()
    
    		nof_msg = len(debug_msg)
    
    		print("")
    		print("~~~~~~~~~~~~~~~~~~~~~~~~~")
    
    		# time.sleep(1)
    
    		name_store = []
    
    		# store all node names and print all debug messages
    		for i in range(nof_msg):
    			time.sleep(0.01)
    			name_store.append(1)
    			name_store[i] = debug_msg[i].get_browse_name()
    			# print(debug_msg[i].get_browse_name())
    			print(debug_msg[i].get_value(), end='')
    
    
    
    		while True:
    
    			# go through all the variable nodes
    			for i in range(nof_msg):
    				duplicate = False
    				name_holder = debug_msg[i].get_browse_name()	 # get a new variable node name
    
    				# stored preemtively to decrease chances of being changed in the meantime by the server
    				msg_holder = debug_msg[i].get_value()
    
    				for j in range(nof_msg):	 # check if this name is already stored
    					if name_holder == name_store[j]:	 # if it already exists, skip
    						duplicate = True
    						break
    
    				if not duplicate:	 # if this message hasnt been stored yet
    					# TODO: check higher entries first when i == 0. In that case they might store newer entries and mess the order up
    					name_store[i] = name_holder
    					print(name_holder, ": ", msg_holder, end='')
    
    				time.sleep(0.01)
    
    			time.sleep(2)
    
    	except:
    		print(" no connection || error")
    		time.sleep(1)
    	finally:
    		print(" disconnect")
    		client.disconnect()
    		time.sleep(1)