How to Use Vectors in DOME

This tutorial shows how to work with vectors. We will build a model that compute the sum of two vectors and put the results in a third vector.

From the DOME window start a new DOME model (Figure 1) clicking on Build > New model > Dome Model.

Figure 1

 

A new DOME Model Window will appears (Figure 2).

 

 

Figure 2

Change the name to a name of your choice and from the DOME window choose Add > Procedural Relation (Figure 3).

Figure 3

Change the name of the relation (Figure 4).

Figure 4

 

From the DOME window click Add > Vector (Figure 5).

 Figure 5

 

Repeat Add > Vector three times to add three vector parameters. Now If you open the arrow on the left of input you will see three Vector parameters, figure 6.

 

Figure 6 

 For each vector, changes the name, adjust the number of element, adjust the unit. In our case I created three vectors with four element each and the unit is meter, figure 7. For details on how to change unit refer to DOME (Distributed Object-based Modeling Environment) - User Guide.

 

 

 Figure 7

 

Double click on the red and yellow blocks next to the name (Sum of Vector Relation) to open the relation window, figure 8

 

Figure 8 

The Relation window will open, figure 9.

 

Figure 9

 

Write the relation on the Body, Figure 10. We wrote

VectorSum=Vector1 + Vector2 

Figure 10

 

Now click on the causality tab to enter the causality window and check the squares next to VectorSum since VectorSum is a function of Vector1 and Vector2, Figure 11.

 

Figure 11

 Now test the relation giving values to Vector1 and Vector2 and check if the result is correct. Starting from the Dome model window, Figure 12, click on the blue cube next to Vector1.

 

Figure 12

A Parameter Window opens. You will insert the values of the four elements of Vector1. In our case it is [1 , 2, 3 , 4], Figure 13.

Figure 13

Close the parameter window clicking on the x. Repeat the same for Vector2,  Figure14. Vector2 contains the values [1, 1, 1, 1].

Figure 14

Close the parameter window clicking on the x. Now open the VectorSum to check if it has the correct values, Figure 15. The result is correct in fact  [1 , 2, 3 , 4] + [1, 1, 1, 1] =  [2, 3, 4, 5].

Figure 15 

Now click on the DOME Model window and Add > Tools > Interface to create an interface for the model. For detail on how to build an interface follow the instruction at DOME (Distributed Object-based Modeling Environment) - User Guide. Save the model.

Deploy the interface following the steps in DOME (Distributed Object-based Modeling Environment) - User Guide.

RUN THE MODEL

Connect to the server, as explained in details in DOME (Distributed Object-based Modeling Environment) - User Guide and open the Interface window. Click on the green cube ( ) next to Vector1 and Vector 2 change the values of the vectors. In this case Vector1 is [ 1 ,2, 3, 4] and vector2 is [2, 2, 2, 2], Figure 16.

 

 Figure 16

 Close the two Parameter windows. To test the model click submit, Figure 17.

 

 Figure 17

Now double click  to the green cube () next to VectorSum to check the result, Figure 18. The result is the vector [3, 4, 5, 6] as expected.