MVPL (Microsoft Visual Programming Language

From Bauman National Library
This page was last modified on 1 June 2016, at 17:05.
MVPL
Paradigm visual, modular
Designed by Microsoft
First appeared 1973
Typing discipline stati
License Various types
Website www.microsoft.com/robotics/

In computing, a visual programming language (VPL) is any programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually. A VPL allows programming with visual expressions, spatial arrangements of text and graphic symbols, used either as elements of syntax or secondary notation. For example, many VPLs (known as dataflow or diagrammatic programming) are based on the idea of "boxes and arrows", where boxes or other screen objects are treated as entities, connected by arrows, lines or arcs which represent relations.

Definition

VPLs may be further classified, according to the type and extent of visual expression used, into icon-based languages, form-based languages, and diagram languages. Visual programming environments provide graphical or iconic elements which can be manipulated by users in an interactive way according to some specific spatial grammar for program construction.

Visual languages

The following contains a list of visual programming languages.

Educational

Multimedia

  • Blender (software), the open source 3D graphics package, includes a "node editor" to create shading programs as graphs. Also, custom nodes allows create systems as sverchok, blendgraph or other
  • OpenMusic, a visual programming language for music composition
  • Scala Multimedia Authoring suite and complete multimedia system for AmigaOS and Windows

Video games

  • Unreal EngineUnreal Engine 4] has a node-based visual programming language called Blueprints
  • Kodu, a software designed to program games with a 3D Interface developed by Microsoft Research
  • RedWire uses an electronics metaphor of chips being wired together to execute game code.

Systems / simulation

  • EICASLAB, a software suite including a graphical language for supporting the design of control architectures
  • Microsoft Visual Programming Language, dataflow language for robotics programming
  • VisSim, modeling and simulation language, allows making mathematical models quickly and executing them in real-time

Automation

  • CiMPLE, Visual Programming Language by ThinkLABs for teaching robotics
  • PLUS+1 GUIDE, a graphical programming environment from Sauer-Danfoss typically used for off-highway machines
  • Pipeline Pilot is a scientific visual and dataflow programming language

Data warehousing/ business intelligence

Miscellaneous

  • Lava (programming language) is an experimental, visual object-oriented, interpreter-based programming language
  • Yahoo! Pipes is an visual data-flow programming system to process web data
  • YAWL, graphical workflow language

MVPL Introduction

Microsoft Visual Programming Language (MVPL) is an application development environment designed on a graphical dataflow-based programming model. Rather than series of imperative commands sequentially executed, a dataflow program is more like a series of workers on an assembly line, who do their assigned task as the materials arrive. As a result MVPL is well suited to programming a variety of concurrent or distributed processing scenarios.

MVPL is targeted for beginner programmers with a basic understanding of concepts like variables and logic. However, MVPL is not limited to novices. The programming language may appeal to more advanced programmers for rapid prototyping or code development. As a result, MVPL may appeal to a wide audience of users including students, enthusiasts/hobbyists, as well as possibly web developers and professional programmers.

Sample Microsoft VPL diagram

A MVPL dataflow consists of a connected sequence of activities represented as blocks with inputs and outputs that can be connected to other activity blocks.

Activity blocks have connections that represent messages sent from one activity to another

Activities can represent dataflow control or processing functions, pre-built DSS services or your own defined activities you create in MVPL. The connections between activities pass data as messages. The resulting application is therefore often referred to as dataflow orchestration, the coordination of information between a connected set of processes.

Activities can also include constructions of other of activities. This makes it possible to compose your own activities by combining existing ones and then reuse the composition as a building block. In this sense an application built in MVPL is itself an activity. An activity block typically includes the activity’s name and its connection points. An activity block may also include graphics to illustrate the purpose of the activity or user interface elements like text boxes that may enable the user to enter values, assignments, or transformations for data used in an activity.

Connections invoke actions such as SayText

Activities are connected through connection pins. A connection pin on the left side of an activity represents the connection point for incoming/input messages and a pin on the right represents the connection point for outgoing/output messages. An activity receives messages containing data through its input connection pins. An activity’s input pins are connection points to its predefined internal functions known as actions or handlers. These can be either as functions provided by a service or nested dataflows. An activity block activates and processes the incoming message data as soon it receives a valid incoming message. All data sent to the activity is consumed by the activity. For data to be forwarded through the activity’s output, the receiving activity must replicate the data and put it on its output connection. An activity may have multiple input connection pins, each with its own set of output connection pins. Input pins are represented as arrows pointing into the block. Output connection pins can be one of two kinds: result output (also called a response output) or notification output (sometimes also referred to as an event or publication output). Result output pins are displayed as arrows pointing out of the block while notification outputs display as round connection pins.

Connection pins

A response output connection pin is used in situations where the outgoing message data is sent as the result of a specific incoming action (or request) message. Notification connection pins can send information resulting from an incoming message, but more typically send a message as a result of an internal change to their state. Output pins can be connected to input pins on more than one other activity. Response and notification output connections also differ in how they deliver message data. Since a response connection requires an incoming message, once that request is received and processed and resulting message is sent, it is finished. However, notification outputs can generate messages multiple times. As a result, response connections are typically used to query the current state of an activity, whereas notification output pins are used for providing continuous updates on an activity's state, eliminating the need to repeatedly request or poll for the state of an activity. The activity defines which types of connections which are provided.

Microsoft Robotics Developer Studio

Microsoft Robotics Developer Studio (Microsoft RDS, MRDS) is a Windows-based environment for robot control and simulation. It is aimed at academic, hobbyist, and commercial developers and handles a wide variety of robot hardware. It requires the Microsoft Windows 7 operating system. There are four main components in RDS:

  • CCR (Concurrency and Coordination Runtime)
  • DSS (Decentralized Software Services)
  • VPL (Visual Programming Language)
  • VSE (Visual Simulation Environment)

The tools that allow to develop an MRDS application contain a graphical environment (Microsoft Visual Programming Language : VPL) command line tools allow you to deal with Visual Studio projects (VS Express version is enough) in C#, and 3D simulation tools.

Getting Started

Start Microsoft Visual Program Language (VPL) from the Start menu. When VPL loads, you will see a window with a set of menus, toolboxes, and a tabbed diagram page as shown in the following screenshot.

Start screen

VPL is a dataflow programming language, where you create a program by defining a graph or diagram of activities (blocks that represent DSS services or other functions) linked together using connections that define how data will flow between the activities. One or more diagrams constitute what is called a program in other languages, although in VPL it is usually referred to as a project. You build a diagram in the main workspace in the center of the screenshot above with the tab labeled Diagram. When you open a new project, VPL creates this default diagram for you but you can add more diagrams if you wish. Messages flow along the connections between activities and can carry data or simply act to control the logical flow of the diagram. In VPL, data/control flows can happen in parallel because the underlying DSS runtime provides support for asynchronous execution.

The VPL User Interface

The VPL window displays a menu bar and toolbar for accessing commands and a central area to compose your diagram as well as several subwindows including toolboxes that display the list of built-in dataflow activities and the available services (pre-written code that performs functions) that can be used in your project diagrams; the current contents of your project (its diagrams and configuration files); and a section for editing properties of selected items. The toolboxes, project window, and properties windows are movable and collapsible, and can be rearranged within the main VPL window. You can also have multiple diagrams within the one VPL program that can be accessed as separate tabs across the top of the diagram section. You can also selectively hide or redisplay a hidden toolbox window using the Toolboxes command on the View menu. So if you inadvertently close a toolbox by clicking on the 'X' in the top right-hand corner of the title bar, you can always get it back again. To begin a dataflow diagram, you drag and drop a dataflow activity or service from the Basic Activities or Services toolboxes to the diagram window (tabbed page). You can also add a new activity by double clicking its Toolbox menu entry. Hovering over a Toolbox entry with the pointer displays a Tooltip that includes a description of how the activity or service can be used. If the item also includes an "i" (Information) icon, the item also provides additional information. Clicking on the Information icon opens a web browser to display the page for that item. Once you have several blocks on the diagram, you connect them by clicking on the output connection pin of one block (on the right-hand side) and dragging to the input connection pin of the another block (on the left-hand side). Many connections require additional information, so this is covered later in Connecting Activities. You can cut, copy, paste, or delete activities by selecting the block in the diagram using the Edit menu commands or the Activities Pop-Up Context Menu.

The Basic Activities toolbox window

The Basic Activities toolbox window includes activity blocks for defining data (Data), controlling dataflow (If and Switch), combining messages (Join and Merge), performing calculations (Calculate) and storing results in variables (Variable). Also included is a Comment activity that allows you to place text comment blocks on the diagram. VPL also includes an activity block that allows you to create your own custom activities. Custom activities can accept information, process it, and output a result. So effectively you might think of a custom activity as a subroutine if you are familiar with other programming languages. If you want to perform the same series of steps in several places in your diagram, then a custom activity is an easy way to write the code only once and re-use it multiple times. Custom Activities are discussed in the Creating and Editing Activities section of this Guide.

The Services toolbox window

The Services toolbox displays the available services. The services included may depend on those that were installed when you installed VPL. The list can be expanded by adding DSS services to you installation's "bin" folder.

The services displayed in this window also depend on the contents of the Services toolbox's Find Service text box that appears at the top of the list. Entering text here causes only those services with that text to appear in the window. The filter looks for matches in both the display name of the service as well as its description text. A blank filter box displays all services. To clear the Find Service filter, click the 'X' in the text box. You can also modify the display by entering multiple words, separated with spaces, and the list will display all services with any of those words. Adding a plus (+) before a word causes the filter to display only those services where that word also occurs. Placing a minus (-) before a word removes the display of any entries that include that word. You can use filters to organize the list of services, by creating a filter section. To create a filter section click the '+' (plus) on the right side of the All Found heading (displayed just below the Find Service text box). This creates a new heading section in the Services toolbox window using the words selected as the search filter and the results of the filter under it.

Diagrams window

As you can see in the screenshot above, the first diagram in a project is always called Diagram. For a simple program, you will probably just use this default diagram. You can create new diagrams from the File menu by selecting Add Diagram. Adding diagrams is a way to break your project into modular pieces to keep it more manageable. Diagrams run in parallel. When you create a new diagram a new tabbed page appears within the VPL window. You can then add activities and services to this new diagram. To switch to an existing diagram, click on its tab. To close the current view of a diagram, click the Close button (the 'X') on the diagram's tab. This does not delete the diagram from your project. To redisplay a diagram that you have closed or to delete or rename a diagram, see the following section on the Project window.

The Project window

The Project window displays a list of the diagrams and configuration files included in your project. To redisplay a diagram, display the Context Pop-up Menu of the diagram in the list and choose Open, or double-click its name in the Project window. If the diagram's name is not currently visible, you may need to expand the Diagrams entry to view the list of diagrams. To add more diagrams to the project, display the Context Pop-Up Menu for the Diagrams entry and click Add Diagram. Alternatively, you can select Add Diagram from the File menu. Every time that you add a new diagram, its name will be Diagram, or if this is already used VPL will add a number to the end to make it unique, e.g. Diagram0, Diagram1. To change the name of a diagram, click on its entry in the Project window and edit its name in the Properties window. Names can only contain letters, numbers and the underscore (_) character. They must always begin with a letter. Try to give your diagrams meaningful names that will help you to remember what they do. To delete a diagram, display the Context Pop-Up menu by right-clicking on the diagram's name in the Project window and then clicking Delete.

The Properties window

The Properties window displays the properties for the currently selected item. This allows you to configure an activity (including services) connection or diagram. To change the properties for an activity, select the activity by clicking it and its properties will appear in the Properties window.

The Errors window

While you are working in VPL you might occassionally make a mistake, forget to set a property or to make a connection. When this happens VPL will place a red exclamation mark on the activity that has an error. This error checking happens in the background, so you might not see errors immediately

Inline error mark

To see all of the errors in the entire project, you can use the Errors window. The Errors window is not displayed by default. You have to select it from the menu by checking View \ Toolboxes \ Errors. Note that there are some errors that are not flagged by icons on the activity blocks and the only way you will see them is to look in the Errors window.

Errors window

Basic Activities

The Microsoft Visual Programming Language (VPL) includes a set of basic activities that are used to help create a dataflow program. These blocks are typically used to connect between service blocks, but can also be connected together.

Activity

The Activity block, sometimes referred to as a Custom Activity, allows you to create your own activities that can each have their own set of internal dataflow diagrams. You can use these to create diagrams that can be represented as single blocks in other diagrams and are used in the same way as the built-in activities. These custom activities can also be compiled into services that can be used with other services or in other VPL diagrams.

Basic Activity

Calculate

he Calculate activity performs simple arithmetic or logical operations on the expression entered into the textbox. The expression can include numeric values, the value from the incoming message, its data members, or predetermined values provided by other services on your diagram.

Calculate

For numeric data you can use:

+ add
- subtract/minus
* multiply
/ divide
 % mod (The modulus operation returns the remainder after a division)

The plus (+) operator can also be used to concatenate, combine, strings. This can also be used to combine text, string, and numeric data by using double quotes, e.g. The answer is + x/4. For logical operators you can use:

&& AND
|| OR
! NOT

You can also use parenthesis to support precedence (the order of evaluation) of the expression entered. Clicking in the textbox of the Calculate block displays a list including the value of the incoming message, any data members in the message, the state variables, as well as predefined values that may be provided by other services.

Comment

The Comment activity enables you to add a block of text to a diagram for documentation purposes. It is good practise to add comments to your code to assist other people to understand the program and also to aid your own memory if you have to change the program at a later date. Enter the text of the comment in the textbox. The Comment block does not support any connections. You can place it anywhere on the diagram. You can collapse a comment by clicking on the arrow at the right-hand side of its title bar.

Comment

Data

The Data activity is used to supply a simple data value to another activity or service. To define a specific kind of data, select its type from the drop-down under the textbox, then enter a value into the textbox. Note that if you add a string value you do not need to enclose it in quotation marks.

Data

If

The If activity provides a choice of outputs to forward the incoming message to based on a test condition that you enter. If the condition is true, the the incoming message (with its data) is forwarded to the first outgoing connection (the top pin). If it is false (i.e. not true), then the Else output is used. The conditional expression can use the following operators for evaluation:

= or == equals
 != or <> not equals
< less than
> greater than
<= less than or equals
>= greater than or equals

You can also use the same operators in the Calculate activity, provided that the entire statement will evaluate to true or false. You can add conditions to the If activity by clicking the Add (+) button on the activity block. Each new condition has its own output pin. So you can have several different conditional expressions in the one If block. Conditions are evaluated from top to bottom and the first one to have a result of true will be used.

If

Join

The Join activity combines the flow from two (or more) dataflows. It is significantly different from Merge in that the data in the messages from the incoming connections is combined and messages must be received on all incoming connections before the activity passes on the data. The text the you enter into the text boxes here are names of the local variables that represent the messages. You can use the variables directly or use dot notation to reference a data member. For example, value.field refers to the data member called "field" in the variable called "value". One use for a Join is to construct a complex data type that is required as input to an operation on a service. Several different messages can provided the data members and the final result is sent to the service in a single message.

Join

List

The List activity creates an empty list of data items. To create a list, select the data type for the items from the drop-down list of choices on the Activity block, or in the Properties view. To add entries to the list, use the List Functions activity. To store a list for use elsewhere in your diagram, create a list variable using the Variable activity.

List

List Functions

The List Functions activity enables you to modify an existing list. Use the drop-down list on the block to select what function you want to apply to a list.

List functions

Merge

The Merge activity simply merges the flow of two or more dataflows together. There is no condition or dependency on the other branch(es) on when messages are passed along. The activity’s role is simply to pass the messages along to the next activity.

Merge

Switch

The Switch activity can be used to route messages based on the whether the incoming message matches the expression entered into the text box. You can add Case branches (match values) to the activity block by clicking the Add (+) button on the activity block. The Switch is similar to an If, but the test condition checks whether the incoming data value matches (is equal to) each of the values in the text boxes. So the text boxes only contain values. On the other hand, an If can have completely different test conditions for each output pin.

Switch

Variable

The Variable activity enables you to set or get the value of a variable. To choose a variable select it from the drop-down list displayed by clicking on the down-arrow button at the right-hand end of the text box.

Variable data types include integers (int), double precision floating-point numbers (double), strings of characters (string), types of Lists, etc. See Data Types[1]

Hello World

The classic introduction for most programming languages is a programme that displays the words "Hello World". This is easily accomplished in Microsoft Visual Programming Language (VPL) using two activity blocks, a Data block and the Simple Dialog block. This tutorial is provided in the Microsoft Visual Programming Language (VPL) language. You can find the project files for this tutorial at the following location under the Microsoft Robotics Developer Studio installation folder: Sample location Samples\VPLTutorials\Tutorial1

Create a Hello Word Diagram

To run VPL, from the Start menu choose All Programs and then click on Visual Programming Language under the Microsoft Robotics Developer Studio installation folder.

From the File menu click New to create a new project. Insert a Data activity, by double-clicking on the icon or draggging and dropping it from the Basic Activities toolbox. Choose string from the drop-down list. Click in the text box of the Data activity block and type Hello World.

Data Activity Block

Insert a Simple Dialog activity block by dragging one from the Services toolbox and place it to the right of the Data activity block. (To save time looking for a service, you can type the name of the service you are looking for into the top of the Services toolbox. The toolbox will then display any matching activities.) Drag a link starting from the output connection pin of the Data activity block onto the Simple Dialog activity block. The Connections dialog box automatically opens. Choose DataValue in the first list and AlertDialog in the second list, then click OK.

Connections Dialog Box

The Data Connections dialog box opens next. In the drop-down list, choose value.

Data Connections Dialog Box

The Data Connections dialog box tells VPL that you want to apply the value of the Data activity to the message text for the Alert form of this dialog. Your diagram should now look like the following.

Completed Diagram

Now choose the Run command from the Run menu (or press F5). If you have not saved your project yet, VPL opens the Save dialog. Enter a name for your project and click Save. VPL should now run your application. If you get a message asking whether to unblock the application, choose Unblock. A simple Alert dialog box should appear with the text Hello World in it.

Alert Dialog

To stop the application, click the Stop button in the Run dialog. If you need further examples, please refer to [2]

References:

  1. MVPL Data Types, for the full list..
  2. Samples and Tutorials, page

External links

  1. https://msdn.microsoft.com/en-us/library/bb483088.aspx