Skill Level: Beginner

Leverage the Watson Factory & Virtual Device Simulator nodes to build a Simulator, that simulates Elevator operations. Consolidate the data on Watson IoT Platform for real time monitoring and analytic's. Node-RED defines ease of IoT Solution Development


Software Requirements


More than 256MB RAM might be required to deploy this application. If the memory usage exceeds 256MB in the free trial accounts (Bluemix Trial Account and Standard Account), the application might not work as expected.

We suggest that you upgrade to Pay-as-You-Go or Subscription account to enjoy the full-range Bluemix services.


  1. Introduction

    How we wish, to have the real world scenarios, simulated on a local setup, that helps understand the environment, the implications of changes / modifications and measure the impact of success with optimizations done against the simulated model.

    The Watson Factory &¬†Virtual Device Simulator nodes that are available on the npm site, can be used either in full or in sub-set, to simulate most of the IoT deployments from the real world scenarios. Elevator is on such case, where in, the operations of the Elevator, including it’s movement, values for parameters associated with Elevator, options to control them remotely through a dashboard and monitoring experience for n number of Elevators, are something, that suits use-cases in multple verticals.

    The relevant Elevator Simulator Node-RED Flow is made available on the Github repository.

  2. Deploy the Elevator Simulator on Bluemix

    This reipe showcases, how you can create an Elevator Simulator (either in Autonomous or Manual mode), all of it using Node-RED nodes on a Node-RED editor, customizing it, as per the need.

    Click on the Create Toolchain button provided below, to quickly deploy the Elevator Simulator against your Bluemix account and have an up and running Elevator or a set of Elevators, that simulate a working environment, generating operational data and have them sent to the Watson IoT Platform, for real time monitoring, perform analytics and ensure predictive maintenance.


    Note: If you are a User using the United Kingdom Region in your Bluemix environment, then please make use of the following Deploy to Bluemix button, to deploy the setup under your United Kingdom Region. Users of US South Region can ignore this step.


    Post deployment, the Elevator Simulator application provides you with the Node-RED editor that has the flow and the user interface in the form of Elevator Dashboard.

    Access the Elevator Simulator Node-RED Editor using the following URL


    Access the Elevator Simulator User Interface (Dashboard) using the following URL


    The Node-RED flow has two sections, Elevator Behavior Simulator in the first half and then the Elevator User Interface in the second half. The Elevator Behavior simulates Start and Stop options, the Maintenance scenario and configuration of various States of an Elevator during its operational period. The UI helps achieve the Look & Feel of the Elevator Dashboad .

    The user interface which is provided by the Elevator Dashboard, helps you to monitor the operational data for various parameters, for the Elevator of choice, providing you with control options to define thresholds and actually control the behavior using sliders & switches.

  3. Exploring the Dashboard of Simulated Elevator

    The Elevator Simulator, once deployed using the above mentioned Deploy button, would have a look & feel on the UI, similar to the one, shown below.


    The UI, has the following set of sections, that needs to be concentrated on:

    • Instance: Allows you to choose the Elevator of choice, from the configured list of Elevators, using the drop down menu.
    • Simulation Config: The set of configuration parameters whose values are simulated and indicate the current value, for those parameters.
    • Floors Panel: The panel provides you with option to choose between Autonomous & Manual simulation of the floors for the Elevator. It also lists the number of floors that the Elevator works with, where calls to a given floor can be made.
    • Elevator Control: Allows you to dynamically set / alter the values for critical and priority parameters, that are imminent for smooth functioning of the Elevator.
    • Elevator Properties: Provides you with Gauge’s and data values for the parameters during the functioning of the Elevator. These values are also presented on the WIoTP Dashboard, for respective Elevator chosen.

    Refer to Section #7 – Discussing the control points on the Elevator Dashboard, in this recipe, for detailed description on the control options available on the Elevator Dashboard.

    Now that, we are aware of the use case and familiarized briefly with the Elevator Dashboard, let us go ahead and work on deploying, configuring and constructing the simulated operational model of the Elevator.

  4. Prepare the environment

    Post the successful deployment of the Elevator Simulator, on to the Bluemix platform, there are couple of minor preparatory steps, that needs to be taken care off.

    Access the Node-RED Flow

    As the deployment of the Elevator Simulator concludes successfully in Section #2, you would have noticed View Your App button. Click on it, to access the Elevator Simulator application. Alternatively, you can always access the Application from the application service available on Bluemix Dashboard.

    The Elevator Simulator Node-RED flow gets loaded on to the Node-RED editor, by default, when the application starts for the first time. Just in case, if the flow doesn’t get loaded or that, at times, you have accidentally got the flow deleted or corrupted, you can import the flow from This Location on Github.

    Configure Elevator(s) on to the Watson IoT Platform

    Considering the fact that, the operational data from the Elevator are being uploaded to Watson IoT Platform, we need to create a connection between the Device and the Platform. Hence, we need to first register the Elevator and initiate connectivity.

    The Elevator(s) need to be registered as a registered Device(s) on the Watson IoT Platform. The Watson IoT Platform service is available as a binded service to the Elevator Simulator Sample application, deployed earlier. You should find the service bearing the name iotf-service.

    Carry out the step present in this recipe to only generate API Key and it’s corresponding Auth-Token. Note them down as need them to register the Elevator to Watson IoT Platform, during the scope of this recipe.

    Register Elevator(s): Refer to the Elevator Behavior Simulator Node-RED flow. Closely examine the snippet Start 10 Elevators at the beginning of the flow.


    Double click on the Set Organization ID function node, to edit it and update the value with your Org Id, as shown below

    flow.set("orgid", "abcdef");
    return msg;

    Similarly, double click on the HTTP Request node (Send to Watson IoT Platform node), check the check box Use basic authentication and update Username & Password with API Key & Authentication Token, respectively.


    Once the changes have been saved, go ahead and click on DEPLOY button, at the top right corner of the editor, to deploy the settings. This action would register the Elevator(s) on to the WIoTP. Alternatively, you can click on Start Elevators to initiate the process.

    Note: The Node-RED flow is designed in such a way that, everytime you Deploy the flow, it tries to register the Elevator(s) to the WIoTP. And hence, there’s every chance that you might get to see the following message. So, do not be bothered, when you get to see this message on the debug console

    {"message":"CUDRS0020E: The organization abcdef already has a device of type Elevator and id Elevator08.","exception":{"id":"CUDRS0020E","properties":["abcdef","Elevator","Elevator08"]}}

    The Elevator, which should now be available as a registered Device on WIoTP, would have an entry, similar to the one shown below, under the Devices heading:


  5. Understanding the Elevator Behavior Simulator Flow

    Now that you have imported the requisite Node-RED flow in the previous section Import the Node-RED Flow, let us go ahead and understand the flow, as we kick start the Elevator Operations, through to the completion.

    Start Elevator: Refer to the Elevator Behavior Simulator Node-RED flow. The Inject node triggers the execution of the Start Virtual Device node ( Start Elevator node in green color), which is basically responsible to kick start simulating the Elevator Operations using the Device Function node (Do Initial Settings node).


    Send Device Events: Unless the Elevator is in Maintenance mode, i.e stopped for maintenance activity, it sends the device events to the Watson IoT Platofrm, at every 2 second interval.


    Maintenance Mode: When the elevator gets a “Maintenance {stop: true}” command, it will send a “MaintenanceStop” event, open the door and stop for 10 minutes or until a “Maintenance {stop: false}” command will arrive.


    Various other States: Idle, Moving, Stopping, Loading, Curtain of Light Break are various other states, you will find the Elevator to be in, unless it is not in the Maintenance mode.

    Stop Elevator: The Inject node here helps stop the Elevator Operations by disconnecting the conection between the Elevtor Simulator and the Device entry on the WIoTP dashboard. No further events are transmitted to the WIoTP dashboard.


    As you click on the Inject node, you should get to see the message Device Elevator1 deleted and subsequently, another message Device Elevator1 is off, on the debug console, indicating that the Stop operation was successful. The entries repeat for the remaining set of Elevators.

  6. Defining the Schema for Elevator Simulator

    The previous section helped you understand on how the Elevator Simulator works, in a controlled environment. Now, let us try to understand further on defining the schema, that helps set up the parameters involved in Elevator Operations.

    The Inject node triggers the execution of the Start Virtual Device node ( Start Elevator node in green color), which is basically responsible to kick start simulating the Elevator Operations.The Schema for the properties or parameters to be participating in the Elevator Simulator, are defined here.

    The Start Elevator action simulates the operational environment of the Elevator and thus generates operational event data for close to 22 parameters and device events. Motor Temperature, Cabin Temperature, Cabin Speed, Load, Direction, Number of Floors, Current Floor, Maintenance Stop, Door Open, Cleanliness of Floor, Curtain of Light Break, etc are some parameters, to name a few.


    To add an additional parameter or a set of parameters or edit existing set of defined paramters, you need to edit the Virtual Device node. To do so, double click on the node. The entry against the Device Schema, will have the current schema listed. Click on the Edit button available next to it, to edit the existing set of parameters or add new ones, as shown in the image below:


    Now, as you scroll through the properties, you get to see the 22 parameters, whose schema is already defined. Edit the parameter Name, option to Generate Random Value and choice of Default Value, as per your requirement.

    Should you choose to ADD a new parameter or a set of parameters, click on +add button, as shown in the following image and have them added to the current schema.


    Click on Done, when you are finished.

    The Device Function node (Do Initial Settings node in lavender color) helps write a function to randomize the values for various parameters that are associated with Elevator. A snippet of code is shown below to simulate the Motor Temperature value, where in, the value is randomized between the Maximum Motor Temperature and Minimum Motor Temperature, as configured.

    //Set bad MotorTemp (15% likelihood)
    var outOfNormalRange = Math.random() * 100 < 15;
    maxMotorTemp = Math.floor(Math.random() * (220 - 185 + 1)) + 185;
    return msg;

    IBM IoT In & Out Nodes: These are the pair of nodes used for connecting Elevator Simulator to Watson IoT Platform. The Elevator simulator uses these nodes to send commands to the Device and receive device events from the Elevator, respectively.

    In the Node-RED flow provided, the IBM IoT App is tied up with the Watson IoT Platform binded with the deployed application. Should you choose to use a different Watson IoT Platform, then, double click on the IBM IoT App and then choose API Key as the value for Authentication, as against Bluemix Service.

    Note: You can alternatively make use of the WIoTP Out Node, to capture the Device Events, as shared by each of the Elevaotr, individually, on the WIoTP Dashboard. Here, you would have to create one WIoTP Out node for each of the registered Elevator.

  7. Discussing the control points on the Elevator Dashboard

    Of the five different panels that are available on the Elevator Dashboard, two are of primary importance, that allows for dynamic configuration of thresholds and values of various parameters. The mentioned two panels or Floor Panel & the Elevator Control Panel.

    • Floors Panel: The panel provides you with option to choose between Autonomous & Manual simulation of the floors for the Elevator. Under Autonomous choice, the floors are chosen randomly for Elevator movement by the simulator, and it is not, in Manual choice. The panel also lists the number of floors that the Elevator works with. You can make a request for the Elevator by pressing any number between 0 to 6 and then can randomize the destination floor.
    • Elevator Control: Allows you to dynamically set / alter the values for critical and priority parameters, that are imminent for smooth functioning of the Elevator. As you work through the Sliders and Switches, to¬† dynamically configure the parameters listed under the Elevator Control panel, keep an eye on the parameter values in the Simulation Config & Elevator Properties panels, including the Gauge map.
      • Sliders: Slide the pointer on the Slider, to simulate and alter the value for the following set of parameters, that influence the behavior and help achieve the intended outcome. Move the pointer to the right hand side to increase the value and to the left hand side, to decrease the same.
        • Motor Temperature: The value is randomized between the defined Maximum and Minimum Motor Temperature. Slide the pointer to set it to the value in Fahrenheit. Confirm the changes made by you, by observing the Gauge map on the Elevator Properties panel.
        • Cabin Temperature: Allows you to set the Cabin Temperature in Fahrenheit, for the chosen Elevator. Take a look at the Gauge map to ensure that the changes are being reflected.
        • Load: Increase or decrease the load on the Elevator. This load is listed in Kilograms (Kg).
        • Maximum Motor Temperature: Based on the industry studies and practices followed, for now, the Maximum Motor Temperature, as been set to 220. However, the default value is 180.
        • Minimum Motor Temperature: The value can be reduced to as low as 100 degree fahrenheit, with 140 set to being default. Plan to change the values of Max and Mix, as needed.
        • Curtain of Light Break Rate: The default value is set to 10. Choose to use the slider to climb up to the value of 20.
      • Switches: Toggle the Switch to turn on and turn off, for the given set of parameters, to enforce the Elevator and have it respond to a particular behavior
        • Force Open Door: To mimic the scenarios of Maintenance operations, you can choose to turn on the switch. The value is Off by default.
        • Maintenance Stop: You can choose to force stop the Elevator for Maintenance operation, by choosing to enable this switch. The value is Off by default.

    Now that, we are familiar with the control options, let us go ahead and further understand the behavior of the Elevator, in terms of the States, that it can operate.

  8. Understanding various states of the Elevator

    As the Elevator gets operational, it is bound to be found in one of the States, as mentioned below:

    States of Elevator: The Start Elevator node also parallelly triggers or invokes another Device Function node bearing the name Random Max Motor Temperature, which in turn ensures that the Elevator is in, one of the states, as shown in the following image:


    • Idle State: The Elevator is scheduled to stay in Idle State, when the last remaining person has exited out of the Elevator. It also continues to stay in Idle State, when no requests are made to the Elevator. Also, the Elevator stays in the Idle State post the Maintenance schedule.
    • Moving State: The Elevator is found to be in Moving State, either when a request is made for the Elevator or when a person or people have specified the destination floor.
    • Stopped State: The Elevator is found to be in Stopped State, when a person or people are exiting out of the Elevator, post the Moving State.
    • Loading State: The Loading State provides the window, where in, a person or people are allowed to get into the Elevator and intiate request, that gets the Elevator into the Moving State.
    • Curtain of Light Break: The term Curtain of Light refers to the scenario where a set of sensors look out for obstructions before completely closing the doors of the Elevator. Post the Loading State, the doors of the Elevator are scheduled to close. If there are people still passing in & out of the Elevator, or obstruct the closure of the door by waving the hand, object or anything similar of choice, then, Curtain of Light Break occurs and the Elevator continues to stay in the Loading State, till the Elevator resumes the closing of the doors.
    • Maintenance Stop: In scenarios where certain parameters of the Elevator, fall or go beyond the accepted range, in case of occurence of unscheduled and unintended events and in case of scheduled maintenance intervals, the Elevator gets into the Maintenance Mode. It continues to stay in the mode for the defined period and once the period elapses, the Elevator now gets into the Idle State.

    Tweak the number of seconds, the Elevator is scheduled to stay in each of the States, as per your need and requirement, by inducing appropriate values against the Delay node.

  9. Understanding the Elevator User Interface Flow

    Moving to the second half of the Elevator Simulator Node-RED flow, i.e the Elevator User Interface, let us try to understand, how the various States of the Elevator and other parameters whose random generated values, shape the UI and it’s behavior.

    The choice of content that you wish to see on the Elevator Dashboard, needs to be configured, in this section of the Node-RED flow. A flow snippet needs to be constructed for each of the option / action that you wish to visualize on the Dashboard, as shown in the Image, below:


    Let us take the illustration of Loading State, where a person or people are getting into the Elevator. The Device Listener node (bearing the name On Load Change) gets triggered when there is a change in the load value, for the given Elevator. The updated value is then passed on and is fed to the UI Slider node (bearing the name Load). Once the slider is set to the updated value, it is then set against the chosen Elevator, using the Set Properties node (bearing the name Set Load).

    The remaining set of parameters, designed to be listed on UI, are configured in the similar manner. Together they form the consolidated flow, and shape up the Elevator Dashboard.

    The above mentioned flow helps define, what needs to be seen on the UI / Dashboard. To help enable on how you should see these parameters on the UI, use the Dashboard tab in the Node-RED console, to set the order of appearance, as shown below:


    You are now comfortable with the understanding of the Node-RED flow, to tweak the Elevator Simulator Behavior as well design the Dashboard, as per the requirment or need of the hour.

  10. Deploy the Setup

    You now have modified the configuration or altered the default specifications, values of the Elevator Simulator, in the  imported Node-RED flow. Go ahead and DEPLOY the configurations on the Node-RED editor.


    A successful deployment should be indicated by a message. Open the browser tab, where you have the User Interface (Elevator Dashboard) showing up the simulated data on it’s screen. Choose the Elevator of choice to see the data for that particular Elevator, by default simulated data for Eelvator01 shall be shown on the screen.

    Use the drop down menu within the Instance section of the Elevator Dashboard, to toggle between the listed Elevators and obtain real time data from them.

    Note: If you have chosen to use WIoTP nodes against the default IBM IoT nodes used here, you can parallely verify the real time data, which would be made available on the WIoTP Dashboard, against the respective device.

  11. Data Visualization on WIoTP

    The BOARDS and CARDS, as available on the Watson IoT Platform Dashboard, enhances the User’s Visualization experience, in terms of visualizing the Device status & data, Usage & Consumption patterns, Analytics based on Rules & Device specific metrics, etc.

    Now that you are able to get the Elevator data on to the Elevator Dashboard as well on to the Watson IoT Platform, you can plan to visualize the data on WIoTP using the Boards & Cards, as shown below:


    Refer to the IoT Recipes Configuring Boards & Cards in the new Watson IoT Dashboard and Device List Card SIMPLIFIES Real Time Device Monitoring on WIoTP Dashboard, to further understand on BOARDS & CARDS and the ease of use.

  12. Conclusion

    Elevator Simulator is only a variant, opening up options to go farther and beyond, to make use of the Watson Factory & Virtual Device Simulator nodes, in addition to the available Node-RED nodes, to model and simulate most of the real world IoT scenarios, irrespective of the market vertical.

    The relevant Elevator Simulator Node-RED Flow is made available on the Github repository. The possibilities to re-use the Elevator Simulator, with little or no modifications and to further enhance the setup, can be done with utmost ease, to suit to the needs.

  13. Way Forward?

    As mentioned earlier, Elevator Simulator is only a variant and you can definitely plan to use the following set of Recipes that are made available, to further enhance the mentioned IoT scenario, by including one or more analytic characteristics.

    The Recipe showcases how one can perform real time analytics, on the data event of choice, by just setting up the Rules as part of Cloud Analytics, to trigger an action when the rule conditions are met.



    The Recipe makes use of IBM Openwhisk service to demonstrate Event-driven computing using a Serverless Architecture.




2 comments on"Simulate an Elevator - All using Node-RED nodes"

  1. Thanks. It is very good starting material for real-time application of IoT.

Join The Discussion