Step 5: implementing a simple type translator – Echelon NodeBuilder FX/PL Examples User Manual
Page 30
22
Using the NodeBuilder FX/PL Example
24. Browse the Analog Output 1 and Analog Input 2 functional blocks using the LonMaker
Browser. Verify that an update to the nviAnalogOutput network variable on Analog Output 1
gets reflected in the nvoAnalogInput network variable on Analog Input 2. Allow a generous
conversion error—the Gizmo 4 I/O Board has a 10-bit ADC and an 8-bit DAC converter that are
daisy-chained, which causes conversion errors to be multiplied. Also verify correct operation by
changing the cpUpdateRate configuration property value, disabling one or more functional
blocks in the loop.
Step 5: Implementing a Simple Type Translator
You can create a simple user-defined functional profile (UFPTtranslator) that translates an input
network variable of type SNVT_temp_p into an output network variable of type SNVT_lev_percent.
This enables you to connect a temperature sensor functional block to the analog output functional
blocks on this example device. For more information about the resource editor, see the NodeBuilder
Resource Editor User’s Guide.
In this step, you will use the NodeBuilder Resource Editor to create the UFPTtranslator functional
profile, which is a basic implementation of a very simple UFPT. You will implement a number of
improvements in the design of this UFPT in Step 6: Enhancing the Type Translator.
1. Click the NodeBuilder tool Taskbar button in the Taskbar to return to the NodeBuilder tool.
Right-click the NcExample device template and select Code Wizard from the shortcut menu.
The Code Wizard opens.
2. In the Resource pane on the left side of the Code Wizard, expand the NcExample functional
profile template below the LonWorks\NeuronC\Examples\NodeBuilder LTM-10A\Types
folder. The UFPTtranslator functional profile template is displayed.
3. Right-click
the
UFPTtranslator functional profile and select Open from the shortcut menu. The
Modify Resource File Set dialog opens.
4. In the Available Types pane on the left side of this dialog, expand the
C:\LonWorks\Types\Standard resource file set folder, and browse to the SNVT_lev_percent
network variable type. Drag this network variable type to the UFPTtranslator functional
profile’s Mandatory NVs folder in the Functional Profile pane in the center of the dialog. The
network variable will be added to the Mandatory NVs folder with the name nviManNV1.
5. Repeat step 4 but add a SNVT_temp_p network variable to the UFPTtranslator functional
profile’s Mandatory NVs folder. The new network variable will be named nviManNV2.
6. Click
nviManNV1 (the SNVT_lev_percent type network variable added in step 4). The Member
Details pane on the right side of the dialog displays the network variable properties. Change
Name to nvoPercentage and set Output to indicate that it is an output network variable.
7. Repeat step 6 for nviManNV2 (the SNVT_temp_p type network variable added in step 5).
Change Name to nviTempP, set Input to indicate that it is an input network variable, and set
Principal NV to make this the functional profile’s principal network variable.
8. Click
OK.
9. In the Program Interface pane on the right side of the Code Wizard, right-click the device
template’s Functional Blocks folder and add a single UFPTtranslator functional block to the
device. Set User-defined and set Scope to 3 in the Add Functional Block dialog to access the
new resource file set.
10. Click OK. Click Generate and Close to generate code and exit the Code Wizard.
11. Build the development target. To do this, right click the Development target, and then click Build
on the shortcut menu. The LonMaker tool automatically loads the new application into the device
hardware.
12. Add the Translator functional block to the LonMaker drawing.