Creating a Custom LON App

You can write a custom application (app) that runs on the SmartServer platform.  You can write a custom app in C, C++, or node.js and then upload it to your SmartServer.  You can upload your internal app to one or many SmartServers.  Your custom app can exclusively use IAP/MQ to communicate with other IAP services and drivers.  The xxx describes how to create a custom app for the SmartServer.

Custom apps use IAP to interact with other applications and services in the SmartServer.  Optionally, your app can also implement a LON interface.  This can be useful for interfacing with other LON applications such as IzoT CT or applications based on the IzoT Net Server or an LNS Server.  For example, your custom app can provide a LON interface to a Modbus meter attached to the SmartServer so that the meter can be monitored by an LNS application.  This type of application is typically used for energy monitoring applications such as projects deployed in accordance with the US Army Corps of Engineers (USACE) specifications.

This section describes how to create an example LON app that monitors the SNVT_hvac_status outputs of all attached VAV controllers.  This application evaluates the cooling_output demand for each VAV controller, and ramps up the discharge air duct static pressure set point if the cooling demand exceeds 95%.  As the cooling demand falls below 85%, the duct static pressure set point is decreased to reduce energy used by the air handler.  This application implements a LON interface to support interaction with a discharge air controller connected to the LON network. 

To follow this example clone or download this git repository (https://github.com/izot/smartserver-iot.git).  The example files are in the folder "./apps/DSP SP Controller Example".

This example was designed to use simulation applications running on the FT 6000 Evaluation board included with the IzoT FT 6000 EVK.  To prepare for this exercise, go to this page: Setting up an Internal Application Program Example Network

  1. Create a user-defined function profile template (UFPTs) for your Internal App using the IzoT Resource editor.  Go to: Defining a User Profile or Data Types

  2. Create the DRF/xml files needed for any custom resource file set using the report generator in the IzoT Resource editor.  Go to:  Defining a User Profile or Data Types

  3. Create the Device Interface (XIF) file for a Device that represents the LON interface for your internal LON application.  Go to:  Creating an XIF for an Internal LON App

  4. Use the SmartServer CMS to Import types and commission devices in the simulated VAV space comfort control application.  Go to:  Building and Managing the Example Network

  5. Create the Internal App using the appropriate IAP API.  Most internal LON device applications will operate using the IAP/MQ API to subscribe to LON data events, and publish datapoint updates in response to input data events. Go to:  This section takes you step by step through a Node.js application implementing an internal LON device.  Internal LON Device Application in Node.js

Caution: When creating an Internal App or service you want to install on your SmartServer, it should install in a sub directory below the /var/apollo directory to make sure the files are preserved after a system upgrade.

Caution: Do not to create any infinite loops in your application; use timers for periodic processing.  The SmartServer doesn't check whether any applications are using excessive CPU bandwidth.