Hardware-Independent Programming


Maintaining independence between the control algorithm (the schema document) and the hardware configuration (the interface document) promotes program re-use. The same control algorithm can be used again and again in different hardware configurations. If a change needs to be made to the algorithm, only one file--the schema document--needs to be modified. Figure 4.15(a) shows a simple example of a hardware configuration file with one Chameleon PCM-1 module and one Chameleon DAM-1. The two modules are linked to the same schema document meaning that each module will simultaneously execute the same algorithm. In this example, the algorithm simply compares an analog input signal to a threshold and activates a relay when the threshold is exceeded. Figure 4.15(b) shows one view of the schema document linked to the PCM-1 module (the schema background color is light green). Figure 4.15(c) shows another view of the same schema document linked to the DAM-1 module (the schema background color is yellow). If we make a change to the schema document--say increase the threshold value--that change will be immediately reflected in the algorithm's execution by both modules.

 

(b)

 

(a)

(c)


Figure 4.15. Illustration of hardware-independent programming:

(a) Hardware interface document with Chameleon PCM-1 module and Chameleon DAM-1 module;

 (b) schema document linked to PCM-1 module;

(c) same schema document linked to DAM-1 module.


In the Figure 4.15(b) configuration, the Analog Input operator is linked to the PCM-1 module's AIn1 resource, and the Relay operator is linked to the DAM-1 module's Rly1 resource. In the Figure 4.15(c) configuration, the Analog Input operator is linked to the PCM-1 module's Ain2 resource, and the Relay operator is linked to the DAM-1 module's Rly2 resource. This is reflected by the background color of each operator and their respective label.


In the Figure 4.15 configuration, the controller node is monitoring two analog signals and activating two relay outputs, with each module equally sharing the computational burden. The same objective could be achieved with the configuration shown in Figure 4.16. In that implementation, the same I/O points are used but only the PCM-1 module will execute a schema (the DAM-1 module has no schema linked to it). The single schema monitors both inputs, compares to thresholds, and activates the relay outputs. With this arrangement, the entire computational burden of the control algorithm is borne by the PCM-1 module. (Clearly, in this example the computational burden is negligible in either case. The statement is a relative characterization between the two implementations.

(a)

(b)


Figure 4.16. Equivalent implementation of Figure 4.15 implementation

with all computation performed in the PCM-1 module.

The DAM-1 module does not have a schema linked to it.