This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

CANNY Lab Functional Diagram Editor

From CANNY Wiki
Revision as of 12:32, 3 October 2016 by MEGA (Talk | contribs) (Named networks)


Jump to: navigation, search

The main operating mode of CannyLab is functional diagram editor.

General description

In the functional diagram editor mode, the user has the opportunity to:

  • Add function blocks to the diagram;
  • move function blocks within the diagram;
  • select and delete diagram elements;
  • add connections to the diagram between the functional blocks - networks;
  • add and edit names of the networks to the diagram;
  • merge, split and change networks configuration;
  • change functional block numbering;
  • assign input data sources and recipients of function block output data, using constant and controller resource address.


The editor provides stepwise undo command of the last action performed by the user - Undo, which is performed after selecting «Edit» → «Undo» of the main menu or by clicking shortcut keys «Ctrl+Z», as well as the command of step by step return to the previously undone action - Redo, which is performed after selecting «Edit» → «Redo» of the main menu or by clicking shortcut keys «Ctrl+Y».

To simplify development of custom diagrams in the editor, user can use clipboard for cutting, copying and pasting fragments of the diagram within the same and between different files. Access to the commands «Cut», «Copy» and «Paste» via the menu «Edit» or, like in other apps, use familiar keyboard shortcuts «Ctrl+X», «Ctrl+C» и «Ctrl+V» accordingly.

Vertical scrolling workspace is performed by using the mouse wheel, cursor keys ↑ ↓, keys PageUp, PageDown or the vertical scroll bar, horisontal — cursor keys ← →, rotating the mouse wheel while pressing «Alt» or by using a horizontal scrollbar.

To change quickly the image scale, rotate the mouse wheel while holding down «Ctrl».

To quickly move through the the diagram field, the user can also use the method «Drag-and-Drop», by pressing and holding the middle mouse button (wheel) and moving editor's workspace using random mouse movements, while the mouse pointer changes from an arrow to an image of clenched hand.

Adding functional blocks to the diagram

Adding a new functional block to the diagram creates a new instance of the functional block type you have selected. Addition can be accomplished in two ways:

  • highlight a block by clicking the left mouse button in the functional blocks panel, then right click in the working area of the diagram, and select from the shortcut menu

4 6 1 1.png;

  • press and hold down the left mouse button on the block in the functional blocks panel, «drag and drop» it in the diagram editor workspace then release the left mouse button. During dragging, a block image will be added to the cursor icon.

For example:

4_6_1_2.png   - the mouse cursor, adding a block "Logical AND":

Moving functional blocks

Moving functional blocks located in the diagram editor workspace is performed by "dragging": highlight a block, located in the diagram workspace by clicking the left mouse button (when you select the background color of the block turns yellow), and holding down the mouse button, move the mouse pointer. To complete block relocation, release the left mouse button. In the same way, you can exercise a simultaneous relocation of multiple elements on the diagram by group highlighting.

Selecting elements of functional diagram

Select multiple items on the diagram is by "frame" - click the left mouse button on the diagram area free from elements and dragging the mouse without releasing the left button, until all the elements to be captured are selected. Even a partial hit of a diagram element by the "frame" will lead to its selection.

4 6 3 1.png

Selecting multiple objects can also be performed using the method of highlighting with the mouse pointer while holding down the «Ctrl» key . Pressing again the left mouse button on the selected element by holding down the «Ctrl» button will lead to its exclusion from selected group.

Clear block selection by clicking the left mouse button on an area of diagram workspace free from elements.

Deleting functional diagram elements

Removing functional blocks or diagram networks by highlighting object or group of objects to be deleted, and pressing the «Delete» key on the keyboard, or by selecting «Delete» from context menu, by pressing the right mouse button on the selected diagram element.

Creating a connection line

Create a new connecting line on the functional diagram:

  • from the output of one to the input of the same or another function block;
  • from the output of one to the output of the same or another function block;
  • from the input or output to the functional block to already existing line;
  • from constant output to function block input or output or to an existing line.

In addition, starting the construction of the line, it is possible to end it at any point free of the diagram elements setting the final node, thus forming "unconnected" line.

To begin building a connection line, it is necessary to hover the mouse pointer to the point of the expected start of the line, press and release the left mouse button.

4 6 5 1.png

After the start of mouse pointer moving on the editor working area, it will begin drawing connecting line, automatically adding line turn, depending on the current position of the mouse pointer.

4 6 5 2.png

Adding a line node (kink point) or end line at the point of its final connection by clicking the left mouse button.

4 6 5 3.png

4 6 5 4.png

Break the line at an arbitrary point on the diagram by double clicking the left mouse button at this point, to cancel the line building - by pressing the Esc button.

Unfinished line ends with "intellectual" arrow that points in one direction or another depending on the position of the line on the plane and whether the line is a source or receiver of data (also applies to the named networks).

4 6 5 5.png

Modifying connection line

Modifying position and shape of the connecting line by its "drag and drop" at its straight sections.

To modify the connecting line, it is necessary to move the mouse pointer to the area requiring changes, press the left mouse button and holding it down, move the pointer to a new location, let go of the left mouse button.

4 6 6 1.png

It is possible to finish building unconnected lines - continue their creation from the final node.

4 6 6 4.png

For line branching, click on the desired node and continue to build the line from a given point.

4 6 6 5.png

Segments and networks of connecting lines

When implementing the algorithm in the form of a functional diagram, the usual practice is to link the output of one function block with multiple functional blocks inputs, including their own inputs, thus forming branched connecting lines on the diagram. The connecting line having a zero or more branches on the functional diagram shall henceforth call network segment. The illustration below shows the two segments.

Note: In accordance with the agreement adopted in the CFD language, any output of the function block can be connected to a single network with multiple inputs of other blocks, or their own, but there is no input of the function block can be connected to multiple outputs. Despite the fact that the diagram editor allows you to make such connection, when you try to save, entries in the controller or running in the simulator such diagrams, CannyLab displays an error message.

4 6 7 1.png

By clicking the left mouse button on the connection line belonging to any segment, entire segment will be highlighted.

4 6 7 2.png

Segment removal is to analogically remove any other element of the functional diagram.

Named networks

For the working convenience with large functional diagrams, the editor provides creation of named networks: the user, at their discretion, may assign to this or that segment its own name. Visually not connected segments with the same name will be logically combined, as if they were connected visually and represented a single segment. This connection shall call the network. The network of connecting lines may consist one or more segments.

4 6 8 1.png

Using named networks can reduce the total length and the number of intersections of the connection lines on the diagram, visually isolate groups of blocks related to one function. This will increase the readability of the diagram.

Assigning network's own name may be accomplished by double-clicking the left mouse button when pointing to a network to be named or by selecting "Rename" from context menu.

4 6 8 2.png - break the segment, removing the section between the nearest nodes;
- set a new network name on the diagram;
- cut the selected element or multiple segments;
- copy the selected element or multiple segments;
- paste the copied or cut segment or segments;
- delete the selected element or multiple segments.

After specifying the network name in the context menu associated with it added the item 'Show Net Name' , the choice of which, at the current point to the diagram adds another inscription with the name of the network. If the network name is used in several places on the diagram, then in the context menu optionally appears items «Rename entire network» and «Select entire network».

4 6 8 3.png 4 6 8 4.png

Specify the name of the network is performed by using the dialog box, in the text field of which you can enter a new name, or select from a previously defined, in the current network segment. Renaming the entire network can be done similarly.

4 6 8 5.png

Functional blocks identification numbers

Function blocks have unique identification numbers, which are assigned to the block when it is added to the diagram. The new block is assigned to the first available number in the range of numbers from one to the maximum number present on the block diagram, plus one.

The identification number of the block is stored in the diagram file and remains unchanged on subsequent calls to the file.

To re-order block numbers at any time, use the option «Tools »→« Renumber blocks» of the main menu, after selecting which blocks to be renumbered in accordance with the order of execution, in the current diagram state.

Constants

The numerical constants can be used as inputs for function blocks.

Add a new constant to the diagram can be accomplished in the following ways:

  • right click in the working area of the diagram and select from the context menu
4 6 10 10.png;
  • press and hold down the left mouse button on the element "Constant" in the functional block panel, «drag&drop» it in the workspace of the diagram editor and release the left mouse button. During dragging the corresponding icon will be added to the cursor: 4 6 10 11.png.

Alternatively, a constant can be added directly to the free input of any function block.

To define constants, first change the input data source of the function block by selecting «Constant» in the context menu, a call of which is made when you hover the cursor on the block output, and pressing the right mouse button.

4 6 10 1.png

After that,block input appearance will change to display the associated constant. By default, the value of the newly added constant is zero.

4 6 10 2.png

Change the value of a constant using the context menu by pressing the right mouse button on the constant.

4 6 10 3.png

«Enter value» - the user can select a constant numerical value via a dialog box. The entered values can be in decimal, hexadecimal, binary, or symbolic form. The display of the value entered on the diagram will be performed in the selected format.

4 6 10 4.png 4 6 10 5.png

4 6 10 6.png 4 6 10 7.png

Decimal value can be set 1..5-digit number in the range from 0 to 65535, hexadecimal - 1..4-digit number in the range from 0 to FFFF (allowed to enter characters in upper or lower case), binary - 1..16-digit number ranging from 0 to 1111111111111111, as symbol - a symbol of the main ASCII table.

Note: When entering the character values allowed to use special characters in the following format: «\n» - ASCII character code 0x0A (newline), «\r» - ASCII character code 0x0D (carriage return), «\t» - ASCII character code 0x09 (horizontal tab), «\0» - ASCII character code 0x00 (null), «\xYY» any character, where YY – its ASCII code in hexadecimal format.

When user changes the constant display format, the current value will be automatically converted into the selected numbering system.

For configuration and operation of the controller resources, it is necessary to use special named constant, access to their list by selecting the item from constant pop-up menu. Selecting the named constant is performed in the dialog box.

Named constants are presented in a tree view and grouped by purpose.

4 6 10 8.png

When choosing a named constant as the block input value, the abbreviated name will be displayed instead of the value on the diagram.

4 6 10 9.png

Quick access to the list of named constants can be obtained by using double-clicking the left mouse button on the field of constant, while holding down the «Ctrl» key.

Note: Despite the fact that each of the named constants has a definite numerical value, the use of named constants other than the controller associated resource is not desirable to configure and use, since it is difficult to read and understand the diagram.

Registers

Access to the controller hardware resources from the functional diagrams performed by reference to specific registers (addresses) in memory of the controller, which shows status of its resources and receiving data to control these resources. Registers are divided into read-only or write-only.

Adding a new read or write register on diagram can be accomplished in the following ways:

  • right click in the working diagram area and select from the shortcut menu
4 6 11 6.png;
  • press and hold down the left mouse button on the element "Read Register" or "Write Register" within the functional block panel, «drag & drop» it in the workspace of the diagram editor and release the left mouse button. During dragging the icon will be added to the cursor to display the element to be added.

For example, adding read register: 4 6 11 7.png

In addition, the register can be added directly to the free input or output of any function block, clicking the right mouse button and selecting the required option from the context menu.

4 6 11 8.png

After selecting the register as a source or a data receiver, a dialog box opens in which the list of registers available for selection, grouped by functionality.

Unlike the constant register, this can not be entered manually.

4 6 11 3.png

When choosing a register, its abbreviated name will be displayed on the diagram.

4 6 11 4.png

4 6 11 5.png

Note: According to CFD language agreement, the use of the same write register in several places of the diagram is not allowed. Despite the fact that the editor allows to duplicate write registers on the diagram, when trying to save, load to controller or run in the simulation of such a diagram, CannyLab will display an error message.

According to access method, the registers are divided into reading and writing register. The read register can be a source of data for other diagram elements, and the write register - data receiver.