System Designer Workshop

Estimated time: 5–10 minutes

[info] Prerequisites

Sign up for a plan here: https://niolabs.com/pricing.

This tutorial introduces you to the nio System Designer and the fundamental concepts of building a nio project, including how to create systems, instances, services, and blocks.


Create system

Inside a nio system, diverse sensors, compute devices, and UIs can communicate with each other in real time to achieve a common goal.

  1. Navigate to the System Designer.
  2. Click the add new system card on the screen.
  3. Enter a system name.
  4. From the template dropdown, select your desired template.
  5. Your new system will launch.
  6. If you selected something other than the blank template, you'll see your template's instance(s) in the left navigation.

 

Way to go! You just created a system to hold projects that you will build in these tutorials. Your screen has switched to the system context where you will see an add instance button on the left and the breadcrumb at the top.

The next step is to create a cloud instance within your newly created system.


Create instance

An instance is an installation of nio that you are running. It is possible to have multiple instances (both cloud and local) running in a system and multiple services in an instance.

A cloud instance runs a version of nio that is installed in the cloud and managed by niolabs.

You can create a cloud instance named Tutorials to hold the services that you will create in your tutorials:

  1. From within your system, click add instance.
  2. Complete the add instance window.
    1. Check the cloud instance checkbox.
    2. In the instance name box, enter Tutorials.
    3. Click accept.
 

Alright! You just created a nio cloud instance. Your contextual toolbar now shows you the instance context where you can view and edit your instance. You can create multiple services for your tutorials within this cloud instance.


Create service

A service is a real-time process that runs in an instance. It is a collection of blocks organized like a flowchart that perform a service.

This short video shows you how to create a service:

Create a simple two-block simulate-and-log service that will generate a signal and log it to the logger panel.

  1. In your instance's top nav, click create new service.
  2. Complete the create new service window.
    1. In the service name box, enter simulate-and-log.
    2. Click accept.

 

You’re cruising now! You just created your first service. Notice that the block library appeared on the right side of your canvas and your contextual toolbar shows the service context where you can edit, save, and start and stop your service. The service will hold the logic created by a workflow of blocks.


Add blocks

The blocks are the units that do the work inside a service.

For a quick overview of building services with blocks, watch this video:

Our simulate-and-log service needs two blocks:

  • The CounterIntervalSimulator block to simulate and emit a signal at a specified interval.
  • The Logger block to log each incoming signal to the logger panel.

These two blocks are the foundation of nearly every service you will build with nio. The first block of every service either simulates or subscribes to data and the last block sends that data somewhere. This example generates signals with a simulator block and then sends those signals to the logger panel where you can see the results.

Add and name your CounterIntervalSimulator block:

  1. In the block library search box, enter CounterIntervalSimulator.
  2. Drag the CounterIntervalSimulator block type to the canvas.
  3. In the window that pops up enter Simulate in the name input and click accept.

Add and name your Logger block:

  1. In the block library search box, enter Logger.
  2. Drag the Logger block type to the canvas.
  3. Click accept to accept the default configuration for the block.

Way to go! You are now familiar with how to add blocks to your nio service! The first block simulates data and the second block logs that data to the logger panel.


Connect blocks

To do their work, the two blocks on your canvas need to communicate. In nio, signals are passed between blocks via their terminals. A terminal is shown as a blue circle on the top or bottom of a block. Signals are emitted from an output terminal on the bottom of a block and received by an input terminal on top of a block. The lines connecting the terminals configure the route the signals will take. Once a list of signals is emitted from one block, the next block(s) in the route will receive it.

  1. Click and drag the output terminal of the Simulate block and release the connector on the input terminal of the Logger block.
  2. Click anywhere on the canvas to ensure you have deselected the blocks and returned to the service context.
  3. Click save on the contextual toolbar to save your service with its new block connections.

Now that you connected the two blocks, your service is fully functional.

[info] Disconnecting Blocks

To disconnect two blocks, click the input terminal of the receiving block, then drag and release the connector anywhere on the canvas.


Run service

Start your service to see the simulated signals log to the logger panel.

  1. Click start () on the contextual toolbar.

  2. Click open logger panel to view the logs of the signal created by the counter interval simulator.

Congratulations! You just learned the basics of using nio with the System Designer.


Summary

You created a signal in one block and sent it to another block to be logged and visualized.

To nio, all data is a signal whether it is received from a simulator, an API, a sensor, or a database. You just need to select the appropriate block to access your particular data source. Integrating a new data source is as simple as dragging a new block to your canvas.

Similarly, the logger screen is just one place to send the output of a service, but signals can be sent many other places by using different blocks. For example, if you want to see outputs in a tweet, add and configure the TwitterPost block, if you want to receive outputs in a text message, add and configure a TwilioSMS block. You can use a Publisher block to send your signals to a different service or a database block to send your signals to a database.

You can browse all of the available nio Blocks at https://blocks.n.io.

Feel free to make more services by connecting blocks to perform various tasks on your own.


 

proceed to virtual plant workshop »
 

results matching ""

    No results matching ""