node-opcua: The Handbook
- Mastering OPC UA with TypeScript and Node.js
Preface
- Who is this book for?
- How to read this book
- Conventions
- Acknowledgments
- Part I: The OPC UA Specification
History, Goals, and Architecture
- The story: why a whole new protocol?
- What is OPC UA?
- Why OPC UA?
- Client/server and Pub/Sub
- Logical architecture
- Transport
- Stacks and certification
The Information Model
- Node classes
- NodeId
- BrowseName, DisplayName, attributes
- References and hierarchy
- DataValue, Variant, StatusCode
- Data Access (DA)
- Events, Alarms & Conditions
- Methods
- Historizing
- NodeSets and Companion Specs
Services and Transport
- Discovery Service Set
- Secure Channel Service Set
- Session Service Set
- View Service Set
- Attribute Service Set
- Method Service Set
- MonitoredItem and Subscription Service Set
- Not supported, or commercial only
- Encoding and chunking
Security in OPC UA
- Three layers
- Message security mode
- Security policies (selection)
- Certificates and trust lists
- User identities
- Authorization and roles (Part 18)
- A practical checklist
- Part II: The node-opcua SDK
SDK Overview
- Why an SDK instead of implementing the spec directly?
- What is node-opcua?
- Installation
- Node.js version
- A typical import
- Monorepo architecture
- Strengths
- Limits (open source)
Client Features
- OPCUAClient
- Session capabilities
- Subscriptions and monitored items
- User identity
- Discovery from the client
- Other client packages
Server and Address Space
- OPCUAServer
- ServerEngine and Address Space
- Modeling API
- Loading NodeSets
- Diagnostics
- Lifecycle
Subscriptions, Events, and Data Access
- DataChange subscriptions
- Event subscriptions
- Data Access in the SDK
- Extension objects and complex types
Security, Certificates, and Configuration
- OPCUACertificateManager
- Security on client and server
- Server configuration / push certificates
- UserManager
History, Alarms, and Methods
- Methods
- Historizing
- Alarms & Conditions
- File Transfer
Discovery, File Transfer, and Role-Based Security
- Discovery and the LDS
- Role-based security (OPC 10000-18)
- Pseudo session
Packages, Samples, and Extensions
- Important packages (short list)
- Samples in the repository
- Commercial / membership modules
- Feature matrix
- Part III: A Learning Path with Node.js 24
Setup for Node.js 24
- Goal of this part
- Setting up a project
- Downloading the examples
- Learning order
Example: A Mini Server
- Learning goal
- Run it
- What happens?
- The full code
Example: Client - Browse and Read
- Learning goal
- Run it
- What happens
- The full code
- Common pitfalls
Example: Subscription
- Learning goal
- Run it
- Concept
- The full code
- Parameters to experiment with
Example: Methods
- Learning goal
- Run it
- Server side
- Client side
Example: Data Access
- Learning goal
- Run it
- SDK helpers
- The full code
Example: Alarms
- Learning goal
- Run it
- The full code
- Going further
Example: History
- Learning goal
- Run it
- Client
Example: Secure Access (UserName)
- Learning goal
- Run it
- Server
- Client
- Next steps toward production
- Part IV: OPC UA NodeSets and Companion Specs
NodeSets and Companion Specs - Introduction
- What is this part for?
- What is a NodeSet?
- What is a Companion Spec?
- Why teaching vs. licensing - a clarification
- The catalog in node-opcua
- Reading order
- Citation style in the sub-chapters
The OPC UA Standard NodeSet (UA)
- The story
- What is it used for?
- Core concepts
- node-opcua
- Sources
Device Integration (DI) - OPC 10000-100
- The story
- What is it used for?
- Core concepts (selection)
- Dependencies
- Using node-opcua
- A teaching point: a typical mistake
- Sources
Analyzer Device Integration (ADI)
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: a domain spec is not a replacement for DI
- Sources
AutoID - OPC 30010
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: scan events, not polling
- Sources
Machine Vision - OPC 40100
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: keep recipe and result thinking separate
- Sources
Commercial Kitchen Equipment - OPC 30200
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: reuse energy and health fields from DI
- Sources
Asset Management Basics (AMB) - OPC 10000-110
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: AMB is rarely loaded on its own
- Sources
The GDS Information Model - Part 12 / GDS NodeSet
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: NodeSet != operations
- Sources
Industrial Automation (IA) - OPC 10000-200
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: IA is invisible glue
- Sources
Machinery - OPC 40001-1
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua in practice
- A teaching point: AddIns
- Sources
Machinery Jobs - OPC 40001-3
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: a formal dependency vs. a sensible overall architecture
- Sources
Machinery Result - OPC 40001-101
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: recognize and reuse the generic pattern
- Sources
Machinery Process Values - OPC 40001-2
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: semantics is not a nice-to-have
- Sources
Machine Tool - OPC 40501
- The story
- What is it used for?
- Core concepts
- Dependencies (catalog)
- node-opcua
- Sources
CNC - OPC 40502
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: deliberately connect the CNC and Machine Tool views
- Sources
Robotics - OPC 40010
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- Sources
Woodworking - OPC 40550
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: a domain model inherits from Machinery, not the other way around
- Sources
Flat Glass - OPC 40301
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: line integration, not just a single machine
- Sources
PackML - OPC 30050
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: the state names are already agreed on - use them
- Sources
IO-Link and IO-Link IODD - OPC 30120
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: keep process data and service data cleanly separated
- Sources
PADIM and IRDI - Semantics for Process Values
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: IRDI is infrastructure, not an end in itself
- Sources
ISA-95 Job Control - OPC 10031-4
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: base vocabulary, not a ready-made MES integration
- Sources
IJT Base and Tightening - OPC 40450 / 40451
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: the longest dependency chain in the catalog is worth tracing
- Sources
LADS - OPC 30500
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: recognize manufacturing patterns in the lab
- Sources
Metal Forming - OPC 40503
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: the dependency graph is the real lesson here
- Sources
Scales / Weighing - OPC 40200
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: handle legally-regulated weight values separately
- Sources
I4AAS - OPC UA and the Asset Administration Shell
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: two communities, one model
- Sources
Weihenstephan - OPC 40600
- The story
- What is it used for?
- Core concepts
- Dependencies
- node-opcua
- A teaching point: migration, not a rebuild
- Sources
Using NodeSets in node-opcua in Practice
- Learning goal
- The nodesets map
- A loading recipe (checklist)
- Pattern A - find a type and subtype it
- Pattern B - an instance in DeviceSet / Machines
- Pattern C - TypeScript bindings
- Pattern D - a client against a Companion Spec server
- Dependency graph (simplified)
- Example script in this book
- Conformance and reality
- Sources
Appendix A: Leanpub and Markua Notes
- Folder structure of this manuscript
- Markua conventions used in this book
- Publishing
- Release texts for the Leanpub book page
Appendix B: Glossary
Appendix C: Resources
- node-opcua
- OPC Foundation
- Leanpub / Markua
- A companion book
Appendix D: Bibliography of Companion Specs
- node-opcua primary sources
- Legal note (on teaching)