{"id":49,"date":"2025-10-23T01:00:49","date_gmt":"2025-10-23T01:00:49","guid":{"rendered":"https:\/\/5047878.net\/blog\/?p=49"},"modified":"2025-10-23T01:07:53","modified_gmt":"2025-10-23T01:07:53","slug":"%ed%8c%8c%ec%9d%b4%ec%8d%ac%ec%9c%bc%eb%a1%9c-opc-%ed%86%b5%ec%8b%a0%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/5047878.net\/?p=49","title":{"rendered":"\ud30c\uc774\uc36c\uc73c\ub85c OPC \ud1b5\uc2e0\ud558\uae30"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\ud83e\udde0 \ud30c\uc774\uc36c OPC \ud1b5\uc2e0 \uc644\ubcbd \uac00\uc774\ub4dc (Python OPC UA \uc11c\ubc84\u00b7\ud074\ub77c\uc774\uc5b8\ud2b8 \uc608\uc81c)<\/h1>\n\n\n\n<p>\uc0b0\uc5c5 \uc790\ub3d9\ud654, PLC, IoT \ud658\uacbd\uc5d0\uc11c \uac00\uc7a5 \ub110\ub9ac \uc4f0\uc774\ub294 \ud45c\uc900 \ud1b5\uc2e0 \ubc29\uc2dd\uc740 <strong>OPC (OLE for Process Control)<\/strong> \uc785\ub2c8\ub2e4.<br>\ud2b9\ud788 \ucd5c\uadfc\uc5d0\ub294 <strong>Python OPC UA \ud1b5\uc2e0<\/strong>\uc744 \ud65c\uc6a9\ud574 \ub2e4\uc591\ud55c \uc124\ube44 \ub370\uc774\ud130\uc640 \ud074\ub77c\uc6b0\ub4dc \uc2dc\uc2a4\ud15c\uc744 \uc5f0\uacb0\ud558\ub294 \uc0ac\ub840\uac00 \ube60\ub974\uac8c \ub298\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\uc774 \uae00\uc5d0\uc11c\ub294 <strong>\ud30c\uc774\uc36c\uc73c\ub85c OPC UA \ud1b5\uc2e0\uc744 \uad6c\ud604\ud558\ub294 \ubc29\ubc95<\/strong>\uc744 \ucd08\ubcf4\uc790\ub3c4 \ub530\ub77c \ud560 \uc218 \uc788\ub3c4\ub85d \ub2e8\uacc4\ubcc4 \uc608\uc81c\uc640 \ud568\uaed8 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\ud83e\udde9 \ubcf8\ubb38\uc5d0\uc11c\ub294 <strong>OPC UA \uc11c\ubc84\u00b7\ud074\ub77c\uc774\uc5b8\ud2b8 \uad6c\ucd95 \ucf54\ub4dc \uc608\uc2dc<\/strong>, <strong>\ud658\uacbd \uc124\uc815<\/strong>, <strong>\uc2e4\ud589 \ubc29\ubc95<\/strong>\uae4c\uc9c0 \ubaa8\ub450 \ub2e4\ub8f9\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccc OPC UA\ub780? (Python OPC \ud1b5\uc2e0 \uac1c\ub150 \uc774\ud574)<\/h2>\n\n\n\n<p>**OPC UA (Unified Architecture)**\ub294 \uc0b0\uc5c5 \ud604\uc7a5\uc758 \uc13c\uc11c, PLC, SCADA, MES \ub4f1 \ub2e4\uc591\ud55c \uc2dc\uc2a4\ud15c \uac04 \ub370\uc774\ud130\ub97c \uad50\ud658\ud558\uae30 \uc704\ud55c <strong>\uad6d\uc81c \ud45c\uc900 \ud1b5\uc2e0 \uaddc\uc57d<\/strong>\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\uae30\uc874\uc758 **OPC DA (Data Access)**\ub294 Windows COM \uae30\ubc18\uc774\ub77c \ud638\ud658\uc131\uc5d0 \ud55c\uacc4\uac00 \uc788\uc5c8\uc9c0\ub9cc,<br>OPC UA\ub294 <strong>\uc6b4\uc601\uccb4\uc81c \ub3c5\ub9bd\uc801<\/strong>\uc774\uba70 <strong>\ubcf4\uc548\uc131<\/strong>, <strong>\ud655\uc7a5\uc131<\/strong>, <strong>\ud45c\uc900 \ub370\uc774\ud130 \ubaa8\ub378\ub9c1<\/strong>\uc774 \uac00\ub2a5\ud574 \uc0b0\uc5c5 4.0 \uc2dc\ub300\uc758 \ud575\uc2ec \ud504\ub85c\ud1a0\ucf5c\ub85c \uc790\ub9ac\uc7a1\uc558\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 OPC UA \uc8fc\uc694 \ud2b9\uc9d5 \uc694\uc57d<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud83d\udd17 <strong>\ud50c\ub7ab\ud3fc \ub3c5\ub9bd\uc801<\/strong>: Windows, Linux, Embedded \ub4f1 \ubaa8\ub450 \uc9c0\uc6d0<\/li>\n\n\n\n<li>\ud83d\udd12 <strong>\ubcf4\uc548\uc131 \uac15\ud654<\/strong>: \uc778\uc99d\uc11c \uae30\ubc18 \uc554\ud638\ud654 \ubc0f \uc138\uc158 \uad00\ub9ac<\/li>\n\n\n\n<li>\ud83c\udf10 <strong>\ud504\ub85c\ud1a0\ucf5c \ub2e4\uc591\uc131<\/strong>: TCP, HTTPS, WebSocket \ub4f1 \ub2e4\uc591\ud55c \ud1b5\uc2e0 \ubc29\uc2dd \uc9c0\uc6d0<\/li>\n\n\n\n<li>\ud83e\uddf1 <strong>\ub370\uc774\ud130 \uad6c\uc870\ud654<\/strong>: \ud0dc\uadf8(Node) \ub2e8\uc704\ub85c \ubcc0\uc218, \uc0c1\ud0dc, \uc774\ubca4\ud2b8 \ub4f1 \ud45c\ud604 \uac00\ub2a5<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udc0d Python OPC UA \ud1b5\uc2e0 \ud658\uacbd \uc900\ube44<\/h2>\n\n\n\n<p>\ud30c\uc774\uc36c\uc73c\ub85c OPC UA \uc11c\ubc84\u00b7\ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \uad6c\ucd95\ud558\ub824\uba74 <strong>FreeOpcUa<\/strong> \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58\ud574\uc57c \ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install opcua\n<\/code><\/pre>\n\n\n\n<p>\ub610\ub294 \uc720\uc9c0\ubcf4\uc218\uac00 \ud65c\ubc1c\ud55c \ubc84\uc804\uc744 \uc6d0\ud55c\ub2e4\uba74:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install freeopcua\n<\/code><\/pre>\n\n\n\n<p>\uc124\uce58 \ud6c4\uc5d0\ub294 OPC UA \uc11c\ubc84\uc640 \ud074\ub77c\uc774\uc5b8\ud2b8 \uac04 \uc2e4\uc2dc\uac04 \ud1b5\uc2e0\uc744 \uad6c\ud604\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udda5 OPC UA \uc11c\ubc84 \uc608\uc81c (\ub370\uc774\ud130 \uc1a1\uc2e0 \uce21 \ucf54\ub4dc)<\/h2>\n\n\n\n<p>\ub2e4\uc74c\uc740 <strong>Python\uc73c\ub85c OPC UA \uc11c\ubc84\ub97c \uad6c\ucd95\ud558\ub294 \uc608\uc81c \ucf54\ub4dc<\/strong>\uc785\ub2c8\ub2e4.<br>\uc2e4\ud589\ud558\uba74 <code>Temperature<\/code> \ubcc0\uc218\uac00 \uc8fc\uae30\uc801\uc73c\ub85c \uac31\uc2e0\ub418\uba70 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc774 \ub370\uc774\ud130\ub97c \uc77d\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from opcua import Server\nimport datetime\nimport time\n\n# OPC UA \uc11c\ubc84 \uc0dd\uc131\nserver = Server()\nserver.set_endpoint(\"opc.tcp:\/\/localhost:4840\/freeopcua\/server\/\")\n\n# \ub124\uc784\uc2a4\ud398\uc774\uc2a4 \ub4f1\ub85d\nuri = \"http:\/\/example.opcua.server\"\nidx = server.register_namespace(uri)\n\n# \uac1d\uccb4 \uc0dd\uc131\nobjects = server.get_objects_node()\ndevice = objects.add_object(idx, \"Device1\")\n\n# \ubcc0\uc218 \ub178\ub4dc \ucd94\uac00\ntemp = device.add_variable(idx, \"Temperature\", 25.0)\ntemp.set_writable()  # \ud074\ub77c\uc774\uc5b8\ud2b8 \uc4f0\uae30 \ud5c8\uc6a9\n\nserver.start()\nprint(\"\u2705 OPC UA \uc11c\ubc84 \uc2dc\uc791\")\n\ntry:\n    while True:\n        new_value = 20.0 + (datetime.datetime.now().second % 10)\n        temp.set_value(new_value)\n        print(f\"Temperature: {new_value}\")\n        time.sleep(1)\nexcept KeyboardInterrupt:\n    print(\"\uc11c\ubc84 \uc885\ub8cc \uc911...\")\n    server.stop()\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udce1 OPC UA \ud074\ub77c\uc774\uc5b8\ud2b8 \uc608\uc81c (\ub370\uc774\ud130 \uc218\uc2e0 \uce21 \ucf54\ub4dc)<\/h2>\n\n\n\n<p>\ud074\ub77c\uc774\uc5b8\ud2b8\ub294 \uc704\uc5d0\uc11c \uc2e4\ud589\ud55c \uc11c\ubc84\uc5d0 \uc811\uc18d\ud574 \ub370\uc774\ud130\ub97c \uc77d\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from opcua import Client\nimport time\n\nclient = Client(\"opc.tcp:\/\/localhost:4840\/freeopcua\/server\/\")\n\ntry:\n    client.connect()\n    print(\"\u2705 OPC UA \uc11c\ubc84 \uc5f0\uacb0 \uc131\uacf5\")\n\n    root = client.get_root_node()\n    print(\"Root Node:\", root)\n\n    # \uc2e4\uc81c \ud658\uacbd\uc5d0 \ub9de\ub294 \ub178\ub4dc ID \uc0ac\uc6a9\n    temp_node = client.get_node(\"ns=2;i=2\")\n\n    while True:\n        value = temp_node.get_value()\n        print(f\"\ud604\uc7ac \uc628\ub3c4 \uac12: {value}\")\n        time.sleep(1)\nfinally:\n    client.disconnect()\n    print(\"\ud074\ub77c\uc774\uc5b8\ud2b8 \uc5f0\uacb0 \uc885\ub8cc\")\n<\/code><\/pre>\n\n\n\n<p>\ud83d\udccc <strong>\ud301:<\/strong><br>\ub178\ub4dc ID(<code>ns=2;i=2<\/code>)\ub294 \uc11c\ubc84\uc5d0\uc11c \uc2e4\uc81c \uc0dd\uc131\ub41c \uac12\uc73c\ub85c \ubcc0\uacbd\ud574\uc57c \ud569\ub2c8\ub2e4.<br>\uc11c\ubc84\uc758 <code>get_objects_node()<\/code>\ub97c \ud1b5\ud574 \uc9c1\uc811 \ud655\uc778 \uac00\ub2a5\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd0d Python OPC UA \ud1b5\uc2e0 \uad6c\uc870 \uc694\uc57d<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\uad6c\uc131\uc694\uc18c<\/th><th>\uc124\uba85<\/th><\/tr><\/thead><tbody><tr><td><strong>\uc11c\ubc84(Server)<\/strong><\/td><td>\ub370\uc774\ud130\ub97c \uc0dd\uc131\ud558\uace0 \uc678\ubd80\uc5d0 \ub178\ub4dc(Tag) \ud615\ud0dc\ub85c \uacf5\uac1c<\/td><\/tr><tr><td><strong>\ud074\ub77c\uc774\uc5b8\ud2b8(Client)<\/strong><\/td><td>\uc11c\ubc84\uc758 \ub178\ub4dc\uc5d0 \uc811\uadfc\ud558\uc5ec \ub370\uc774\ud130\ub97c \uc77d\uac70\ub098 \uc218\uc815<\/td><\/tr><tr><td><strong>Node ID<\/strong><\/td><td>\uac01 \ub370\uc774\ud130 \ud56d\ubaa9\uc758 \uace0\uc720 \uc2dd\ubcc4\uc790 (\uc608: <code>ns=2;i=2<\/code>)<\/td><\/tr><tr><td><strong>Security Policy<\/strong><\/td><td>\uc778\uc99d\uc11c \uae30\ubc18 \uc554\ud638\ud654 \uc124\uc815 (<code>set_security_policy<\/code>)<\/td><\/tr><tr><td><strong>\uc751\uc6a9 \ubd84\uc57c<\/strong><\/td><td>\uc0dd\uc0b0 \ub370\uc774\ud130 \ubaa8\ub2c8\ud130\ub9c1, \uc124\ube44 \uc0c1\ud0dc \uc218\uc9d1, IoT \uac8c\uc774\ud2b8\uc6e8\uc774<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2699\ufe0f Python OPC UA \uc2e4\ubb34 \uc751\uc6a9 \uc0ac\ub840<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>PLC \ub370\uc774\ud130 \uc218\uc9d1 \uc2dc\uc2a4\ud15c<\/strong><br>Siemens, Omron, Mitsubishi \ub4f1\uc758 PLC\uc5d0\uc11c OPC UA \uc11c\ubc84\ub85c \ub370\uc774\ud130\ub97c \uc218\uc9d1\ud558\uace0 Python\uc73c\ub85c \ucc98\ub9ac<\/li>\n\n\n\n<li><strong>\uacf5\uc815 \ub370\uc774\ud130 \ub300\uc2dc\ubcf4\ub4dc<\/strong><br>Python + Grafana + InfluxDB \uc870\ud569\uc73c\ub85c OPC \ub370\uc774\ud130\ub97c \uc2dc\uac01\ud654<\/li>\n\n\n\n<li><strong>AI \uae30\ubc18 \uc608\uc9c0\ubcf4\uc804 \uc2dc\uc2a4\ud15c<\/strong><br>OPC UA\ub97c \ud1b5\ud574 \uc124\ube44 \ub370\uc774\ud130\ub97c \uc218\uc9d1\ud558\uace0 \uba38\uc2e0\ub7ec\ub2dd \ubd84\uc11d \ubaa8\ub378\uc5d0 \ud65c\uc6a9<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udca1 OPC UA \ud1b5\uc2e0\uc758 \uc7a5\uc810 (Python \ud65c\uc6a9 \uc2dc \uc774\uc810)<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud83d\udca8 \ubcf5\uc7a1\ud55c \uc790\ub3d9\ud654 \uc2dc\uc2a4\ud15c \uac04 \ub370\uc774\ud130 \uad50\ud658\uc744 Python \ucf54\ub4dc \uba87 \uc904\ub85c \ucc98\ub9ac<\/li>\n\n\n\n<li>\ud83d\udd12 \uc554\ud638\ud654 \ud1b5\uc2e0\uc73c\ub85c \uc548\uc815\uc801\uc778 \uc0b0\uc5c5 \ub124\ud2b8\uc6cc\ud06c \uad6c\uc131 \uac00\ub2a5<\/li>\n\n\n\n<li>\ud83c\udf10 \ud074\ub77c\uc6b0\ub4dc IoT, \ub370\uc774\ud130\ubca0\uc774\uc2a4, REST API \ub4f1\uacfc \uc5f0\ub3d9 \uc6a9\uc774<\/li>\n<\/ul>\n\n\n\n<p>Python\uc740 <strong>\uc0b0\uc5c5 \uc790\ub3d9\ud654 + \ub370\uc774\ud130 \ubd84\uc11d<\/strong>\uc744 \uc5f0\uacb0\ud558\ub294 \ube0c\ub9bf\uc9c0 \uc5ed\ud560\uc744 \ud558\uae30\uc5d0 \ucd5c\uc801\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\ude80 \ub9c8\ubb34\ub9ac: Python\uc73c\ub85c \uc2dc\uc791\ud558\ub294 OPC UA<\/h2>\n\n\n\n<p>\uc774\uc81c \uc5ec\ub7ec\ubd84\uc740 \ud30c\uc774\uc36c\uc73c\ub85c <strong>OPC UA \uc11c\ubc84\uc640 \ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \uc9c1\uc811 \uad6c\ud604<\/strong>\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>\ud14c\uc2a4\ud2b8 \uc2dc <strong>\uc11c\ubc84 \u2192 \ud074\ub77c\uc774\uc5b8\ud2b8 \uc21c\uc11c<\/strong>\ub85c \uc2e4\ud589\ud558\uba74 \uc2e4\uc2dc\uac04 \ub370\uc774\ud130 \uad50\ud658\uc774 \ubc14\ub85c \ud655\uc778\ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\ub2e4\uc74c \uae00\uc5d0\uc11c\ub294 <strong>Python OPC UA \uc778\uc99d\uc11c \ubcf4\uc548 \uc124\uc815<\/strong>, <strong>OPC DA \u2194 OPC UA \ubcc0\ud658 \ubc29\ubc95<\/strong>,<br><strong>InfluxDB\ub85c \ub370\uc774\ud130 \uc800\uc7a5<\/strong>\uae4c\uc9c0 \ud655\uc7a5\ud558\ub294 \ub0b4\uc6a9\uc744 \ub2e4\ub8f0 \uc608\uc815\uc785\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd17 \ucc38\uace0 \uc790\ub8cc<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/FreeOpcUa\">FreeOpcUa \uacf5\uc2dd \ubb38\uc11c<\/a><\/li>\n\n\n\n<li><a>OPC Foundation<\/a><\/li>\n\n\n\n<li><a>OPC UA Specification Overview<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/FreeOpcUa\/python-opcua\">Python OPC UA \ud29c\ud1a0\ub9ac\uc5bc (GitHub \uc608\uc81c)<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\ud83e\udde0 \ud30c\uc774\uc36c OPC \ud1b5\uc2e0 \uc644\ubcbd \uac00\uc774\ub4dc (Python OPC UA \uc11c\ubc84\u00b7\ud074\ub77c\uc774\uc5b8\ud2b8 \uc608\uc81c) \uc0b0\uc5c5 \uc790\ub3d9\ud654, PLC, IoT \ud658\uacbd\uc5d0\uc11c \uac00\uc7a5 \ub110\ub9ac<\/p>\n","protected":false},"author":1,"featured_media":50,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,7],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it","category-python"],"_links":{"self":[{"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/5047878.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":2,"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/52"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/5047878.net\/index.php?rest_route=\/wp\/v2\/media\/50"}],"wp:attachment":[{"href":"https:\/\/5047878.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/5047878.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/5047878.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}