Untitled
unknown
python
a year ago
1.1 kB
2
Indexable
Never
from opcua import Server, ua if __name__ == '__main__': server = Server() url = 'opc.tcp://localhost:62541' server.set_endpoint(url) server.set_server_name('Tango Simulation Server') server.set_security_policy([ua.SecurityPolicyType.NoSecurity]) namespace = 'TANGO_SIMULATION_SERVER' idx = server.register_namespace(namespace) node = server.get_objects_node() upack_process_folder = node.add_folder(idx, 'GVL.UnpackProcess') device_node = upack_process_folder.add_object(idx, 'MccStd_001') device_node.add_variable(idx, 'bForwardButton', False) device_node.add_variable(idx, 'bAutoButton', False) device_node.add_variable(idx, 'bTermFuse', False) device_node.add_variable(idx, 'bSupply', False) device_node.add_variable(idx, 'udHours', 0) device_node.add_variable(idx, 'uMinutes', 0) device_node.add_variable(idx, 'uSeconds', 0) device_node.add_variable(idx, 'sStatus', '') device_node.add_variable(idx, 'sState', '') server.start() print(f'Server started at {url}')