Skip to content

A fake OPC UA server for testing and development purposes.

License

Notifications You must be signed in to change notification settings

7bridges-eu/nbb-opcua-server

Repository files navigation

Description:

This project is designed to help developers and engineers simulate an OPC UA server environment for testing, debugging, and prototyping without the need for real hardware or complex setups. Whether you’re working on OPC UA client applications, exploring OPC UA integration, or simply need a playground for experimentation.

It’s a simple implementation written in Clojure, running on NodeJS, using the node-opcua library.

Getting Started:

  • Clone this repository to your development environment.
  • Install the dependencies with npm install.
  • Configure the server according to your testing needs. See the configure section.
  • Start the server with npx nbb -m server
  • Connect your OPC UA client applications for testing. (opc.tcp://127.0.0.1:4840)
  • Experiment, debug, and iterate
  • Stop the server with Ctrl-C

Configure

The server reads the sensor configuration from a sensors.edn file.

The file has the following structure:

{:machine [{:ns 1 :browse-name "sensor" :value {:type :Double :output [:random-range [0 100]]}}]}

It’s a map where every key is a machine / device and a vector of sensors.

Sensor structure is:

  • :ns: Namespace index (not used at the moment)
  • :brose-name: Browse name of the sensor
  • :value: Here we define the variant :type and the :output strategy:
    • :type can be any standard OPCUA types (:Integer, :Double, :Float, :String :Boolean…)
    • :output is a vector that contains the strategy and the value. Implemented strategies are:
      • :random-range: picks a random number between min and max; the value must be expressed in [min max] form
      • :random-pick: picks a random element from the value; the value must be expressed in [element1 element2 …] form
      • :static: always returns the provided value

Limitations

  • Actually the sensor outcome is a random value between min and max, maybe in the future I’ll implement the outcome as a sine wave between the two.
  • Only ~Variant<Double>~ type is supported at the moment. (See #1)

Contributions:

Contributions and feedback are welcome! Feel free to fork this repository, make enhancements, or report issues to help improve the fake OPC UA server for the community.

Disclaimer:

This project is purely for testing and development purposes and should not be used in production environments. Always use certified OPC UA servers for critical industrial applications.

Happy testing! 🚀

About

A fake OPC UA server for testing and development purposes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published