Offline app development

The tasks described in this section demonstrate the typical workflow for offline app development on your local Workbench installation, using either NiagaraAX Workbench 3.7 (enabled for Sedona TXS-1.2) or Sedona Framework Workbench 1.2.

The examples shown here use a sample app file and platform from the device simulator zip file archive included in the TXS-1.2 bundle. For details, see Sample device simulator platform included in TXS bundle.

The following procedures are described here:

NoteIf you have an app file on hand and have already imported a simulator platform into your Workbench installation, then you can skip to the procedure for Running an app on a simulated device.

If you have imported a device simulator platform but do not yet have an app file, you can use the Sedona - New App tool to create an app to run in the simulator. Begin with the following procedure for Creating a new app in offline mode.

Creating a new app in offline mode

This procedure describes how to use the Sedona - New App tool to create new app in offline mode.

NoteWhen creating a new app using the Sedona - New App tool, you must select the correct Platform Service Type in the last step of the app creation process. If using the sample device simulator platform, the correct platform service type is jennic::JennicRouter.

  1. In Workbench, click ToolsSedona - New App to launch the New App dialog box.

  2. In the New App dialog box, enter the App Name and click Next.

  3. Enter credentials for the app, leave the default Sox port unchanged and click Next.

  4. Select the Platform Service Type and enter the App Device Name and click Finish, as shown below.

    NoteThe PlatformServiceType drop down is populated with a list of available platforms. This list is built from the PAR files which you have imported using the Sedona Installer. The platforms may have been imported as part of a bundle, environment file archives, regular PAR files, or simulator PAR files.

    Figure 12. Creating a new Sedona App


    Creating a new Sedona App


    On completion, the Sedona property sheet for your new app displays.

    Figure 13. Property sheet for new offline app


    Property sheet for new offline app


    Once the app is created, you can further develop the new offline app by configuring components for it, such as adding new points offline or making provisioning changes offline.

Configuring components in an offline app

This procedure provides an example of configuring components in a new offline app. Specifically, making provisioning changes and adding new points while working offline.

Prerequisites:

  • A new offline app file

 

  1. Open a Wire Sheet or Property Sheet view for the app.

  2. Select WindowSide BarsSedona palette

  3. In the Sedona palette, click the Edit App Schema icon to add kits to the palette, such as the control, logic, and math kits.

  4. Drag and drop components from the palette to add them to the wire sheet, as shown below.

    Figure 14. Add components to wire sheet view


    Add components to wire sheet view


  5. Save the modified app file.

Running an app on a simulated device

This procedure describes how to run an app in the Sedona Device Simulator.

Prerequisites:

  • An app file

  • A simulator platform PAR file (containing a simulator SVM with a default scode image and default “bootstrap” app file) already imported to your Workbench installation.  

  1. In Workbench, click ToolsSedona Device Simulator to launch the tool.

    CautionDo NOT attempt to run the vendor’s default “bootstrap” app file in the Sedona Device Simulator. This file is constructed by the platform vendor to provide a basic Sedona app for that platform that, once loaded, is then re-provisioned with your selected Simulator App. If you need a clean App file to start with, create one using the Sedona - New App wizard (for details, see Creating a new app in offline mode).Provisioning the vendor’s default “bootstrap” app with a different app file (containing different properties and possibly different kits), either in the Device Simulator, or through a Sedona Tools connection, and then saving this app using the Stop button, will corrupt the vendor’s default app file and prevent proper operation of the Device Simulator.

  2. In the Device Simulator View, select your app file. Locate your app file by clicking the directory icon (to the right of the Simulator App File field) which displays a standard File Chooser dialog box.

    The Device Simulator determines a list of compatible simulation platforms for the selected app. If only one compatible simulation platform is present, it displays in the Simulator Platform field, as shown below.

    NoteIf multiple compatible simulation platforms are present, then the simulator populates the Simulator Platform field with a drop-down list of options. You can then select a platform to use in the simulation.

    Figure 15. Sedona Device Simulator view with selected Simulator App File and Simulator Platform


    Sedona Device Simulator view with selected Simulator App File and Simulator Platform


  3. In the Device Simulator View, with the Simulator App File and Simulator Platform selected, click Run to start the simulation.

    The SVM Output pane displays information on the app initialization and re-provisioning process. An example of the typical SVM output on completion of the initializing process is shown here.

    Figure 16. Device Simulation Success


    Device Simulation Success


    NoteThe Device Simulator runs in a “sandbox” folder called “sedonaDeviceSim” which is created under your user folder: <niagara-release>/users/<username>/sedonaDeviceSim). The SVM, scode, and app files are copied to this folder and run from this location. The provisioning process writes files to this location.

    Now that the app is successfully initialized and running in the simulator, you can open a Sox connection to the app in the simulated device exactly as you would connect to an ordinary Sedona device running this app, see Connecting to the app running on a simulated device. You might want to make the Sox connection to the simulated device in a separate tab, that way you can easily access the SVM output pane and controls in the Device Simulator.

Connecting to the app running on a simulated device

The procedure describes how to open a direct Sox connection to the app running on a simulated device, in the same manner as you would connect to an ordinary Sedona device running the app.

Prerequisite: An app file must be successfully running in the Device Simulator.

  1. In Workbench, open a direct Sox connection using localhost. Select FileOpenOpen Device.

  2. In the Connect dialog box, for Host IP, enter: localhost. In the User name and Password fields, enter the credentials used in the new app file that you created, and click Finish.

    NoteIf using the sample app from the sample device simulator download, enter these credentials: Username: admin Password: <blank>.

    On completion, you have a direct Sox session connection to the app running in the simulated device, as shown here.

    Figure 17. Open Sox connection to app running in Device Simulator


    Open Sox connection to app running in Device Simulator


Modifying the app running on a simulated device

This procedure provides an example of viewing and modifying the app running on a simulated device. The example shows typical app logic modifications that you can make, such as adding points.

The sample app used here is developed to run on a device that has four leds but currently controls only two of those leds. The example shows steps to add two more digital outputs to control the remaining two leds.

NoteInterim changes to the simulator app are actually applied to a copy of the app file that is running in the Device Simulator’s sandbox area. When you end the simulation using the Stop button, you are prompted about where to save the modified app file. For more information about the sandbox area, see “About the Run process” in the section on Running an app on a simulated device.

Prerequisites:

  • The app must be successfully running in the Device Simulator.

  • A Sox connection exists to the app currently running on the simulated device.  

  1. In the Nav tree under MyHost, expand the Sox device node and the App node. Double-click the JenDbd component to display the wire sheet view, as shown below.

    Figure 18. Modifications to app logic in wire sheet view of app component


    Modifications to app logic in wire sheet view of app component


  2. In the Sedona palette, open the jenDigitalIO palette and drag two DioOut objects to the wire sheet, naming them “led2” and “led3”.

  3. In the wire sheet view, link the And_0 output to the led2 input.

  4. In the wire sheet view, link the And_1 output to the led3 input.

    After making this change, the app lights leds 0 and 2 when And_0 is true, and lights leds 1 and 3 when And_1 is true, as shown.

    Figure 19. Added digital IO controls to the app


    Added digital IO controls to the app


Making provisioning changes to the app running on a simulated device

This procedure provides an example of making provisioning changes in the app running on a simulated device using the Kit Manager provisioning tool under the device to add a kit to the app.

Prerequisites:

  • The app must be successfully running in the Device Simulator.

  • A Sox connection exists to the app currently running on the simulated device.  

To add the jenAnalogIo kit to the app:

  1. In the Nav tree, expand the Sedona Tools node under the Sox device and double-click Kit Manager to launch the provisioning tool.

  2. In the Kit Manager view, click the checkbox to select the jenAnalogIo kit, as shown below, and click Next and Finish.

    Figure 20. Use Kit Manager to add jenAnalogIo kit to the app


    Use Kit Manager to add jenAnalogIo kit to the app


  3. When kit changes have successfully completed, click Restart to start the device.

  4. In the Nav tree, double-click the Sox device node to reconnect to the app running in the Device Simulator.

  5. Access the wire sheet view for the JenDbd component in the app, and in the Sedona palette, open the jenAnalogIo palette, as shown here.

    Figure 21. Added kit provides the jenAnalogIo palette


    Added kit provides the jenAnalogIo palette


    This change makes the palette of Jennic analog input/output controls available for use in app logic modifications.

    When finished making changes to the app running in the Device Simulator, you can stop the simulation and save the modified app to your file system.

Saving the modified simulator app file

This procedure describes how to stop the simulation and save the modified app to your file system.

NoteIf you encountered any problems while working with the simulated device, see the Troubleshooting appendix.