Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Translated from Spanish to English - www.onlinedoctranslator.

com

MyOpenLab

Ttreatment ofdatos
Version 2.4.8.3

User documentation

www.MyOpenLab.de

Prof. José Manuel Ruiz Gutiérrez

1
Index

1. Introduction

2. Data Types in MyOpenLab


2.1. “Double” type data
2.2. “integer” type data
23. “string” type data
2.4. Data Type “bowl” (boolean-digital).

2.5. Data Type “var”.


2.6. Data Type “grp” (group).
2.7. Data Type “font” (letter font).
2.8. Data Type “col” (color)
2.9. Data Type “img” Image
2.10. 1D array of values

2.11. 2D Value Arrays


3. Double, integer and string type conversions
4. Considerations related to the visualization of data in the
“Display Panel”.
5. Establishment of format for “double” type data.
6. Find out the length of a string “length”
7. Extract elements from a string “Substring”
8. Add the elements of two strings
9. Registration of data in memory.

2
FORMATS AND DATA PROCESSING WITH
MyOpenLab

1. Introduction.

In this section we are going to study the different types of data that the MyOpenLab
application can handle and their conversion methods.

The nature of the data and its conversions is essential in a simulation


environment.
MyOpenLab has two libraries that address data conversions and their
processing.

First of all, it is worth keeping in mind that the component window shows the
input and output data and its nature in any of the MyOpenLab components.
This also applies to new function blocks that we can create.

Figure 1

In figure 1 we see the data of the Ellipse component of the canvas library and the data
of the VM MUA component created by us.

2. Types of Data in MyOpenLab.

In the application we can find the following types of data:

• Double (dbl)
• Integer (int)
• String (str)
• Boolean (bowl)
• Var (var)
• Cluster (grp)
• Fountain (font)
• Color (cabbage)

• 1D Value Arrays

3
• 2D Value Arrays

In the design of the circuits, the inputs and outputs of the different elements
are colored with a color code that allows us to know at all times what type of
data is in a given function block.

Figure 2 shows an image with the codes.

Figure 2

2.1. “Double” type data

Double data types are considered to have two decimal places by default. In the case of
providing data with more decimals, rounding will occur when displaying the data,
although it will be stored with its decimals and will operate with all of them:

Example

Entered Data Accepted Data

12,342 12.34

12,348 12.35

2.2. “integer” type data

4
Integer types are integer numeric variables. Its use in creating models will be
in those cases in which it does not make sense to talk about decimals, for
example in a pulse counter.

The maximum length supported by the simulator is +/- 999999999

Display more than two decimal places.

In the event that we want to display more than two decimal places in a “Numeric Output”
object, it will be enough for us to change the value of the “Format” field in the properties
window. Figure 3

Figure 3

23. “string” type data

This type of data consists of any text string that incorporates letters, numbers, and
signs.

Examples of this type would be:

As23.89qs
_f_765^4.gg
MyOpenLab

2.4. Data Type “bowl” (boolean-digital).

These data are those that belong to the digital systems and operators, which as we
know are elements “0” and “1”.

5
The element belonging to the Operators library
digital is used for setting one component to
entry of a zero or 1 will suffice
set F(false)=0 or T(True)=1. Figure 4.

Figure 4
Below are the input and output elements used in the Display Panel for this
data type.

Entrance Exit

2.5. Data Type “var”.

Certain MyOpenLab blocks have the possibility of accepting different types of data,
producing an adaptation of the operator to the inputs. In these blocks, their inputs
and/or outputs are marked as type““var.”

In figure 5 we see an example of this type of variables, specifically in the


comparator library block.“greater than"

Let's take a simple example in which we use a comparison function.

6
Figure 5

We see that in the case of the Boolean data comparator its inputs are of the “bol” type
and in the case of the analog variables it is of the “double” type.

2.6. Data Type “grp” (group).

This type of data is a set of data that is transferred from one block to another and that
in a packaged form is made up of a number of individual data.

As an example of this type of data we have: The concentrator element used to


include several objects in a Canvas area, the output of a Frequency Generator Block
in which the necessary data is packaged to be able to visualize the signal it
generates, the input of an Oscilloscope to visualize signals.

Figure 6

The signals that are part of these groups are treated together, that is, the signals
cannot be removed and processed independently, at least in the current version of
MyOpenLab.

In Figure 7 below we see a simple example that uses this type of grouped
data. It involves displaying a mathematical function that is entered using a
text entry box in a MathCalc type block.

7
Figure 7

2.7. Data Type “font” (letter font).

“Font” type data refers, as its name indicates, to fonts. This data is used for
those functional blocks that use fonts, such as the Canvas object.

In figure 8 we see how this type of data is introduced to the Show Text block in a
Canvas area.

Figure 8

The selection of the font is made in the properties menu of the Font
element As seen in figure 9

8
Figure 9

By clicking on the button The Source window is displayed from which we select the
type, size and appearance of the font.

2.8. Data Type “col” (color).

The “col” data types refer to the color selection that through them we can
enter in a block that requires this type of data. In figure 8 we see that the
canvas block is also passed data of this nature.

Figure 10

9
Figure 11

When we select color in the properties menu of the Color object, a color
palette is displayed from which we select the color we want. Figure 11.

It is important to note that the color variable can be decomposed into three numbers that
correspond to the RGB heats of the mixture. This is done with the “Color to RGB” block. In
figure 12 we see how the color is decomposed giving the three values.

Figure 12

9.1. Data Type “img” Image

This type of data actually responds to an image that can be recovered from a
file type (JPG, GIF, PNG, etc.).

Most of the functions presented within the library“Image”of the Panel


Circuitor handle this type of data. In figure 13 we see some of these
functions.

10
Figure 13

MyOpenLab is capable of carrying out interesting operations with images, which is


why in terms of graphics it acquires great importance within the modeling and
simulation tools.

There are also function blocks belonging to the library of output elements of
the“Display Panel “that work with “img” type data. In figure 14 we see some.

Figure 14

In Figure 15 we see a simple application that loads three image files and
displays them in the display panel.

eleven
Figure 15

It should be noted that images can be processed by using the image


processing blocks shown in the previous figures. Treating the image means
acting on its conditions and qualities. We see an example below (figure 16) in
which an image has been collected and processed using the blocks

“Gray Scale” and “Smooth”.

Figure 16

9.2. 1D array of values

12
Certain MyOpenLab blocks generate an Array of 1D type values in their
outputs, as is the case of the blocks used to generate signals.

Figure 17

In reality, what you do in this block is create a table of values that are then collected
by a graph plotter (oscilloscope) and displayed.

To illustrate the idea of a 1D array of values, it is best to do so with an example.


Below is an example in which signals coming from two signal generating blocks
are displayed (figure 18). These signal generating blocks collect a string of
characters that represents a function (in this case trigonometric functions) and a
Boolean input that is used to enable or create the value table of that function. In
this case the table is created between 0 and 500 in steps of 0.3

Figure 18

Figure 19

13
The controls are intended to move the signal drawn on the plotter in a vertical and
horizontal direction.

9.3. 2D Value Arrays

A 2D data matrix is a list or array formed by a set of data that MyOpenLab


will be able to process in one go using specific functions for this purpose. In
figure 20 we see three blocks that operate with this type of 2D data matrices.

Figure 20

What we see in the previous figure is basically a block of data belonging to the

2D Array library The data is written in the block in the form


of matrix n*m of type “dbl”. It then goes to a block that converts the data 2D-
Doubleto data2D-Stringto later extract them using the block belonging to the
output library of the Visualization Panel called“table”.The example clearly shows
how MyOpenLab is capable of processing 2D arrays of data..

Figure 21

14
3. Double, integer and string type conversions

The conversions that can be carried out taking this type of data into account are:

Converts an “integer” variable to a “double”

Convert a “double” variable to an “integer”

Convert a “double” variable to a “string”

Converts a “string” variable into a “double” variable

Converts an “integer” variable to a “string” variable

Let's remember that these functions are found in libraries

Data of this type can be entered into a simulation in the form of constants
using the functions:

Data Entry Function Blocks

Enter a “string” type variable. Example: hello, 123asd,


<>@#mm

Enter a variable of type “double”: Example: 12.32

Enter a variable of type “integer”. Example: 12

Generates a random number between 0 and 1 of type “double”

4. Considerations related to the visualization of data in the


“Display Panel”.

It is very important to keep in mind that the data output elements must have their input
compatible with the type of data we want to see. In this we must consider that the
elements that allow us to see the types of variables are those classified in the table

In the figure we see the compatibility in the visualization of elements (data output).

fifteen
Display Elements

Double

String

Integer

In the same way, the data generated by the data entry elements of the
corresponding library of the “Visualization Panel” also provide a specific type of
data that we must take into account when making a design.

In the following figure we see each of these elements that are placed in the
“Display Panel” to enter data into the model with the data types of each of them:

Data Entry Elements

Double

Integer

String

In cases where it is required to output data in an output element that is not


compatible with it, a data conversion can be performed. In figure 22 we see a simple
example in which we show how to display an Integer value generated by the
potentiometer in a needle instrument that collects double type values.

16
Figure 22

5. Establishment of format for “double” type data.

In some cases we may be interested in modifying the format of a “double” type data
to add or remove more decimals. To resolve this question we use the function.

which through its format input (string) allows us to define the format that
we give to the value that we put in its data “value” input.

In the example in Figure 23, the data is entered through the “value” input 3.14166666 and it is said
that it only takes five decimal places, therefore the output that is displayed is 3.14167 (we see that
the first digit that is disregarded as it is greater than 6 when above increases it by one unit.

Figure 23

17
6. Find out the length of a string “length”

This function It is very useful in the processing of string type data. The
function collects the string variable, counts the number of characters and returns it in its output.

In figure 24 we see an example in which, using a text input box, we place the
string in the input of the function and its output (number of characters), which is
an Integer data type, we pass it to a format converter. of the type explained
above and from this, once the format is given we extract it using a string display
box.

Figure 24

7. Extract elements from a string “Substring”

This function is very useful for when we want to extract a set of characters from a string
and convert it into another different string.

Figure 25
The block has an entry “value” which is where the input string is placed and then two
entries “begin” and “end” which are the integer type values that delimit the string.
The output is logically a string.

In figure 26 we see an example of this function in which a string is placed and the
beginning and end of the string to be cut are delimited.

18
Figure 26

8. Add the elements of two strings

This function allows us to add the elements of two strings. The two input
variables are two strings (string type) and the output is also.

In figures 27 and 28 we see an example in which three chains are added by


cascading two blocks. In the same way, character counters have been placed at the
output of the strings to verify that the characters are actually added.

Figure 27

19
Figure 28

9. Registration of data in memory.

Memory function allows you to store data and extract it only when you need it.
order by its governing input In1(boolean signal).

Figure 29

In figure 30 we see an application of a maximum value detector. It involves storing the


maximum value reached by a variable. The reset button is to set the maximum value
to the current one.

Figure 30

twenty

You might also like