Skip to main content

common method patterns

1. device control methods

start/stop operations

// Start a motor
msg.payload = {
"speed": 1500, // RPM
"direction": "forward",
"rampTime": 10.0 // seconds
};
msg.objectId = "ns=2;s=Motor1";
msg.methodId = "ns=2;s=Start";
// Stop a motor
msg.payload = {
"emergencyStop": false,
"rampTime": 5.0 // seconds to decelerate
};
msg.objectId = "ns=2;s=Motor1";
msg.methodId = "ns=2;s=Stop";

configuration methods

// Configure PID controller
msg.payload = {
"kp": 1.2, // Proportional gain
"ki": 0.1, // Integral gain
"kd": 0.05, // Derivative gain
"setpoint": 50.0, // Target value
"outputMin": 0.0, // Minimum output
"outputMax": 100.0 // Maximum output
};
msg.objectId = "ns=2;s=PIDController";
msg.methodId = "ns=2;s=Configure";

2. process methods

recipe execution

// Execute a production recipe
msg.payload = {
"recipeId": "RECIPE_001",
"batchSize": 1000, // kg
"priority": "Normal",
"operatorId": "OP123"
};
msg.objectId = "ns=2;s=BatchReactor";
msg.methodId = "ns=2;s=ExecuteRecipe";

calibration methods

// Calibrate a sensor
msg.payload = {
"referenceValue": 100.0,
"currentReading": 98.5,
"calibrationType": "TwoPoint"
};
msg.objectId = "ns=2;s=TemperatureSensor";
msg.methodId = "ns=2;s=Calibrate";

3. maintenance methods

diagnostic methods

// Run system diagnostics
msg.payload = {
"testLevel": "Full",
"includeHistory": true,
"generateReport": true
};
msg.objectId = "ns=2;s=SystemDiagnostics";
msg.methodId = "ns=2;s=RunDiagnostics";

reset methods

// Reset alarm conditions
msg.payload = {
"alarmIds": ["ALM001", "ALM002", "ALM003"],
"operatorId": "MAINT001",
"reason": "Maintenance completed"
};
msg.objectId = "ns=2;s=AlarmManager";
msg.methodId = "ns=2;s=ResetAlarms";

next Steps

After mastering basic method calls, explore: