Connecting Many Variables at Once
Introduction
The purpose of this example is to demonstrate how a CDPPort object can be used as proxy to bulk connect multiple variables of an object in CDP Studio, similar to PLC STRUCT input/output variables allowing simplified multi-value connections. CDP Studio, is an independent automation software for open PC based real-time distributed control systems.
In this example, CDPPort and PushConnection are used to get values from target Sine object and push the values to Application local variables.
Note: The names given to the PushConnections are used to map to target object value names like Output, Offset, etc. to the local variables the PushConnections in CDPPort are connected to.
The advantage of using a single CDPPort instead of connecting many signals, properties or other nodes separately, is that it will be easy to swap out the remote node. For example a component aggregating values from different sensors could be swapped out for a component that simulates all sensor values for testing purposes and this can be done by modifying only a single Routing property.
How to Run the Example
To run the example from CDP Studio, open Welcome mode and find it under Examples. Next, in Configure mode right-click on the system project and select Run & Connect. See the Running the Example Project tutorial for more information.
Project Overview
This example includes:
- A GUI which allows changing CDPPort Routing property between "App.Sine1" and "App.Sine2".
- Two Sine components (named Sine1 and Sine2). For demonstration purposes they generate a sine signal but have different Amplitude, Frequency and Offset parameters.
- The application has one configuration only CDPPort which bulk connects the app Output signal and some parameters to either Sine1 or Sine2 (depending on the choice made in GUI). The app Output signal and the parameters are visualized by the GUI.
After running the project, a GUI appears. The widgets are all routed to signals and properties of App which are bulk connected using CDPPort to either "App.Sine1" or "App.Sine2". The combo box widget allows to change which Routing is active.
Note: Similar behavior can be achieved by using the Routing Replacement Widget if the purpose is to only switch the view in the GUI application.
The bulk connected objects GUI displays are listed in Configure mode.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.