2 Star 2 Fork 2

骑驴看世界 / plc4x

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

Maven central License Jenkins Build Status Last commit Twitter Java Platform compatibility Go Platform compatibility C Platform compatibility Python Platform Compatibility


Apache PLC4X Logo

The Industrial IoT adapter

The ultimate goal of PLC4X is to create a set of libraries, that allow unified access to any type of PLC


Table of contents


About Apache PLC4X

Apache PLC4X is an effort to create a set of libraries for communicating with industrial grade programmable logic controllers (PLCs) in a uniform way. We are planning on shipping libraries for usage in:

  1. Java
  2. Go
  3. C (not ready for usage)
  4. Python (not ready for usage)
  5. C# (.Net) (not ready for usage - abandoned)

PLC4X also integrates with other Apache projects, such as:

And brings stand-alone (Java) utils like:

  • OPC-UA Server: Enables you to communicate with legacy devices using PLC4X with OPC-UA.
  • PLC4X Server: Enables you to communicate with a central PLC4X Server which then communicates with devices via PLC4X.

It also provides (Java) tools for usage inside an application:

  • Connection Cache: New implementation of our framework for re-using and sharing PLC-connections
  • Connection Pool: Old implementation of our framework for re-using and sharing PLC-connections
  • OPM: Object-Plc-Mapping: Allows binding PLC fields to properties in java POJOs similar to JPA
  • Scraper: Utility to do scheduled and repeated data collection.

Getting started

Depending on the programming language, the usage will differ, therefore please go to the Getting Started on the PLC4X website to look up the language of choice.

Java

NOTE: Currently the Java version which supports building of all parts of Apache PLC4X is at least Java 11 (Currently with Java 19 the Apache Kafka integration module is excluded from the build as the plugins it requires are incompatible with this version)

See the PLC4J user guide on the website to start using PLC4X in your Java application: https://plc4x.apache.org/users/getting-started/plc4j.html

Developers

Environment

Currently, the project is configured to require the following software:

  1. Java 11 JDK: For running Maven in general as well as compiling the Java and Scala modules JAVA_HOME configured to point to that.
  2. Git (even when working on the source distribution)
  3. (Optional, for running all tests) libpcap/Npcap for raw socket tests in Java or use of passive-mode drivers
  4. (Optional, for building the website) Graphviz : For generating the graphs in the documentation

WARNING: The code generation uses a utility which requires some additional VM settings. When running a build from the root, the settings in the .mvn/jvm.config are automatically applied. When building only a sub-module, it is important to set the vm args: --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED. In Intellij for example set these in the IDE settings under: Preferences | Build, Execution, Deployment | Build Tools | Maven | Runner: JVM Options.

A more detailed description is available on our website:

https://plc4x.apache.org/developers/preparing/index.html

For building PLC4C we also need:

All requirements are retrieved by the build itself

For building PLC4Go we also need:

All requirements are retrieved by the build itself

For building PLC4Py we also need:

  1. Python 3.7 or higher
  2. Python pyenv

For building PLC4Net we also need:

  1. DotNet SDK 6.0

With this setup you will be able to build the Java part of PLC4X.

The when doing a full build, we automatically run a prerequisite check and fail the build with an explanation, if not all requirements are meet.

Building with Docker

If you don't want to bother setting up the environment on your normal system, and you have Docker installed, you can also build everything in a Docker container:

   docker compose up

This will build a local Docker container able to build all parts of PLC4X and will run a maven build of the local directory inside this container.

The default build will run a local release-build, so it can also be used to ensure reproducible builds when releasing.

Per default will it store files locally:

  • Downloaded maven artifacts will go to out/.repository
  • Deployed artifacts will go to out/.local-snapshots-dir

The reason for this is, that otherwise the artifacts would be packaged in with the source-release artifact, resulting in a 12GB or more zip archive. However, saving it in the main target directory would make the build delete the local repo every time a mvn clean is run. The out directory however is excluded per default from the assembly descriptor, and therefore it is not included in the source zim.

Getting Started

You must have at least Java 11 installed on your system and connectivity to Maven Central (for downloading external third party dependencies). Maven 3.6 is required to build, so be sure it's installed and available on your system.

NOTE: When using Java 19 currently the Apache Kafka integration module is excluded from the build as one of the plugins it requires has proven to be incompatible with this version.

NOTE: There is a convenience Maven-Wrapper installed in the repo, when used, this automatically downloads and installs Maven. If you want to use this, please use ./mvnw or mvnw instead of the normal mvn command.

NOTE: When running from sources-zip, the mvnw might not be executable on Mac or Linux. This can easily be fixed by running the following command in the directory.

$ chmod +x mvnw

NOTE: If you are working on a Windows system, please use mvnw.cmd instead of ./mvnw in the following build commands.

Build PLC4X Java jars and install them in your local maven repository

./mvnw install

You can now construct Java applications that use PLC4X. The PLC4X examples are a good place to start and are available inside the plc4j/examples directory.

The Go drivers can be built by enabling the with-go profile:

./mvnw -P with-go install 

The C# / .Net implementation is currently in a work in progress state. In order to be able to build the C# / .Net module, you currently need to activate the: with-dotnet profiles.

./mvnw -P with-dotnet install

The Python implementation is currently in a somewhat unclean state and still needs refactoring. In order to be able to build the Python module, you currently need to activate the: with-sandbox and with-python profiles.

./mvnw -P with-sandbox,with-python install

In order to build everything the following command should work:

./mvnw -P with-c,with-go,with-python,with-sandbox install

Community

Join the PLC4X community by using one of the following channels. We'll be glad to help!

Mailing Lists

Subscribe to the following mailing lists:

See also: https://plc4x.apache.org/mailing-lists.html

Twitter

Get the latest PLC4X news on Twitter: https://twitter.com/ApachePlc4x

Contributing

There are multiple forms in which you can become involved with the PLC4X project.

These are, but are not limited to:

  • Providing information and insights
  • Testing PLC4X and providing feedback
  • Submitting Pull Requests
  • Filing Bug-Reports
  • Active communication on our mailing lists
  • Promoting the project (articles, blog posts, talks at conferences)
  • Documentation

We are a very friendly bunch so don’t be afraid to step forward. If you'd like to contribute to PLC4X, have a look at our contribution guide!

Licensing

Apache PLC4X is released under the Apache License Version 2.0.

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =============================================================== The files: plc4j/transports/test/src/main/java/io/netty/channel/embedded/Plc4xEmbeddedChannel.java plc4j/transports/test/src/main/java/io/netty/channel/embedded/Plc4xEmbeddedEventLoop.java plc4j/utils/pcap-shared/src/main/java/org/apache/plc4x/java/utils/pcap/netty/exception/PcapException.java Are copyrighted by the The Netty Project which is distributed under the Apache 2.0 license. The file: .mvn/wrapper/MavenWrapperDownloader.java Is provided from the Github Project: https://github.com/takari/maven-wrapper which is distributed under the Apache 2.0 license. The files: mvnw mvnw.cmd Are provided from the Apache Maven project: https://maven.apache.org The file: code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/Expression.g4 is licensed under the Category A: "UNLICENSE" which is available here: UNLICENSE file in the licenses directory.

简介

Apache PLC4X 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/mengxw8/plc4x.git
git@gitee.com:mengxw8/plc4x.git
mengxw8
plc4x
plc4x
develop

搜索帮助