Texts and Snippets for Many Instances of Custom Widget

We are developing a bunch of custom widgets for a system. A good example would be a generic valve in a system that requires 50 instances of it. We want to be able to display the state of the valve, ie “Opening, Open, Closing, Closed” using the Text System for localization.

I am aware of Indexed Text Snippets to achieve this. However, it is not apparent how we might scale this method to the 50 instances of the widget without a bunch of copy-paste-type work.

1 Like

Can someone help @Ben?

Hi @Ben

One idea I have is to pass through an OPC-UA variable the TMX path to display in a TextOutput inside of the compound widget. TextOuput can be use to display Localized text.

I think that you are using Structure binding to pass all informations about your valve to the compound widget ?
Like this you just have to manage in PLC this TMX path as a string variable.

Here an example :
Assuming ValveHmi variable is a structure (“ValveInfoType”) dedicated to 1 valve and for compound widget of valve.

Plc code

IF Valve.Openning THEN
    ValveHmi.StatusTmx := "$$IAT/ValveStatus/Openning"
ELSIF Valve.OpenTHEN
    ValveHmi.StatusTmx := "$$IAT/ValveStatus/Open"
ELSIF Valve.Closing THEN
    ValveHmi.StatusTmx := "$$IAT/ValveStatus/Closing "
ELSIF Valve.Close THEN
    ValveHmi.StatusTmx := "$$IAT/ValveStatus/Close "
ELSE
    ValveHmi.StatusTmx := "$$IAT/ValveStatus/Undefined"
END_IF;

Compound widget

    <Widgets>
		<Widget xsi:type="widgets.brease.TextOutput" id="Status" top="0" left="0" width="320" zIndex="15" />
	</Widgets>
	<Properties>
		<Property xsi:type="StructureBindableProperty" name="ValveInfo" type="ValveInfoType" readOnly="true" >
			<Description>Structure of valve informations</Description>
			<Mappings>
				<Mapping widget="Status" type="String" property="value" mode="oneWay" memberPath="StatusTmx" mapToNode="false"/>
			</Mappings>
		</Property>
	</Properties>

Now just activate your structure variable in OPC-UA server and create a binding on the variable directly on the property on the compound widget “ValveInfo”

Here is help about structure binding : B&R Online Help
Here is help about TextOutput : B&R Online Help

Hope that can help,
If needed I can create a sample project. Feel free to ask :slight_smile:

Regards,
Florent

1 Like

Hi Ben, is it solution for you?

Thank you @florent.boissadier and @kovarj. This looks aligned with what we want to accomplish. We will try this out and let you know if other questions arise.

2 Likes