I/O signals, devices & networks
Read and write digital, analog and group signals, pulse or invert a signal, and browse the I/O devices and networks of the controller.
robot.Rws.Io reads and writes the I/O of the controller. The I/O system has three levels: a network carries devices, a device carries signals. A signal is identified by the three names together, for example Local, Board10 and DO_Gripper.
A shorter introduction with a complete example is given in Read & write I/O signals.
Signals
GetSignal reads one signal, GetSignals reads every signal of the controller in one call.
IoSignalType | Values |
|---|---|
DigitalInput, DigitalOutput | 0 or 1 |
AnalogInput, AnalogOutput | A real value inside the range configured on the controller |
GroupInput, GroupOutput | An integer coded on several bits |
Unknown | The controller reports a type this library does not know |
// A signal is identified by its network, its device and its nameIoSignalItem signal = robot.Rws.Io.GetSignal("Local", "Board10", "DO_Gripper");Console.WriteLine(signal.Path); // Local/Board10/DO_GripperConsole.WriteLine(signal.Type); // DigitalOutputConsole.WriteLine(signal.LogicalValue); // 1Console.WriteLine(signal.LogicalState); // NotSimulatedConsole.WriteLine(signal.PhysicalValue); // 1Console.WriteLine(signal.PhysicalState); // Valid// Every signal of the controller, in one callIoSignalItem[] signals = robot.Rws.Io.GetSignals();foreach (IoSignalItem item in signals){Console.WriteLine($"{item.Path} = {item.LogicalValue} ({item.Type})");}
LogicalValue is the value seen by the RAPID programs, PhysicalValue the one on the hardware. They differ when the signal is simulated. LogicalState says whether it is simulated, PhysicalState whether the physical value is valid.
A controller usually declares several hundreds of signals, so GetSignals returns a large answer. Prefer SearchSignals when you only need part of them.
Write a signal
SetSignalValue writes the logical value of a signal. The value is a float, which covers the digital, the analog and the group signals with one method.
// A digital signal takes 0 or 1robot.Rws.Io.SetSignalValue("Local", "Board10", "DO_Gripper", 1);// An analog or a group signal takes any value inside its rangerobot.Rws.Io.SetSignalValue("Local", "Board10", "AO_Speed", 12.5f);// The last argument writes the change in the event log of the controllerrobot.Rws.Io.SetSignalValue("Local", "Board10", "DO_Gripper", 0, true);// The controller applies the value 500 ms later, and answers immediatelyrobot.Rws.Io.SetSignalValueDelayed("Local", "Board10", "DO_Gripper", 1, 500);
Writing a signal needs no mastership, but the user account needs the write access on it, and the signal must accept a write from a remote client in the current operating mode. That is what GetSignalConfiguration reports, see below. The controller refuses the write with an RwsException when the signal is read only or when the value is outside its range.
SetSignalValueDelayed asks the controller to apply the value after a delay in milliseconds. The call returns immediately, the controller does the waiting.
Pulse, toggle and invert
// Three pulses to 1, 200 ms active and 200 ms passiverobot.Rws.Io.PulseSignal("Local", "Board10", "DO_Gripper", 1, 3, 200, 200);// Same, with the pulse lengths configured on the controllerrobot.Rws.Io.PulseSignal("Local", "Board10", "DO_Gripper", 1, 1);// Toggle pulses the signal by starting from the opposite of its current valuerobot.Rws.Io.ToggleSignal("Local", "Board10", "DO_Gripper", 1, 2, 200, 200);// Invert writes the opposite of the current value, oncerobot.Rws.Io.InvertSignal("Local", "Board10", "DO_Gripper", 1);
Only the digital and the group signals can be pulsed, toggled or inverted, an analog signal is refused. The three methods take a value even though they compute the written value themselves, because the controller rejects a write that carries none. Leave the two pulse lengths null to use the ones configured on the controller.
Simulate a signal
A simulated signal keeps the value written by the client and stops following its device. This is how an input is forced during a test, without any wiring.
// Simulate an input: it keeps the value written by the clientrobot.Rws.Io.SetSignalState("Local", "Board10", "DI_PartPresent", true);robot.Rws.Io.SetSignalValue("Local", "Board10", "DI_PartPresent", 1);IoSignalItem signal = robot.Rws.Io.GetSignal("Local", "Board10", "DI_PartPresent");Console.WriteLine(signal.LogicalState); // Simulated// Give the signal back to its devicerobot.Rws.Io.SetSignalState("Local", "Board10", "DI_PartPresent", false);// Or stop simulating every simulated signal of the controller at oncerobot.Rws.Io.UnblockSignals();
SetSignalState only turns the simulation on and off, the value is still written with SetSignalValue. UnblockSignals stops the simulation of every simulated signal of the controller at once, which is a good thing to call at the end of a test run.
Search signals
SearchSignals narrows the result down with an IoSignalSearchCriteria. Every property of the criteria is optional, and an empty criteria matches every signal.
// Every digital output of one deviceIoSignalSearchCriteria criteria = new IoSignalSearchCriteria();criteria.DeviceName = "Board10";criteria.Type = IoSignalType.DigitalOutput;IoSignalItem[] outputs = robot.Rws.Io.SearchSignals(criteria);foreach (IoSignalItem signal in outputs){Console.WriteLine($"{signal.Name} = {signal.LogicalValue}");}// The extended search also reports the physical value and the write access levelIoSignalItem[] extended = robot.Rws.Io.SearchSignalsExtended(criteria, null, 0, 50);Console.WriteLine(extended[0].PhysicalValue);Console.WriteLine(extended[0].Quality);Console.WriteLine(extended[0].WriteAccessLevel);// A second inverted criteria excludes what it matches, here the safety signalsIoSignalSearchCriteria exclude = new IoSignalSearchCriteria();exclude.Category = "safety";exclude.Invert = true;IoSignalItem[] withoutSafety = robot.Rws.Io.SearchSignals(criteria, exclude);
SearchSignalsExtended returns the same signals with their physical value, their time stamps, their quality and their write access level. It costs more on the controller, so use the simple search when the logical value is enough.
A second criteria can be passed. A signal is returned only when it matches both. Set Invert on one of the two to exclude what it matches, otherwise the result is the same as with a single criteria. start and limit page through a long result.
Signal configuration
GetSignalConfiguration reports how the signal was declared in the I/O configuration of the controller: its width in bits, and who is allowed to write it.
IoSignalConfiguration config = robot.Rws.Io.GetSignalConfiguration("Local", "Board10", "DO_Gripper");Console.WriteLine(config.SignalName); // DO_GripperConsole.WriteLine(config.SignalBits); // 1// Who is allowed to write the signal, and in which operation modeConsole.WriteLine(config.Rapid); // a RAPID programConsole.WriteLine(config.LocalManual); // the teach pendant, in manual modeConsole.WriteLine(config.LocalAuto); // the teach pendant, in auto modeConsole.WriteLine(config.RemoteManual); // a remote client, in manual modeConsole.WriteLine(config.RemoteAuto); // a remote client, in auto mode
Rapid, LocalManual, LocalAuto, RemoteManual and RemoteAuto are the write rights. Your application is a remote client, so RemoteAuto and RemoteManual are the two to check before a write. A write refused by the configuration gives an RwsException, not a silent failure.
// Gets a single I/O signal, including its physical value and time stamps (synchronous)IoSignalItem GetSignal(string network, string device, string signal);// Gets the runtime configuration properties of an I/O signal (synchronous)IoSignalConfiguration GetSignalConfiguration(string network, string device, string signal);// Gets every I/O signal defined in the controller (synchronous) A controller usually exposes several hundreds of signals. Use Nullable%7bSystem.Int32%7d) to narrow the result down to a network, a device, a category or a signal type.IoSignalItem[] GetSignals();// Inverts the value of an I/O signal (synchronous) Only digital and group signals can be inverted.void InvertSignal(string network, string device, string signal, float value, bool logToEventLog = false);// Pulses the value of an I/O signal (synchronous) Only digital and group signals can be pulsed.void PulseSignal(string network, string device, string signal, float value, int pulses, int? activePulseLength = null, int? passivePulseLength = null, bool logToEventLog = false);// Searches the I/O signals matching the given criteria (synchronous) The returned signals carry their name, type, category, logical value and logical state. Use Nullable%7bSystem.Int32%7d) to also get their physical value, time stamps and write access level.IoSignalItem[] SearchSignals(IoSignalSearchCriteria criteria = null, IoSignalSearchCriteria secondCriteria = null, int? start = null, int? limit = null);// Searches the I/O signals matching the given criteria and returns their extended properties (synchronous) In addition to Nullable%7bSystem.Int32%7d), the returned signals carry their physical value, quality, time stamps and write access level.IoSignalItem[] SearchSignalsExtended(IoSignalSearchCriteria criteria = null, IoSignalSearchCriteria secondCriteria = null, int? start = null, int? limit = null);// Simulates or stops simulating an I/O signal (synchronous) A simulated signal keeps the logical value written by the client and no longer follows its physical value.void SetSignalState(string network, string device, string signal, bool simulated);// Writes the value of an I/O signal (synchronous)void SetSignalValue(string network, string device, string signal, float value, bool logToEventLog = false);// Writes the value of an I/O signal in "queued delayed" mode (synchronous) The controller queues the write and applies it once the delay has elapsed.void SetSignalValueDelayed(string network, string device, string signal, float value, int delay, bool logToEventLog = false);// Pulses an I/O signal by toggling its current value (synchronous) Only digital and group signals can be toggled.void ToggleSignal(string network, string device, string signal, float value, int pulses, int? activePulseLength = null, int? passivePulseLength = null, bool logToEventLog = false);// Removes the simulation of every simulated I/O signal of the controller (synchronous)void UnblockSignals();
Every method also exists in an asynchronous version, with the same name followed by Async and an optional CancellationToken.
public class IoSignalItem {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoSignalItem" data-throw-if-not-resolved="false"></xref> classpublic IoSignalItem()// Category the signal belongs to, for example "safety"public string Category { get; set; }// Name of the device the signal is connected to, for example "DRV_1"public string DeviceName { get; set; }// Logical state of the signal (simulated or not)public IoSignalLogicalState LogicalState { get; set; }// Microseconds part of the global time at which the logical value was updated, null when not reportedpublic long? LogicalTimeMicroseconds { get; set; }// Seconds part of the global time at which the logical value was updated, null when not reportedpublic long? LogicalTimeSeconds { get; set; }// Logical value of the signal, null when the controller did not report itpublic float? LogicalValue { get; set; }// Name of the signal, for example "DRV1BRAKE"public string Name { get; set; }// Name of the network the signal belongs to, for example "Local"public string NetworkName { get; set; }// Full path of the signal, "{network}/{device}/{signal}" (for example "Local/DRV_1/DRV1BRAKE")public string Path { get; set; }// Physical state of the signal.//// <p>Only reported when reading a single signal with <code>IoService.GetSignal()</code>.</p>public IoSignalPhysicalState PhysicalState { get; set; }// Microseconds part of the global time at which the physical value was updated, null when not reportedpublic long? PhysicalTimeMicroseconds { get; set; }// Seconds part of the global time at which the physical value was updated, null when not reportedpublic long? PhysicalTimeSeconds { get; set; }// Physical value of the signal, null when the controller did not report it.//// <p>Only reported by <code>IoService.GetSignal()</code> and <code>IoService.SearchSignalsExtended()</code>.</p>public float? PhysicalValue { get; set; }// Quality of the signal, reported as a numeric code by <code>IoService.GetSignal()</code> and as a// textual value (for example "good") by <code>IoService.SearchSignalsExtended()</code>public string Quality { get; set; }// Returns a string representation of this signalpublic override string ToString()// Type of the signalpublic IoSignalType Type { get; set; }// Access level required to write the signal, for example "None".//// <p>Only reported by <code>IoService.SearchSignalsExtended()</code>.</p>public string WriteAccessLevel { get; set; }}
public class IoSignalSearchCriteria {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoSignalSearchCriteria" data-throw-if-not-resolved="false"></xref> classpublic IoSignalSearchCriteria()// Whether only the blocked (simulated) signals are searchedpublic bool? Blocked { get; set; }// Category of the searched signals, for example "safety"public string Category { get; set; }// Category prefix of the searched signalspublic string CategoryPrefix { get; set; }// Name of the device the searched signals are connected topublic string DeviceName { get; set; }// Whether the criteria is inverted: the signals matching it are excluded from the resultpublic bool? Invert { get; set; }// Name of the searched signalspublic string Name { get; set; }// Name of the network the searched signals belong topublic string NetworkName { get; set; }// Returns a string representation of this search criteriapublic override string ToString()// Type of the searched signals, null to search every typepublic IoSignalType? Type { get; set; }}
public class IoSignalConfiguration {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoSignalConfiguration" data-throw-if-not-resolved="false"></xref> classpublic IoSignalConfiguration()// Whether a local client can write the signal in auto modepublic bool? LocalAuto { get; set; }// Whether a local client can write the signal in manual modepublic bool? LocalManual { get; set; }// Whether a RAPID client can write the signal in both manual and auto modepublic bool? Rapid { get; set; }// Whether a remote client can write the signal in auto modepublic bool? RemoteAuto { get; set; }// Whether a remote client can write the signal in manual modepublic bool? RemoteManual { get; set; }// Whether the bits of this signal are set by a device transfer operation.//// <p>Not reported by every controller, null when absent from the response.</p>public bool? SetByDeviceTransfer { get; set; }// Number of bits of the signal, null when not reportedpublic int? SignalBits { get; set; }// Name of the signal, for example "DRV1CHAIN2"public string SignalName { get; set; }// Returns a string representation of this signal configurationpublic override string ToString()}
public enum IoSignalType {// Analog inputAnalogInput = 4// Analog outputAnalogOutput = 3// Digital inputDigitalInput = 2// Digital outputDigitalOutput = 1// Group inputGroupInput = 5// Group outputGroupOutput = 6// The signal type could not be determinedUnknown = 0}
public enum IoSignalLogicalState {// The signal is not simulatedNotSimulated = 2// The signal is simulated: its logical value is forced and no longer follows the physical valueSimulated = 1// The logical state could not be determinedUnknown = 0}
public enum IoSignalPhysicalState {// The physical value of the signal is not validInvalid = 2// The physical state could not be determinedUnknown = 0// The physical value of the signal is validValid = 1}
I/O devices
A device is a physical or a virtual I/O board. GetDevices lists them all, GetDevice reads one with its input and output data.
// Every device of every networkIoDeviceItem[] devices = robot.Rws.Io.GetDevices();foreach (IoDeviceItem item in devices){Console.WriteLine($"{item.Path} ({item.Type}) {item.PhysicalState} {item.LogicalState}");}// One device, with its input and output dataIoDeviceItem device = robot.Rws.Io.GetDevice("Local", "Board10");Console.WriteLine(device.Address);Console.WriteLine(device.InputData);Console.WriteLine(device.OutputData);// Number of bits and write rights of the deviceIoDeviceConfiguration config = robot.Rws.Io.GetDeviceConfiguration("Local", "Board10");Console.WriteLine($"{config.InputBits} input bits, {config.OutputBits} output bits");// Disable a device, then enable it againrobot.Rws.Io.SetDeviceState("Local", "Board10", IoDeviceLogicalState.Disabled);robot.Rws.Io.SetDeviceState("Local", "Board10", IoDeviceLogicalState.Enabled);// Search by name, by logical state, or by both, optionally inside one networkIoDeviceItem[] enabled = robot.Rws.Io.SearchDevices(null, IoDeviceLogicalState.Enabled, "Local");// Force the first input byte of a device, on a virtual controller only.// The mask selects the written bits, here the two lowest ones.robot.Rws.Io.SetDeviceInputData("Local", "Board10", 0, 0x03, 0x03);robot.Rws.Io.SetDeviceOutputData("Local", "Board10", 0, 0x01, 0x01);// Firmware state of a device and of its modules, on a real controller onlyIoDeviceUpgradeInfo upgrade = robot.Rws.Io.GetDeviceUpgradeInfo("EtherNetIP", "Local_IO");Console.WriteLine($"{upgrade.State} {upgrade.Status} {upgrade.ModuleCount} modules");foreach (IoFirmwareModuleInfo module in upgrade.Modules){Console.WriteLine($"{module.Index} {module.ProgramName} {module.SerialNumber}");}// Send a command to a device, on a real controller only.// The last two arguments are the length of the value and the timeout in milliseconds.robot.Rws.Io.SendDeviceCommand("EtherNetIP", "Local_IO", "FIRMWARE_INFO", "", 0, 5000);
PhysicalState is the state of the hardware: Running, Error, Unconnected, Unconfigured, Deactivated, Startup, Init or Halted. LogicalState is what the controller was asked to do with the device, Enabled or Disabled, and SetDeviceState changes it. Disabling a device stops its signals from being updated.
GetDeviceConfiguration reports the number of input and output bits of the device and the same write rights as for a signal.
Three methods depend on the kind of controller:
SetDeviceInputDataandSetDeviceOutputDataforce one byte of the data of a device, on a virtual controller only. The mask selects the written bits, a bit at zero is left unchanged. A real controller refuses the request.GetDeviceUpgradeInforeports the firmware state of a device and of its modules, on a real controller only.SendDeviceCommandsends a command to a device, on a real controller only.valueLengthis used on an IRC5, an OmniCore computes it from the value itself and ignores the argument.
// Gets a single I/O device, including its input and output data (synchronous)IoDeviceItem GetDevice(string network, string device);// Gets the runtime configuration properties of an I/O device (synchronous)IoDeviceConfiguration GetDeviceConfiguration(string network, string device);// Gets the firmware upgrade status of an I/O device and of each of its modules (synchronous) Only available on a real controller.IoDeviceUpgradeInfo GetDeviceUpgradeInfo(string network, string device);// Gets every I/O device defined in the controller (synchronous)IoDeviceItem[] GetDevices();// Searches the I/O devices matching a name and/or a logical state (synchronous)IoDeviceItem[] SearchDevices(string name = null, IoDeviceLogicalState? logicalState = null, string network = null);// Sends a command to an I/O device (synchronous) Only available on a real controller.void SendDeviceCommand(string network, string device, string commandName, string value, int valueLength, int timeout);// Writes one byte of the input data of an I/O device (synchronous) Only supported on a virtual controller.void SetDeviceInputData(string network, string device, int startByte, int signalData, int dataMask);// Writes one byte of the output data of an I/O device (synchronous) Only supported on a virtual controller.void SetDeviceOutputData(string network, string device, int startByte, int signalData, int dataMask);// Enables or disables an I/O device (synchronous)void SetDeviceState(string network, string device, IoDeviceLogicalState logicalState);
Every method also exists in an asynchronous version, with the same name followed by Async and an optional CancellationToken.
public class IoDeviceItem {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoDeviceItem" data-throw-if-not-resolved="false"></xref> classpublic IoDeviceItem()// Address of the device on its network, "-" when the network has no addressingpublic string Address { get; set; }// Input data of the device, as an hexadecimal string (for example "1FFFE063").//// <p>Only reported when reading a single device with <code>IoService.GetDevice()</code>.</p>public string InputData { get; set; }// Input mask of the device, as an hexadecimal string. A bit set to zero is an input bit that is not written.//// <p>Only reported when reading a single device with <code>IoService.GetDevice()</code>.</p>public string InputMask { get; set; }// Logical state of the devicepublic IoDeviceLogicalState LogicalState { get; set; }// Name of the device, for example "DRV_1" or "PANEL"public string Name { get; set; }// Name of the network the device is connected to, for example "Local"public string NetworkName { get; set; }// Output data of the device, as an hexadecimal string (for example "0000000E").//// <p>Only reported when reading a single device with <code>IoService.GetDevice()</code>.</p>public string OutputData { get; set; }// Output mask of the device, as an hexadecimal string. A bit set to zero is an output bit that is not written.//// <p>Only reported when reading a single device with <code>IoService.GetDevice()</code>.</p>public string OutputMask { get; set; }// Full path of the device, "{network}/{device}" (for example "Local/DRV_1")public string Path { get; set; }// Physical state of the devicepublic IoDevicePhysicalState PhysicalState { get; set; }// Returns a string representation of this devicepublic override string ToString()// Type of the device, for example "DRV_1_TYPE".//// <p>Not reported by every controller, null when absent. A virtual controller leaves it out.</p>public string Type { get; set; }}
public class IoDeviceConfiguration {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoDeviceConfiguration" data-throw-if-not-resolved="false"></xref> classpublic IoDeviceConfiguration()// Whether deactivating the device is deniedpublic bool? DenyDeactivate { get; set; }// Address of the device on its network, "-" when the network has no addressingpublic string DeviceAddress { get; set; }// Name of the device, for example "DN_Internal_Device"public string DeviceName { get; set; }// Number of input bits of the device, null when not reportedpublic int? InputBits { get; set; }// Whether a local client can access the device in auto modepublic bool? LocalAuto { get; set; }// Whether a local client can access the device in manual modepublic bool? LocalManual { get; set; }// Name of the industrial network the device belongs to, for example "DeviceNet"public string NetworkName { get; set; }// Number of output bits of the device, null when not reportedpublic int? OutputBits { get; set; }// Whether a RAPID client can access the device in both manual and auto modepublic bool? Rapid { get; set; }// Whether a remote client can access the device in auto modepublic bool? RemoteAuto { get; set; }// Whether a remote client can access the device in manual modepublic bool? RemoteManual { get; set; }// Returns a string representation of this device configurationpublic override string ToString()}
public class IoDeviceUpgradeInfo {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoDeviceUpgradeInfo" data-throw-if-not-resolved="false"></xref> classpublic IoDeviceUpgradeInfo()// Number of modules reported by the controllerpublic int ModuleCount { get; }// Firmware status of each module of the device, empty when the controller reported nonepublic IoFirmwareModuleInfo[] Modules { get; set; }// Overall progress of the firmware upgrade of the devicepublic IoFirmwareUpgradeState State { get; set; }// Overall result of the firmware upgrade of the devicepublic IoFirmwareUpgradeStatus Status { get; set; }// Returns a string representation of this upgrade informationpublic override string ToString()}
public class IoFirmwareModuleInfo {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoFirmwareModuleInfo" data-throw-if-not-resolved="false"></xref> classpublic IoFirmwareModuleInfo()// Hardware revision of the module, for example "C.1"public string HardwareRevision { get; set; }// Index of the module inside the device ("0", "1", ...)public string Index { get; set; }// Name of the latest program available for the modulepublic string LatestProgramNameAvailable { get; set; }// Name of the program installed on the module, for example "A_HYPIOM_B_3_8"public string ProgramName { get; set; }// Serial number of the modulepublic string SerialNumber { get; set; }// Progress of the firmware upgrade of this modulepublic IoFirmwareUpgradeState State { get; set; }// Result of the firmware upgrade of this modulepublic IoFirmwareUpgradeStatus Status { get; set; }// Returns a string representation of this modulepublic override string ToString()}
public enum IoDeviceLogicalState {// The device is disabledDisabled = 2// The device is enabledEnabled = 1// The logical state could not be determinedUnknown = 0}
public enum IoDevicePhysicalState {// The device is deactivatedDeactivated = 1// The device reports an errorError = 3// The device is haltedHalted = 8// The device is initializingInit = 7// The device is runningRunning = 2// The device is starting upStartup = 6// The device is not configuredUnconfigured = 5// The device is not connectedUnconnected = 4// The physical state could not be determinedUnknown = 0}
public enum IoFirmwareUpgradeState {// The upgrade resources are being allocatedAllocate = 4// The upgrade is performed automaticallyAutomatic = 1// The upgraded firmware is being verifiedCheck = 12// The upgrade resources are being releasedDeallocate = 13// The upgrade is finishedFinished = 14// The firmware information is being collectedInfo = 3// The upgrade has to be started manuallyManual = 2// The upgrade is runningRunning = 6// The firmware is being written to the deviceRunningBurnInProgress = 10// The firmware is being checkedRunningCheckInProgress = 8// The device acknowledged the end of the upgradeRunningEndReceived = 11// The device memory is being erasedRunningEraseInProgress = 9// The device acknowledged the start of the upgradeRunningStartReceived = 7// The upgrade is startingStart = 5// The state is unknown, or could not be parsedUnknown = 0}
public enum IoFirmwareUpgradeStatus {// The upgrade failedError = 1// The upgrade finished, the firmware was already up to dateOk = 2// The upgrade is pendingPending = 4// The controller did not report a status, or it could not be parsedUnknown = 0// The upgrade finished, the firmware was updatedUpgraded = 3}
I/O networks
A network groups the devices connected the same way. Local is the internal network of the controller, a fieldbus such as EtherNet/IP or PROFINET is another one.
// Every network of the controllerIoNetworkItem[] networks = robot.Rws.Io.GetNetworks();foreach (IoNetworkItem item in networks){Console.WriteLine($"{item.Name}: {item.PhysicalState}, {item.LogicalState}");}IoNetworkItem network = robot.Rws.Io.GetNetwork("Local");IoNetworkConfiguration config = robot.Rws.Io.GetNetworkConfiguration("Local");Console.WriteLine($"{config.NetworkName} {config.NetworkType} {config.NetworkAddress}");// Stop a network, then start it again. Every device of the network follows.robot.Rws.Io.SetNetworkState("Local", IoNetworkLogicalState.Stopped);robot.Rws.Io.SetNetworkState("Local", IoNetworkLogicalState.Started);// Search by name, by physical state, or by bothIoNetworkItem[] running = robot.Rws.Io.SearchNetworks(null, IoNetworkPhysicalState.Running);// Run the auto configuration of a fieldbus network.// This rewrites the I/O configuration and cannot be undone.IoClientAction action = robot.Rws.Io.SetNetworkConfigurationType("DeviceNet", IoNetworkConfigurationType.Scan);if (action == IoClientAction.Restart){Console.WriteLine("Restart the controller to apply the new configuration");}// Names of the I/O resources the controller exposesstring[] resources = robot.Rws.Io.GetResources();
SetNetworkState starts and stops a network. Every device of the network follows, so stopping a network stops the signals of all its devices at once.
GetNetworkConfiguration returns the type and the address of the network. GetResources returns the names of the I/O resources the controller exposes, which is mostly useful to check what a given controller supports.
Auto configuration
SetNetworkConfigurationType runs the auto configuration of a fieldbus network. It rewrites part of the I/O configuration of the controller and cannot be undone, so keep it out of a production application.
IoNetworkConfigurationType | Configures |
|---|---|
Scan | Scans the network for the connected devices |
Units | The devices of the network |
Bits | The signals of the network |
Groups | The signal groups of the network |
Both | The signals and the signal groups |
The returned IoClientAction says what to do next: None when nothing is needed, Info when the result should be shown to the user, Restart when the controller has to be restarted for the new configuration to take effect. An IRC5 does not report it, Unknown is then always returned.
// Gets a single I/O network (synchronous)IoNetworkItem GetNetwork(string network);// Gets the runtime configuration properties of an I/O network (synchronous)IoNetworkConfiguration GetNetworkConfiguration(string network);// Gets every I/O network defined in the controller (synchronous)IoNetworkItem[] GetNetworks();// Gets the names of the I/O sub resources exposed by the controller (synchronous)string[] GetResources();// Searches the I/O networks matching a name and/or a physical state (synchronous)IoNetworkItem[] SearchNetworks(string name = null, IoNetworkPhysicalState? physicalState = null);// Runs the auto configuration of an I/O network (synchronous)IoClientAction SetNetworkConfigurationType(string network, IoNetworkConfigurationType configurationType);// Starts or stops an I/O network (synchronous)void SetNetworkState(string network, IoNetworkLogicalState logicalState);
Every method also exists in an asynchronous version, with the same name followed by Async and an optional CancellationToken.
public class IoNetworkItem {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoNetworkItem" data-throw-if-not-resolved="false"></xref> classpublic IoNetworkItem()// Logical state of the networkpublic IoNetworkLogicalState LogicalState { get; set; }// Name of the network, for example "Local", "Virtual" or "EtherNetIP"public string Name { get; set; }// Full path of the network, which is its name for a network (for example "Local")public string Path { get; set; }// Physical state of the networkpublic IoNetworkPhysicalState PhysicalState { get; set; }// Returns a string representation of this networkpublic override string ToString()}
public class IoNetworkConfiguration {// Initializes a new instance of the <xref href="UnderAutomation.ABB.Rws.Data.IoNetworkConfiguration" data-throw-if-not-resolved="false"></xref> classpublic IoNetworkConfiguration()// Industrial network address, "-" when the network has no addressingpublic string NetworkAddress { get; set; }// Name of the network, for example "Local"public string NetworkName { get; set; }// Type of the network, for example "Local" or "LOC"public string NetworkType { get; set; }// Returns a string representation of this network configurationpublic override string ToString()}
public enum IoNetworkLogicalState {// The network is startedStarted = 1// The network is stoppedStopped = 2// The logical state could not be determinedUnknown = 0}
public enum IoNetworkPhysicalState {// The network reports an errorError = 3// The network is haltedHalted = 1// The network is initializingInit = 5// The network is runningRunning = 2// The network is starting upStartup = 4// The physical state could not be determinedUnknown = 0}
public enum IoNetworkConfigurationType {// Configure the signals of the networkBits = 0// Configure both the signals and the signal groupsBoth = 2// Configure the signal groups of the networkGroups = 1// Scan the network for connected devicesScan = 3// Configure the devices of the networkUnits = 4}
public enum IoClientAction {// The user should be informed of the configuration resultInfo = 2// Nothing to doNone = 1// The controller has to be restarted for the configuration to take effectRestart = 3// The controller did not report any client action.//// <p>Always returned when connected with version 1, which does not report this information.</p>Unknown = 0}