{"id":4006,"date":"2020-09-04T07:29:25","date_gmt":"2020-09-03T22:29:25","guid":{"rendered":"https:\/\/now0930.pe.kr\/wordpress\/?p=4006"},"modified":"2020-09-07T04:44:32","modified_gmt":"2020-09-06T19:44:32","slug":"raspberry-pi-opcua","status":"publish","type":"post","link":"https:\/\/now0930.pe.kr\/wordpress\/raspberry-pi-opcua\/","title":{"rendered":"raspberry pi + opc-ua + open62541 \uc0bd\uc9c8\uae30"},"content":{"rendered":"\n<p>\ud558. \ub4dc\ub514\uc5b4 \uc5ec\uae30\uae4c\uc9c0 \uc654\ub2e4. opc ua\ub97c \uc124\uce58\ud558\uba74 \uc790\ub3d9\ud654 \uae30\uae30\uc5d0\uc11c \uc815\ubcf4\ub97c \uc27d\uac8c \uc77d\uc744 \uc218 \uc788\ub2e4. <a href=\"http:\/\/egloos.zum.com\/snowxtal\/v\/3252769\">\uc5ec\uae30<\/a>\uc5d0\uc11c \uc5ec\ub7ec <a href=\"https:\/\/github.com\/open62541\/open62541\/wiki\/List-of-Open-Source-OPC-UA-Implementationshttps:\/\/github.com\/open62541\/open62541\/wiki\/List-of-Open-Source-OPC-UA-Implementations\">\uc624\ud508\uc18c\uc2a4 \ud504\ub85c\uadf8\ub7a8<\/a>\uc744 \ucc3e\uc558\ub2e4. \uc18c\uac1c\ud55c \ud648\ud398\uc774\uc9c0\uc640 \ub9c8\ucc2c\uac00\uc9c0\ub85c \uac00\ubccd\uac8c C\ub85c \uc791\uc131\ud55c <a href=\"https:\/\/open62541.org\/\">open62541<\/a>\ub97c \uc124\uce58\ud558\uae30\ub85c \ud588\ub2e4.<\/p>\n\n\n\n<p>3\ub2ec \uc804\ub9cc\ud574\ub3c4 PLC\uac00 \ub2f9\uc5f0\ud788 OPC\ub97c \uc9c0\uc6d0\ud560 \uc904 \uc54c\uc558\uc73c\ub098, \uc9c0\uba58\uc2a4 S7-1500 \ucd5c\uc2e0 \uc81c\ud488, MELSEC \uc815\ub3c4\ub098 OPCUA\ub97c \uc9c0\uc6d0\ud55c\ub2e4. \ub098\ub984 \ucd5c\uc2e0 \uae30\uc220\uc778\uac00\ubcf4\ub2e4. OPC \uc194\ub8e8\uc158\uc744 \uac00\uc9c4 \ud68c\uc0ac\uc5d0 \uc5f0\ub77d\ud558\uba74 \uc27d\uac8c \uc9c0\uc6d0\ubc1b\uc744 \uc218 \uc788\ub294\ub370 \uac00\uaca9\ub300\uac00 \ub192\ub2e4. 7\ub9cc\uc6d0 \uc9dc\ub9ac \ub77c\uc988\ubca0\ub9ac \ud558\ub4dc\uc6e8\uc5b4\uc5d0 \uba87 \ucc9c\ub9cc\uc6d0 \uc18c\ud504\ud2b8\uc6e8\uc5b4\ub97c \uc62c\ub9ac\uba74 \ubbf8\uce5c \uc9d3\uc774\ub2e4. \uc4f8 \uc0ac\ub78c\ub3c4 \uc5c6\uace0. \uc774\ub7f0 \uae30\ub2a5\uc744 PLC \uba54\uc774\ucee4\uac00 \uc880 \uc27d\uac8c \ud574\uc918\uc57c \ud558\ub294\ub370, \uc544\uc27d\ub2e4.<\/p>\n\n\n\n<p>\uc124\uce58\ub294 \uc815\ub9d0 \uadf8\ub300\ub85c \ub530\ub77c\ud558\uba74 \ub41c\ub2e4. \ucef4\ud30c\uc77c \ud6c4 open62541.c\uc640 open62541.h \ud30c\uc77c\uc744 \ud604\uc7ac \ud3f4\ub354\uc5d0 \ub123\uace0 #include &#8220;open62541.c&#8221;\ub85c \ud558\ub358\uac00, <a href=\"https:\/\/stackoverflow.com\/questions\/4980819\/what-are-the-gcc-default-include-directories\">gcc \ud45c\uc900 \ub77c\uc774\ube0c\ub7ec\ub9ac \uacbd\ub85c<\/a>\ub97c \ucc3e\uc544 \ub514\ub809\ud1a0\ub9ac \uad6c\uc870\uc9f8 \ub123\uc5b4\uc8fc\uace0 &lt;&gt;\uc73c\ub85c \uac10\uc2f8\ub3c4 \ub41c\ub2e4. <a href=\"https:\/\/open62541.org\/doc\/current\/tutorial_server_firststeps.html\">tutorial<\/a>\uc740 \ubb54\uac00 \uc798\ubabb\ub418\uc5c8\ub294\uc9c0 \uc798 \uc2e4\ud589\ub418\uc9c0 \uc54a\ub294\ub2e4. \ucc38\uc870\ud55c \uc0ac\uc774\ud2b8 \uc791\uc131\uc790\uac00 \ud588\ub4ef\uc774 \uc8fc\uc11d\ucc98\ub9ac\ud558\uba74 \ub41c\ub2e4. \uc2e4\ud589\ud558\uba74 \uc11c\ubc84\uac00 \uc5f4\ub9ac\uace0 \uc811\uc18d\ud560 \uc218 \uc788\ub2e4. <s>\uc6f9 \ube0c\ub77c\uc6b0\uc800\uac00 \uc544\ub2cc<\/s> OPC \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \ud544\uc694\ud558\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pi@raspberrypi:~\/OPCUA\/sample $ .\/myServer \n[2020-09-04 07:01:39.438 (UTC+0900)] warn\/server\tAccessControl: Unconfigured AccessControl. Users have all permissions.\n[2020-09-04 07:01:39.438 (UTC+0900)] info\/server\tAccessControl: Anonymous login is enabled\n[2020-09-04 07:01:39.438 (UTC+0900)] warn\/server\tUsername\/Password configured, but no encrypting SecurityPolicy. This can leak credentials on the network.\n[2020-09-04 07:01:39.438 (UTC+0900)] warn\/userland\tAcceptAll Certificate Verification. Any remote certificate will be accepted.\n[2020-09-04 07:01:39.439 (UTC+0900)] info\/network\tTCP network layer listening on opc.tcp:\/\/raspberrypi:4840\/<\/pre>\n\n\n\n<p>PLC\uac00 opcua\ub97c \uc9c0\uc6d0\ud558\uba74 \uc11c\ubc84, \ud074\ub77c\uc774\uc5b8\ud2b8 \uc591\ucabd \ub2e4 \uc9c0\uc6d0\ud560 \ub4ef \ud558\ub2e4. <a href=\"https:\/\/youtu.be\/mEbPHflLNyc?list=PLWw98q-Xe7iGf-c4b6zF0bnJA9avEN_mF\">\uc5ec\uae30<\/a>\ub97c \ubcf4\uace0 \ub2e4\uc74c\ub2e8\uacc4\ub85c \uac00\ubcf4\uc790.<\/p>\n\n\n\n<p>\ub3d9\uc601\uc0c1 \ub2e4 \ubcf4\uace0, \ucf54\ub4dc \uba87 \uac1c \uc2e4\ud589\ud558\uba74 \uc790\uac00\uaca9\ub9ac \ub05d\ub098 \uc788\uaca0\ub2e4. \uc544 \ud5c8\ub9ac\uc57c.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\uc774\uc5b4\uc11c&#8230;<\/h2>\n\n\n\n<p>\uc704 \ubc29\ubc95\ub300\ub85c sample \ucf54\ub4dc\ub97c  \ucef4\ud30c\uc77c\ud558\uba74 \uc5d0\ub7ec\uac00 \ubb34\uc9c0\ud558\uac8c \ub72c\ub2e4. \uc544\ub9c8\ub3c4 \uc911\ubcf5\uc73c\ub85c \uc120\uc5b8\ub418\uc5b4 \ubb38\uc81c\uc778 \ub4ef \ud558\ub2e4. <a href=\"https:\/\/github.com\/open62541\/open62541\/releases\">\uc5ec\uae30<\/a>\uc5d0 \uc788\ub294 raspberry\uc6a9 \ud30c\uc77c\uc744 \ubc1b\uc544 \uc555\ucd95\uc744 \ud47c \ub4a4, include\uc5d0 \ud574\ub2f9\ud558\ub294 c, h \ud30c\uc77c\uc744 gcc \uacbd\ub85c\uc5d0 \ub123\uc5b4\uc8fc\uba74 \ub41c\ub2e4. \ud639\uc2dc\ub098 \ud574\uc11c build\ud55c \ubc84\uc804\uc758 c, h \ud30c\uc77c\uc744 \ubaa8\ub450 \ucc3e\uc544 \ub418\ub294\uc9c0 \ud574\ubcf4\uc558\uc9c0\ub9cc \uc2e4\ud328\ud588\ub2e4. \ub2e4\uc74c 3\uac1c \uacbd\ub85c\uc5d0\uc11c \ucc3e\uc744 \uc218 \uc788\ub294\ub370, raspberry\uc6a9 \ud30c\uc77c\uacfc linux \ud30c\uc77c\uc774 \uc870\uae08 \ub2e4\ub974\ub2e4. raspberry\ub294 \ud5e4\ub354\ub97c \ud3ec\ud568\ud558\ub294 \ubd80\ubd84\uc774 \uc880 \uac04\ub7b5\ud558\uac8c \ub418\uc5b4 \uc788\ub2e4. server.h\ub97c \uc608\ub97c \ub4e4\uba74.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pi@raspberrypi:~\/OPCUA\/open62541 $ find .\/ -type d -iname open62541\n.\/include\/open62541\n.\/plugins\/include\/open62541\n.\/build\/src_generated\/open62541\n.\/build\/CMakeFiles\/open62541-object.dir\/src_generated\/open62541\n.\/build\/CMakeFiles\/Export\/lib\/cmake\/open62541<\/pre>\n\n\n\n<p>\uacb0\uad6d <a href=\"https:\/\/github.com\/open62541\/open62541\/releases\/download\/v1.1.2\/open62541-raspberrypi.tar.gz\">\ub77c\uc988\ubca0\ub9ac\uc6a9 \ud30c\uc77c<\/a>\uc744 \ud574\ub2f9 \uacbd\ub85c\uc5d0 \ub123\uc5b4\uc900\ub2e4. <s>library\ub294 build \uc544\ub798 bin\uc5d0 \ub514\ub809\ud1a0\ub9ac\uc5d0 libopen62541.so\uc744 \ub9cc\ub4e0\ub2e4. \ub77c\uc988\ubca0\ub9ac\uc6a9 \ub77c\uc774\ube0c\ub7ec\ub9ac\ubcf4\ub2e4 \uc880 \uc791\ub2e4. <\/s>\uc774 linux\uc6a9 build \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc0ac\uc6a9\ud558\uba74 \uc624\ub958\ub09c\ub2e4. \ub77c\uc988\ubca0\ub9ac\uc6a9 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc0ac\uc6a9\ud574\uc57c \ud55c\ub2e4. raspberry\uc5d0\uc11c \ucef4\ud30c\uc77c \ud560 \uc218\ub3c4 \uc788\uc5b4 \ubcf4\uc774\uc9c0\ub9cc, readme\uc5d0 \ud45c\uc2dc\ub418\uc9c0 \uc54a\uc558\ub2e4. \uacb0\uad6d \ub418\ub2c8 \ud328\uc2a4\ud558\uaca0\ub2e4.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><s>\uc815\ub9ac\ud558\uba74.<\/s><\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li><s>open62541 \ucef4\ud30c\uc77c\ud558\uc5ec open62541.c, open62541.h\ub97c \uc5bb\uc74c.<\/s><\/li><li><s>\ub77c\uc988\ubca0\ub9ac\uc6a9 \ud30c\uc77c\uc744 \uad6c\ud558\uc5ec \uc555\ucd95 \ud574\uc81c.(build \ud6c4 header\ub97c \uc911\ubcf5\uc73c\ub85c \uc120\uc5b8\ud55c \ubd80\ubd84\uc744 \uc218\uc815\ud55c \ub4ef \ud568. \uc870\uae08\uc529 \ub2e4\ub984)<\/s><\/li><li><s>include\uc5d0 \ud3ec\ud568\ub41c c, h\ub97c \ud574\ub2f9 \uacbd\ub85c\ub85c \uc774\ub3d9.<\/s><\/li><li><s>lib\uc5d0 \ud3ec\ud568\ub41c .so\ub97c \uac01 \ud658\uacbd\uc5d0 \ub9de\ub294 \uacbd\ub85c\ub85c \uc774\ub3d9.<\/s><\/li><li><s>gcc -std=c99 -lopen62541 sample.c -o target<\/s><\/li><li><s>\uc774\ub7f0 \ud615\uc2dd\uc73c\ub85c \ucef4\ud30c\uc77c.<\/s><\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"has-inline-color has-luminous-vivid-orange-color\">\ub77c\uba74 \ub05d\uc778 \uc904 \uc54c\uc558\uc73c\ub098, \uc544\ub798 \ub450 \ubc29\ubc95 \uc911 \ud558\ub098\ub97c \uc120\ud0dd\ud558\uba74 \ub41c\ub2e4.<\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\ucef4\ud30c\uc77c \ud55c open62541.c, open62541.h \uc0ac\uc6a9.<ol><li>ccmake \uc911 UA_ENABLE_AMALGAMATION=on \uc744 \uc120\ud0dd\ud558\uc5ec open62541.c open62541.h\ub97c \ub9cc\ub4e4\uba74 \ub05d\ub098\ub3c4\ub85d \ud55c\ub2e4.<\/li><li>\ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \ub9cc\ub4e4\uba74 \ud574\ub2f9 \ub514\ub809\ud1a0\ub9ac\uc5d0 \ubcf5\uc0ac.<\/li><\/ol><\/li><\/ul>\n\n\n\n<p>In CMake, select freertosLWIP using the variable UA_ARCHITECTURE, enable amalgamation using the UA_ENABLE_AMALGAMATION variable and just select the native compilers. Then try to compile as always. The compilation will fail, but the open62541.h and open62541.c will be generated.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\ub77c\uc988\ubca0\ub9ac\uc6a9 \ud5e4\ub354, \ub77c\uc774\ube0c\ub7ec\ub9ac \uc0ac\uc6a9.<ol><li>\ucef4\ud30c\uc77c \ud544\uc694 \uc5c6\uc74c.<\/li><li>\uc801\ub2f9\ud788 include, lib \ud30c\uc77c\uc744 \ucc3e\uc544 \ubcf5\uc0ac\ud574 \uc90c.<\/li><li>tutorial \ucf54\ub4dc\ub97c \uadf8\ub300\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc74c.<\/li><\/ol><\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#include &lt;open62541\/plugin\/log_stdout.h>\n#include &lt;open62541\/server.h>\n#include &lt;open62541\/server_config_default.h>\n\/\/#include &lt;open62541\/open62541.h>\n\n#include &lt;signal.h>\n#include &lt;stdlib.h>\n\nstatic volatile UA_Boolean running = true;\nstatic void stopHandler(int sig) {\n    UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, \"received ctrl-c\");\n    running = false;\n}\n\nint main(void) {\n    signal(SIGINT, stopHandler);\n    signal(SIGTERM, stopHandler);\n\n    UA_Server *server = UA_Server_new();\n    UA_ServerConfig_setDefault(UA_Server_getConfig(server));\n\n    UA_StatusCode retval = UA_Server_run(server, &amp;running);\n\n    UA_Server_delete(server);\n    return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;\n}<\/pre>\n\n\n\n<p>\uc704 \ucf54\ub4dc\uc5d0\uc11c open62541\/open62541.h\ub97c \uc8fc\uc11d \ucc98\ub9ac\ud588\ub2e4. open62541.h \ud30c\uc77c\uc744 \ud604\uc7ac \ub514\ub809\ud1a0\ub9ac\ub85c \uc62e\uae34 \ud6c4 #include &#8220;open62541.h&#8221;\uc73c\ub85c \uc4f0\uace0, \uc704 \uc55e 3\uc904\uc744 \uc8fc\uc11d\ucc98\ub9ac\ud574\ub3c4 \ucef4\ud30c\uc77c \ub41c\ub2e4. \ub05d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud558. \ub4dc\ub514\uc5b4 \uc5ec\uae30\uae4c\uc9c0 \uc654\ub2e4. opc ua\ub97c \uc124\uce58\ud558\uba74 \uc790\ub3d9\ud654 \uae30\uae30\uc5d0\uc11c \uc815\ubcf4\ub97c \uc27d\uac8c \uc77d\uc744 \uc218 \uc788\ub2e4. \uc5ec\uae30\uc5d0\uc11c \uc5ec\ub7ec \uc624\ud508\uc18c\uc2a4 \ud504\ub85c\uadf8\ub7a8\uc744 \ucc3e\uc558\ub2e4. \uc18c\uac1c\ud55c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12],"tags":[807,808,745,798],"class_list":["post-4006","post","type-post","status-publish","format-standard","hentry","category-12","tag-opcua","tag-open62541","tag-plc","tag-raspberry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/posts\/4006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/comments?post=4006"}],"version-history":[{"count":7,"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/posts\/4006\/revisions"}],"predecessor-version":[{"id":4029,"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/posts\/4006\/revisions\/4029"}],"wp:attachment":[{"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/media?parent=4006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/categories?post=4006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/now0930.pe.kr\/wordpress\/wp-json\/wp\/v2\/tags?post=4006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}