CSCP — CloudScale Communication Protocol
CSCP command reference for Neutron: message structure, weighing, configuration, counting, checkweighing and digital I/O.
PRECIZ · NEUTRON OPC UA
OPC UA integration for Neutron: secure connections, live weighing data, stable capture and PLC/SCADA integration.
Manual revision: 1.0 · Date: 17 October 2026
Applies to: Neutron firmware 2.5.0 with OPC UA support · Vendor information model 1.2.0
Neutron by PRECIZ provides an OPC UA server for integration with PLCs, SCADA, MES and PC applications. The interface uses OPC UA Client/Server communication over UA-TCP with UA Binary encoding.
The server provides:
Live gross, net, tare and high-resolution gross weight, raw ADC, stability, scale status, error code and unit.
Measurement metadata: division, decimal places, capacity, engineering units and engineering range.
Device identification and standard OPC UA server information.
Data-change subscriptions for live values.
A coherent measurement read containing eleven fields from one snapshot.
Asynchronous capture and retrieval of a fresh stable measurement.
Tare, preset tare, zero and clear tare operations.
Filter setting FT and ADC chopping setting FC.
Two simultaneous client sessions.
Optional encrypted communication, application certificate trust and user permissions for reading or reading and executing commands.
All exposed process variables are read-only. Operations are performed through methods. The interface does not provide arbitrary native command execution, calibration, output control, application selection, counting results, history, events or OPC UA PubSub. The information model is a PRECIZ vendor model, not the OPC UA Weighing or Device Integration companion model.
Three ways of obtaining a measurement serve different purposes:
Interface | Use |
|---|---|
Live variables and subscriptions | Display or continuously monitor individual values |
| Obtain all eleven measurement fields from one current snapshot |
| Freeze a fresh valid stable measurement and retrieve it by request ID |
Connect to Neutron's local configuration page or the Bluetooth configuration utility. Use HTTPS or authenticated Bluetooth for certificate/user management.
Select the network connection interface and obtain its assigned IP address.
Keep scale acquisition enabled in the Scale settings.
Open the OPC UA tab. The firmware must report that OPC UA is available.
For encrypted access, first create a user in Users & permissions.
In Settings, enable the server, select the security mode, and retain port 4840 and minimum interval 100 ms for the initial connection.
Click Save. Copy the connection address with Copy endpoint.
Example endpoint:
opc.tcp://192.168.50.73:4840Add the endpoint as a server in UAExpert.
In encrypted mode select Basic256Sha256 / SignAndEncrypt and Username/Password authentication. In unprotected mode select None and Anonymous.
For encrypted access, compare and trust Neutron's certificate. If the client certificate is not yet trusted by Neutron, follow section 4.2 and reconnect.
Connect and browse Objects → CS-NEUTRON Scale. The object's NodeId is
Scale; its displayed name is CS-NEUTRON Scale.
Drag Gross, Net, Tare, Stable, Status, ErrorCode and Unit into Data Access View.
Use the Data Access View context menu to set the subscription publishing interval and the monitored-item sampling interval, initially 100 ms.
Use a value only when its OPC UA StatusCode is Good. ErrorCode=1 means the
native scale has no error. Status=1 or Status=3 describes a stable indication.
The endpoint has the form opc.tcp://<assigned-device-IP>:<port>. Use the address
of the selected Wi-Fi, Ethernet or LTE interface. The OPC UA tab displays the
address and provides a copy button. A stable IP address simplifies integration.
The device does not need the PLC's IP address configured. Permit inbound TCP traffic to the selected port. The client must have a network route to Neutron; an LTE address behind carrier NAT is not automatically reachable from outside that network. Use the appropriate routed network, private APN or VPN.
Setting | Key | Default | Values / effect |
|---|---|---|---|
OPC UA available | OUB | Firmware dependent | Read-only: 0 absent, 1 available |
Security support | OUS | Firmware dependent | Read-only: 0 absent, 1 available |
OPC UA server | OUE | Disabled | 0 disabled, 1 enabled |
TCP port | OUP | 4840 | 1024–65535; select an unused service port |
Minimum update interval | OUI | 100 ms | 10–5000 ms; minimum sampling and publishing interval accepted by the server |
Connection security | OUM | Unprotected | 0 None/anonymous; 1 Basic256Sha256/SignAndEncrypt with username/password |
Anonymous command access | OUC | Disabled | In unprotected mode only: 0 read-only; 1 all supported commands allowed |
Saving OPC UA settings restarts the OPC UA service and disconnects its clients. User and trust changes also restart the service. Reconnect after these changes. Existing device IP, scale and clock settings are reused.
The minimum interval is a lower bound, not a fixed transmission period or a guarantee of end-to-end latency. Clients request their own intervals and must use the revised values returned by the server.
Mode | Policy / message security | Authentication | Command permission |
|---|---|---|---|
Unprotected | None / None | Anonymous | Controlled by Anonymous command access |
Encrypted | Basic256Sha256 / SignAndEncrypt | Username and password; trusted client application certificate | Controlled by the user's permission |
In encrypted mode, anonymous sessions and certificate-based user login are not supported. The client application certificate identifies the client software; it does not replace username/password authentication. The web configuration PIN and HTTPS certificate are separate from OPC UA credentials and certificates.
Use unprotected mode on a trusted isolated network. It does not encrypt data or authenticate individual users.
Open Neutron's OPC UA settings through HTTPS or authenticated Bluetooth.
Add a user. Usernames contain 1–64 ASCII letters, digits, underscores or hyphens and are case-sensitive. Passwords contain 12–128 characters. Up to eight users are supported; there is no default OPC UA account.
Select Read only or Read and execute commands.
Enable encrypted OPC UA and save. The device clock must be synchronized and at least one user must exist. Secure startup waits for clock synchronization.
At the first secure startup Neutron generates its private key and a self-signed RSA-2048 application certificate, valid for five years.
In the client, compare Neutron's SHA-256 certificate fingerprint with the fingerprint displayed in the configuration interface, then trust it.
Attempt the encrypted connection. Neutron rejects an unknown client application certificate and lists it under Certificates as rejected.
Click Refresh certificates and users, compare the client's fingerprint, and click Approve for that certificate.
Reconnect with the username and password.
The client must trust Neutron before it may proceed far enough to send its own certificate. Approval does not override expiry, signature, key-usage or application-URI validation.
Operation | Read only | Read and execute commands |
|---|---|---|
Read variables / subscribe | Yes | Yes |
ReadMeasurement | Yes | Yes |
GetCapturedMeasurement | Yes | Yes |
CaptureStableWeight | No | Yes |
TareCurrent, SetTare, Zero, ClearTare | No | Yes |
SetFilter, SetHRFilter | No | Yes |
Write variables / administer users or certificates through OPC UA | No | No |
Stored roles Reader and Operator correspond to these two permissions. There are no per-command permission levels. In encrypted mode the user permission applies; OUC is ignored. In unprotected mode OUC authorizes all supported commands or none.
Five failed logins impose a 30-second server-wide login block. This can temporarily affect other users as well. User passwords are stored as salted PBKDF2-HMAC-SHA256 hashes; the administration interface does not export passwords or private keys.
Neutron's application URI is:
urn:preciz:cs-neutron:<MID>The generated certificate includes this URI, the lowercase <MID>.local
hostname and the device IP at generation time. Keep the address stable or issue
a replacement certificate containing the addresses used by clients.
A CA certificate is not required for explicitly trusted self-signed application certificates. For company-managed PKI:
Select Create and download CSR. The CSR uses the existing device key.
Have the CA issue an OPC UA application certificate retaining the application URI in SAN and appropriate server/client extended key usages and digital-signature/key-encipherment usages.
Import it as CA-signed device certificate. Its private key must match Neutron's existing key. Install the required CA chain in the client.
To trust CA-issued clients, import the issuing root as Trusted client certificate or CA. Import intermediate CAs as Intermediate issuer CA. An intermediate issuer entry alone does not grant trust.
Where revocation checking is used, import CA-signed CRLs as Certificate revocation list and update them before expiry. Import their issuer CAs first.
Supported imports are PEM or DER, up to 8192 bytes per file. Each trusted, rejected, issuer and CRL store holds up to 12 entries. Remove obsolete rejected entries when that store is full. Installed CRLs are checked for dates and issuer signature; expired CRLs reject affected new connections. Without installed CRLs, revocation checking is not performed. CRLs are not downloaded automatically; OCSP and GDS management are not provided.
Renew a certificate by creating a CSR and importing the renewed certificate. An expired device certificate prevents secure startup. Replace device identity removes the current key/certificate/CSR and generates a new identity at the next secure startup; clients must trust it again. Users and trusted clients are retained.
Users and certificate stores survive normal reboots and OTA updates. Erasing the device filesystem removes them. Before transferring device ownership, remove the previous users and trust entries explicitly.
Vendor namespace URI:
urn:preciz:cs-neutron:weighing:1Resolve this URI in Server/NamespaceArray at each connection. Do not hard-code
namespace index 1 or 2. The version suffix :1 belongs to the stable namespace
URI; the downloadable model version is 1.2.0.
Example forms for the same variable:
nsu=urn:preciz:cs-neutron:weighing:1;s=Scale.Gross
ns=2;s=Scale.GrossThe numeric form is valid only when the server currently assigns this URI to
index 2. If a client does not accept nsu= syntax, resolve the URI and build the
numeric-index NodeId. Vendor identifiers are case-sensitive strings, including
the periods in Scale.Gross.
Browse location | Object String NodeId |
|---|---|
Objects / CS-NEUTRON Scale |
|
Objects / Device |
|
Objects / Server | Standard namespace 0, numeric NodeId |
Methods must be called with Scale as the parent ObjectId and the method's
NodeId as MethodId.
Gross, Net and Tare are exported as Double values normalized to the configured
decimal places. HR is the high-resolution gross weight before display rounding,
not net weight or raw ADC. Every weight uses the current Scale.Unit; OPC UA
does not convert units. A Double transport type does not increase sensor accuracy.
Binary floating-point values do not represent every decimal exactly. Format
display weights using Scale.Decimals and use Scale.Division as the weighing
step. HR may appear in scientific notation: 9.31e-5 kg means 0.0000931 kg.
Neutron copies the latest weighing values into the OPC UA snapshot approximately
every min(OUI, 50) milliseconds, subject to acquisition availability. Reading
or subscribing does not initiate another ADC conversion.
SourceTimestamp identifies the measurement snapshot time when the device clock is synchronized. It is absent before synchronization. ServerTimestamp is the server-provided timestamp for the DataValue; it need not equal SourceTimestamp. UTC is used for OPC UA timestamps.
Separate reads or subscription notifications may refer to different snapshots.
Use ReadMeasurement or a captured result when fields must belong together.
An unchanged monitored value need not produce a new notification every interval.
DataValue StatusCode | Meaning / client action |
|---|---|
Good | Value is usable; inspect Stable and native status as required |
BadNoCommunication | No snapshot or more than two seconds without a new snapshot; discard live measurement |
BadSensorFailure | Native scale error; inspect ErrorCode |
BadOutOfRange | Underload or overload; discard measurement |
Quality applies to weights, ADC and Stable. Status, ErrorCode and Unit remain readable during native scale errors, but become stale if snapshots stop. Command/capture diagnostics remain readable independently of live scale quality. Metadata is configuration information; its Good status does not establish that the live weighing result is valid.
All entries below are read-only. NodeIds are vendor string identifiers unless identified as standard namespace 0. All scalar entries have ValueRank −1.
String NodeId | Type | Unit | Description |
|---|---|---|---|
| Double | Scale.Unit | Rounded gross weight |
| Double | Scale.Unit | Rounded net weight |
| Double | Scale.Unit | Applied tare |
| Double | Scale.Unit | Unrounded high-resolution gross weight |
| Int32 | ADC counts | Existing scale ADC value copied with the snapshot; no extra hardware read |
| Boolean | — | Scale stability flag |
| UInt16 | — | Indication status; table below |
| UInt16 | — | Native error; 1 means no error |
| String | — | Configured unit, such as kg or g |
| UInt16 | decimal places | Decimal-place count for displayed weight |
| Double | Scale.Unit | Active weighing division |
| Double | Scale.Unit | Active range capacity |
| UInt16 | — | Active FT setting, 1–1023 |
| Boolean | — | FC setting: false off, true on; controls ADC chopping |
ADC is not a separate per-load-cell scan. No mV variable is exposed. Despite its name, HRFilter controls the existing FC/ADC chopping function, not a software filter applied exclusively to the OPC UA HR variable.
Scale.Status | Meaning |
|---|---|
0 | Underload |
1 | Within zero range |
2 | Unstable |
3 | Stable |
4 | Overload |
255 | Uninitialized snapshot |
Use Scale.Stable as the stability flag. Scale.Status and OPC UA StatusCode
are separate concepts; a native status of 3 is not an OPC UA quality code.
Scale.ErrorCode | Meaning |
|---|---|
1 | No error |
99 | Command timeout |
98 | Unknown command |
97 | Scale disabled |
96 | Calibration missing |
95 | Metrological data missing |
94 | ADC status register error |
93 | ADC reference error |
92 | ADC conversion mode error |
91 | ADC clock configuration error |
90 | ADC single-cycle configuration error |
89 | ADC rejection filter configuration error |
88 | ADC filter mismatch |
87 | ADC channel configuration error |
86 | ADC chopping mismatch |
85 | ADC bipolar mode error |
84 | ADC external reference configuration error |
83 | ADC gain mismatch |
82 | ADC averaging filter error |
Properties have the following vendor String NodeIds. Their BrowseNames are in
namespace 0, for example 0:EngineeringUnits.
String NodeId pattern | Type | Meaning |
|---|---|---|
| EUInformation | Unit metadata |
| Range | Low/High engineering range |
| Double | Exported decimal-place count, equal to Decimals |
EURange is [0, Capacity], except Net uses [-Capacity, Capacity]. Engineering
range is metadata, not an instruction to clamp values. ValuePrecision is a
decimal-place count, not the division or an accuracy specification. HR has no
ValuePrecision property.
EngineeringUnits uses UN/CEFACT codes for kg (4933453), g (4674125), lb (4997714) and oz (5197402). Other unit symbols have UnitId −1 and an empty standards namespace. Refresh metadata after changes to units, range or scale configuration.
String NodeId | Type | Description |
|---|---|---|
| UInt32 | Latest accepted tare/zero/filter command ID |
| UInt16 | 0 idle; 1 queued; 2 executing; 3 succeeded; 4 failed |
| String | Native response or rejection reason |
| UInt32 | Latest accepted stable-capture request ID |
| UInt16 | 0 idle; 1 pending; 2 complete; 3 timeout |
Command IDs and capture IDs are separate sequences. Both are shared by all clients, local to the running service, and reset when the service restarts.
String NodeId | Type | Description |
|---|---|---|
| String | PRECIZ |
| String | Device model |
| String | MID |
| String | Firmware version |
| String | Hardware version |
| String | Configured device name |
Identity values are loaded when OPC UA starts. Restart the service after changing the device name to refresh DeviceName.
The following paths are relative to Objects / Server and use namespace 0.
Browse path | Type / value |
|---|---|
ServerArray | String[]; index 0 is the device application URI |
NamespaceArray | String[]; index 0 is the OPC UA namespace, index 1 is the device application URI; resolve the vendor URI in this array |
ServerStatus | ServerStatusDataType |
ServerStatus/StartTime, CurrentTime | DateTime, declared UtcTime |
ServerStatus/State | ServerState; 0 Running during normal operation |
ServerStatus/SecondsTillShutdown | UInt32; 0 when no shutdown is scheduled |
ServerStatus/ShutdownReason | LocalizedText |
ServerStatus/BuildInfo | BuildInfo: ProductUri, ManufacturerName, ProductName, SoftwareVersion, BuildNumber, BuildDate |
ServiceLevel | Byte; 255 during normal operation |
Auditing | Boolean; false |
VendorServerInfo | Vendor information object |
ServerRedundancy/RedundancySupport | RedundancySupport; 0 None |
ServerCapabilities/ServerProfileArray | String[]; implementation profile/facet URIs |
ServerCapabilities/LocaleIdArray | LocaleId[]; en |
ServerCapabilities/MinSupportedSampleRate | Duration in ms; active OUI minimum |
ServerCapabilities/MaxBrowseContinuationPoints | UInt16; 5 per session |
ServerCapabilities/SoftwareCertificates | SignedSoftwareCertificate[]; empty |
ServerCapabilities/ModellingRules, AggregateFunctions | Folders |
ServerCapabilities/OperationLimits | Per-request limits listed in section 9 |
Standard array variables have ValueRank 1 and ArrayDimensions [0]; zero denotes
an unspecified maximum length. ServerProfileArray identifies the Micro Embedded
Device 2017 implementation target and active transport/method/security facets.
This profile identifier is not an OPC Foundation certification mark.
Call each method on parent object Scale. Supply scalar arguments with the
exact OPC UA types shown; do not substitute String, Int32 or Double for a UInt32
or Boolean argument.
Method String NodeId | Input arguments | Output | Permission |
|---|---|---|---|
| None | Eleven measurement fields, section 8.1 | Read |
| TimeoutMs: UInt32 | RequestId: UInt32 | Execute |
| RequestId: UInt32 | Eleven measurement fields, section 8.1 | Read |
| None | RequestId: UInt32 | Execute |
| Value: Double | RequestId: UInt32 | Execute |
| None | RequestId: UInt32 | Execute |
| None | RequestId: UInt32 | Execute |
| Value: UInt16 | RequestId: UInt32 | Execute |
| Enabled: Boolean | RequestId: UInt32 | Execute |
Tares the current stable gross weight using the native T operation. It sets
tare to gross and net becomes zero; it does not change the gross zero point.
The scale must accept the stable-tare operation within its command timeout.
Example with 1.11 kg on the scale: Gross remains 1.11 kg, Tare becomes 1.11 kg,
and Net becomes 0.00 kg. A native success response resembles T S 1.11 kg.
Sets a preset tare in Scale.Unit using the native TA operation. Value must
be finite, nonnegative, no greater than 1,000,000,000 and no greater than capacity.
The applied tare is rounded to the scale division. Read Scale.Tare after completion
to obtain the applied value. Example input: Double 0.250 when Unit is kg.
Executes native Z, subject to stability and the configured zero range. On
success the zero point is adjusted and existing applied/preset tare is cleared.
The native success response is Z A. This is distinct from TareCurrent.
Executes native TAC, removing applied and preset tare. Gross is retained and
Net returns to Gross. There are no input arguments.
Value is UInt16, 1–1023 inclusive. This sets FT for the active scale channel
through the existing filter configuration handler. Zero and values above 1023
return BadOutOfRange. Example: UInt16 512.
Enabled is Boolean: true enables FC/ADC chopping, false disables it. A numeric
value sent with a numeric OPC UA type is not a Boolean and is rejected.
FT and FC are activated and saved for the active channel through the native configuration handlers. Hardware verification failure produces an unsuccessful command result. Acquisition can pause while the setting is applied. Read Scale.Filter or Scale.HRFilter after completion to see the active setting.
For TareCurrent, SetTare, Zero, ClearTare, SetFilter and SetHRFilter:
Call the method and retain its returned RequestId.
Read or subscribe to LastCommandId, LastCommandState and LastCommandResult.
Associate the result only with a matching LastCommandId.
State 3 means success; state 4 means failure. States 1 and 2 are pending.
Read the affected process/configuration values after successful completion.
A Good Call result acknowledges acceptance, not completion. Only one of these commands can be queued/executing at a time; another receives BadResourceUnavailable. Existing scale stability, availability, busy and application interlocks still apply.
The command slot and last-result diagnostics are device-wide. Coordinate writers if two clients can issue commands: a later command may replace the last completed diagnostics before another client reads them. They are not a command history.
Request IDs are not durable operation IDs. After a connection loss, inspect the affected scale state before retrying a command whose outcome is unknown. A service restart clears diagnostics and cancels unfinished OPC UA-owned scale commands; it does not undo a completed tare, zero or setting change.
ReadMeasurement() immediately returns the latest valid snapshot. It neither
waits for stability nor requests a new ADC reading. GetCapturedMeasurement
returns the same output signature for a frozen stable result.
Position (zero-based) | Argument | OPC UA type | Meaning |
|---|---|---|---|
0 | MeasurementId | UInt64 | Snapshot sequence number |
1 | Gross | Double | Gross weight |
2 | Net | Double | Net weight |
3 | Tare | Double | Applied tare |
4 | HR | Double | High-resolution gross weight |
5 | Stable | Boolean | Stability of this snapshot |
6 | Status | UInt16 | Native scale status |
7 | ErrorCode | UInt16 | Native scale error code |
8 | Unit | String | Unit for this result |
9 | Timestamp | DateTime | Snapshot UTC time, or zero if unsynchronized |
10 | TimeSynchronized | Boolean | Whether Timestamp is usable as calendar time |
All fields belong to one snapshot. MeasurementId increments per OPC UA snapshot, not per physical ADC conversion, and resets with the service. Preserve UInt64 precision when storing it. ADC, metadata and filters are separate live nodes and are not included in this eleven-field method result.
If TimeSynchronized is false, do not interpret Timestamp as a calendar date. ReadMeasurement returns BadNoCommunication, BadSensorFailure or BadOutOfRange when the live snapshot is missing/stale, has a native error or is out of range.
Call CaptureStableWeight(TimeoutMs) with UInt32 100–60000 ms. For example,
5000 allows up to five seconds for a valid stable measurement. Zero is invalid.
Retain the returned UInt32 RequestId.
Call GetCapturedMeasurement(RequestId) using that ID. While pending, it
returns BadWaitingForInitialData. Repeat at a moderate interval such as 100 ms.
On success, store the eleven-field result together with the capture RequestId.
Alternatively, subscribe to LastCaptureId and LastCaptureState, then retrieve the result when the matching request reaches state 2.
LastCaptureState | Meaning |
|---|---|
0 | Idle |
1 | Pending |
2 | Complete; result available |
3 | Timeout |
The captured snapshot must be published after the request starts and must be stable, fresh, free of native errors and within range. Invalid snapshots are skipped until a suitable one arrives or the timeout expires. If the scale is already stable, the next valid snapshot can complete the capture immediately; no unstable-to-stable transition or additional hold period is required.
The operation does not tare or zero the scale and does not block other clients. Only one capture can be pending. There is one frozen result for the whole device, shared by all clients. It remains unchanged even if the live weight changes or becomes unavailable. Starting a new capture supersedes the previous request/result. There is no capture history.
GetCapturedMeasurement result | Meaning |
|---|---|
Good | Frozen result returned |
BadWaitingForInitialData | Matching capture still pending |
BadTimeout | Matching capture expired without a valid stable measurement |
BadNotFound | ID is zero, unknown, superseded or no longer available after restart |
BadNoData | No completed result for the matching capture state |
Use the capture RequestId, not the result's MeasurementId, as input to GetCapturedMeasurement. The capture may finish after its initiating client disconnects. It can be retrieved after reconnecting with the same ID if the OPC UA service has remained running. A service restart clears pending captures, stored results and IDs; coordinate capture requests between clients.
Parameter | Meaning |
|---|---|
OUI | Configured lower bound for sampling and publishing |
Sampling interval | How often a monitored item is sampled |
Publishing interval | How often the subscription can publish queued notifications |
Queue size | Number of notifications retained per monitored item |
Keepalive | Indicates an active subscription when there are no notifications |
Start with 100–250 ms and queue size 1 for a live display. For the fastest available update, set OUI to 10 ms, reconnect after saving, and request 10 ms sampling/publishing. Use the server's revised intervals in client logic.
Sampling faster than the physical acquisition rate does not create new measurements. Network latency, encryption, client load and publishing settings affect observed response time. UAExpert's Server Status / Response Time is not the subscription's sampling or publishing interval.
Resource | Limit |
|---|---|
SecureChannels | 4 total, including reconnect overlap |
Sessions | 2 simultaneous |
Session timeout | Maximum negotiated timeout 30 seconds |
Subscriptions | 4 total; 2 per session |
Monitored items | 64 total; 32 per subscription |
Monitored-item queue | 1–16 values per item |
Pending Publish requests | 4 per session |
Retransmission queue | 16 messages per subscription |
Browse continuation points | 5 per session |
Minimum sampling/publishing | OUI, 10–5000 ms; default 100 ms |
Read / Write / Browse operations | 32 per request |
RegisterNodes / TranslateBrowsePaths operations | 32 per request |
Method Call operations | 8 per request |
Monitored-item operations | 32 per request |
These are server-wide totals unless a per-session/per-subscription scope is stated. If the Publish request queue is full, the oldest pending request receives BadTooManyPublishRequests so a new request can be queued. Acknowledgements and Republish operate on the bounded retransmission queue. The Write operation limit does not make read-only variables writable.
Close sessions cleanly. A disconnected client may leave its previous session occupying a slot until it expires. Reuse/reactivate an existing session where supported; otherwise wait for expiry. A new server instance cannot reactivate a session from before service restart: create a session, resolve namespaces and recreate subscriptions. Non-consuming TCP clients can be disconnected after a one-second send deadline.
Browse CS-NEUTRON Scale, right-click CaptureStableWeight, and select Call.
Enter TimeoutMs 5000 and click Call. Record the returned RequestId.
Open GetCapturedMeasurement and enter the same RequestId.
Click Call. If pending, call GetCapturedMeasurement again with the same ID.
Read Gross, Net, Tare, HR, Stable, Status, ErrorCode, Unit and Timestamp from the returned result. Leave the existing capture request running while waiting; do not repeatedly start new captures.
Install the client package in a Python virtual environment:
python -m pip install asyncuaPrepare an OPC UA client application certificate and private key. Its SAN
application URI must match CLIENT_URI below. Approve its certificate on Neutron
and download Neutron's certificate as neutron.der. Replace the endpoint,
username and client URI with your values. The private key file in this example
is accessible to the Python client; it is not Neutron's private key.
import asyncio
import getpass
from asyncua import Client, ua
from asyncua.crypto.security_policies import SecurityPolicyBasic256Sha256
from asyncua.ua.uaerrors import UaStatusCodeError
URL = "opc.tcp://192.168.50.73:4840"
NS_URI = "urn:preciz:cs-neutron:weighing:1"
CLIENT_URI = "urn:example:neutron-client"
FIELDS = ("MeasurementId", "Gross", "Net", "Tare", "HR", "Stable",
"Status", "ErrorCode", "Unit", "Timestamp", "TimeSynchronized")
CAPTURE = False # Set True when logged in with command permission.
async def main():
client = Client(URL, timeout=10)
client.application_uri = CLIENT_URI
await client.set_security(
SecurityPolicyBasic256Sha256,
certificate="client.der",
private_key="client-key.pem",
server_certificate="neutron.der",
mode=ua.MessageSecurityMode.SignAndEncrypt,
)
client.set_user(input("Username: "))
client.set_password(getpass.getpass("Password: "))
async with client:
ns = await client.get_namespace_index(NS_URI)
scale = client.get_node(ua.NodeId("Scale", ns))
def method(name):
return ua.NodeId("Scale." + name, ns)
values = await scale.call_method(method("ReadMeasurement"))
result = dict(zip(FIELDS, values))
print("Current snapshot:", result)
if CAPTURE:
request_id = await scale.call_method(
method("CaptureStableWeight"),
ua.Variant(5000, ua.VariantType.UInt32),
)
deadline = asyncio.get_running_loop().time() + 7
while True:
try:
values = await scale.call_method(
method("GetCapturedMeasurement"),
ua.Variant(request_id, ua.VariantType.UInt32),
)
print("Capture", request_id, dict(zip(FIELDS, values)))
break
except UaStatusCodeError as exc:
if exc.code != ua.StatusCodes.BadWaitingForInitialData:
raise
if asyncio.get_running_loop().time() >= deadline:
raise TimeoutError("Client capture wait expired") from exc
await asyncio.sleep(0.1)
asyncio.run(main())ReadMeasurement requires valid live data. Exceptions such as BadSensorFailure or BadOutOfRange must be handled by the calling application. BadTimeout from GetCapturedMeasurement means the server's capture timeout expired; it is not a reason to reuse an old stored measurement as a new successful capture.
The following code runs inside an established async with client connection.
The handler checks quality before using the value.
class WeightHandler:
def datachange_notification(self, node, value, data):
status = data.monitored_item.Value.StatusCode
if status.is_good():
print(node.nodeid.to_string(), value)
else:
print("Invalid measurement:", status)
ns = await client.get_namespace_index(NS_URI)
gross = client.get_node(ua.NodeId("Scale.Gross", ns))
subscription = await client.create_subscription(100, WeightHandler())
try:
await subscription.subscribe_data_change(gross, queuesize=1)
await asyncio.sleep(30)
finally:
await subscription.delete()The requested publishing interval is 100 ms. Configure monitored-item sampling through the client library as needed and honor revised server values.
Use the OPC UA client blocks supplied by the PLC manufacturer. Resolve String NodeIds using the vendor namespace URI. The following is a vendor-neutral sequence, not a specific PLC programming-language implementation:
CONNECT -> TRUST / AUTHENTICATE -> RESOLVE NAMESPACE URI
-> RESOLVE Scale object and required variable/method NodeIds
-> CREATE SUBSCRIPTION -> MONITOR LIVE DATA
On a stable-result request:
Call Scale.CaptureStableWeight(TimeoutMs := UInt32(5000))
Save returned RequestId
Call Scale.GetCapturedMeasurement(RequestId)
BadWaitingForInitialData -> wait 100 ms and repeat retrieval
Good -> store the eleven fields as one record
BadTimeout -> report no stable result
Other failure -> handle the error; do not use old data
On tare request:
Call Scale.TareCurrent()
Save returned command RequestId
Wait for matching LastCommandId and LastCommandState 3 or 4
On success read Gross / Net / Tare; on failure read LastCommandResultMap UInt64 MeasurementId to an appropriate PLC integer type. Do not send a numeric Boolean substitute to SetHRFilter. Serialize commands and stable-capture ownership in the PLC/application when multiple clients have command permission.
Symptom / status | Meaning and action |
|---|---|
BadCommunicationError / connection refused | Confirm OPC UA is enabled, endpoint IP/port, selected network route and firewall. The startup log must contain |
BadCertificateUntrusted | Trust Neutron in the client and approve the client certificate in Neutron, or install the appropriate CA chain |
Certificate time/URI errors | Synchronize clocks and use a certificate with valid dates and the client's configured application URI |
BadIdentityTokenRejected / BadUserAccessDenied | Use the correct username/password and required command permission; wait out the 30-second block after repeated login failures |
BadTooManySessions / session limit reached | Two slots are occupied; disconnect another client or wait for an abandoned session to expire |
BadNodeIdUnknown | Resolve the vendor namespace URI again, check the case-sensitive String NodeId and firmware/model compatibility |
BadTypeMismatch | Use the exact scalar argument type from section 7.1 |
BadOutOfRange on CaptureStableWeight | Timeout must be UInt32 100–60000; zero is invalid |
BadOutOfRange on SetFilter / SetTare | Use FT 1–1023 or a finite nonnegative tare within capacity and 1e9 |
BadResourceUnavailable | Command slot or capture slot is busy; wait for its current operation |
Command Call is Good but operation fails | Inspect matching LastCommandState and LastCommandResult; Good only acknowledged queueing |
BadNotWritable on variable writes | Process variables are read-only; use the supported method |
Capture BadWaitingForInitialData | Keep retrieving the same capture ID; the server is waiting for a valid stable sample |
Capture BadTimeout | No qualifying stable sample arrived before the deadline |
Capture BadNotFound | Use the returned capture RequestId; a newer capture or service restart invalidated the old ID |
Missing ServerCapabilities after firmware change | Refresh the address space or reconnect with a fresh client project to discard cached browse results |
Blank/stale measurements | Keep scale acquisition enabled, inspect ErrorCode and native status, and check DataValue quality |
NodeSet2 describes the vendor address space, method arguments, references and types for offline model tools. Its namespace indexes are local to that XML file; resolve the namespace URI on the live device. The XML contains model definitions, not current measurements or a backup of users/certificates/settings. Runtime intervals and executable permissions follow the active device configuration.
Information model | Interface additions |
|---|---|
1.0 | Base weighing values and tare/zero methods |
1.1.0 | Measurement metadata, identification, coherent measurement and stable capture |
1.2.0 | ADC, FT/FC values and SetFilter/SetHRFilter |
The namespace URI remains urn:preciz:cs-neutron:weighing:1. Existing method
signatures are retained; ReadMeasurement/GetCapturedMeasurement return eleven
fields. Select firmware containing OPC UA and the functions required by the
integration. A firmware build without OPC UA cannot expose an endpoint.
Yes. Select Basic256Sha256 / SignAndEncrypt, use a username and password, and establish mutual trust in application certificates. Unprotected None/Anonymous mode is also available.
Call CaptureStableWeight with a UInt32 timeout of 100–60000 ms, retain its RequestId and retrieve the eleven-field result with GetCapturedMeasurement using that same ID. While pending, retrieve again instead of starting another capture.
For tare, zero and filter commands, Good confirms acceptance. Match LastCommandId to the returned RequestId and wait for LastCommandState 3 (success) or 4 (failure).
Resolve urn:preciz:cs-neutron:weighing:1 in NamespaceArray on every connection. The downloadable information model is version 1.2.0; a numeric namespace index such as 2 is only an example.
CSCP command reference for Neutron: message structure, weighing, configuration, counting, checkweighing and digital I/O.
Neutron Modbus RTU/TCP reference for PLC, SCADA and HMI integration: connection, addressing, registers, calibration and automatic checkweigher control.