Floor Plan Tutorial

Tutorial Overview

This tutorial guides a developer through lessons to create a floor plan client in the VANTIQ system. It uses simulated data to display residents moving in a two-story building. The lessons include definition of a resident data type, generation of simulated motion data, and the definition of a floor plan client to display the data.

All lessons assume the developer has a working knowledge of VANTIQ Modelo. It is recommended that a new developer completes the lessons in the Introductory Tutorial before starting the lessons in this tutorial.

1: Creating a Floor Plan Project

The first task in learning about the VANTIQ floor plan widget is to create a project in VANTIQ Modelo to assemble all the client components.

Use the Projects button, select Create New Project and title the project “FloorPlan”:

        IMProject

The rest of the lessons take place inside this Modelo project.

2: Creating a Data Type

The simulation data for this example needs to be stored in the VANTIQ database so that it can be used to drive the floor plan client widget. You must create a data type to specify the data associated with each simulated building resident.

Use the Add button to select Type…:

        AddType

Use the New Type button to create the resident type:

        CreateResident

The Resident type contains three properties:

While the location property is defined as GeoJSON, the values of the property are not latitude and longitude values for floor plan purposes. Specifically, the coordinates property of the GeoJSON object will contain the X and Y coordinate offsets from the upper-left corner of the floor plan image you’ll define in the next lesson. The longitude coordinate property is the X offset coordinate and the latitude coordinate is the Y offset coordinate.

Once these three user properties are defined, use the Save button to save the Resident type and add it to the Modelo project.

3: Simulating Resident Data

Now that you’ve created the resident data type, use Modelo to simulate residents changing location in a two-floor building. This lesson uses the Modelo’s Data Generator feature to simulate resident data streams.

Use the Show button to select Data Generators.

        DataGenTab

Use the Create New icon button (small plus sign in a circle at the top, right of the Data Generators pane) to create our engine temperature sensor generator:

        TempStream

Name the data generator “Resident”. Select the Resident Data Type since you want to create a stream of motion for building residents. Enter 20 as the Number of Inserts and 1000 as the Frequency. These properties cause the data generator to create 20 resident motion points, each separated by one second (1000ms).

Enter %Eone:two% as the floor. This instructs the data generator to define two values, “one” and “two”, which represent each floor of the building. Make sure you select Random from the Variation menu, which instructs the generator to select from the two floor values at random. (For more information about the options available for data generation, please read the Data Entry Options section at the bottom of the Data Generation definition page.)

Enter {"type":"Point","coordinates":[10,10]} as the location. This defines a single GeoJSON record with X and Y offsets each set to 10. In this simple example, the resident will always be located 10 feet from both the upper and left sides of the floor. In a real-world scenario, the coordinates might be provided by motion sensor readings or signal strength readings from wireless access points. Leave the default None choice selected from the Variation menu.

Enter %Ealice:bob:carol% as the name. This instructs the data generator to define three residents, “alice”, “bob” and “carol”. Make sure you select Step from the Variation menu which instructs the data generator to step through the three residents sequentially when creating motion points.

You now have a data generator ready to stream 20 resident motion points to the VANTIQ database. Use the Save button to save the generator and return to the Modelo project.

4: Visualizing a Running System

This lesson uses Modelo’s Client Builder feature to create a visual representation of two floors of a building and moves residents around those floors.

Use the Add button to select Client…, then use the New Client button to display the Client Builder:

        NewCB

Rename the client by using the Properties button, then changing the default name (“MyClient”) to “Resident” then use the OK button to save the name change.

Drag and drop two Floor Plan widgets and two Label widgets to the canvas area below the widget palette to create a Client Builder layout similar to this:

        CB

We’ll get to configuring each widget later so don’t worry about the exact appearance of the widgets yet.

Now that the Client Builder widgets appear in the canvas, we need to create a Data Stream to feed live data for display in the widgets. A Data Stream defines from where a client widget receives its data. The Floor Plan widgets want to display location values, which are found in the Resident records which are generated from the simulated data in Lesson 3.

Use the Data Streams button, then the New Data Stream button in the Client Builder to define a new Data Stream. The Create New Data Stream dialog is displayed:

        CreateDataModel

Name the Data Stream “Resident”, select On Data Changed, select Resident from the type menu, and check the Insert checkbox. In addition, the Floor Plan widget makes use of the Group By feature to differentiate residents on each floor of the floor plan. The example uses the resident name (select name (String) from the Group By pull-down) since it is used to uniquely differentiate residents on each floor of the floor plan. Use the Save button to save the new data stream.

There are two display widgets and two label widgets in the diagram above. What follows are the properties for each of those widgets. Any property not mentioned is the default value for that widget. To display the property sheet for any widget, click on the widget. For example, here is the property sheet for the First Floor floor plan:

        FPProperties

Floor Plan widgets rely on four properties to be set:

For the First Floor Floor Plan widget (left):

 Data Stream: Resident
 Data Stream Property: location
 Label Property: name
 Filter Properties: {"floor":"one"}

For the Second Floor Floor Plan widget (right):

 Data Stream: Resident
 Data Stream Property: location
 Label Property: name
 Filter Properties: {"floor":"two"}

For the label widgets (above each Floor Plan widget):

 Text: the corresponding floor number
 Font Size: 20

When you have finished adding and configuring your client widgets, use the Save button to save the client and return to Modelo. The Floor Plan widgets are bound to a data stream and will automatically display data received from the defined data stream. The next lesson uses the Data Generator created in Lesson 3 to produce simulated resident data and run your client. You will not see any simulated data displayed in the client until the next lesson.

5: Running the Simulation

The last lesson of this tutorial is to start the data generator and observe the output from the VANTIQ system in real-time.

Click the Client: Resident oval in the Project Resource Graph to display the Client Builder, then use the Run icon button of the Client: Resident pane (small triangle in a square at the top, right of the pane).

        PRG

To begin the test, check the checkbox next to the Resident menu item, then use the Run icon button of the Data Generators pane (small triangle in a square at the top, right of the pane):

        DataGenTab

As the generator inserts simulated resident motion data in the VANTIQ database, colored markers will appear on the two image map images:

        RunningVis

In this simple example, a resident will always be located 10 feet from both the upper and left sides of the floor. In a real-world scenario, the coordinates might be provided by motion sensor readings or signal strength readings from wireless access points which move the resident markers in a more realistic manner.

The data generators will run out of data points in 20 seconds and the Data Generator pane will end the generation run.