Skip to content Skip to navigation

Connexions

You are here: Home » Content » Web GUI Example Guide

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of a lens

      Lenses

      A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

      What is in a lens?

      Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

      Who can create a lens?

      Any individual Connexions member, a community, or a respected organization.

    • External bookmarks
  • E-mail the author

Recently Viewed

Web GUI Example Guide

Module by: Jesse Chan

Summary: This is a supplementary module explaining the use of a GUI to draw and simulate networks of strings.

Introduction

This is a brief module on creating and analyzing a web using a GUI implementing the finite element discretization of a network of strings, covering

  • how to draw the web
  • how to adjust the discretization
  • how to adjust parameters
  • running simulations of spiderweb movement given an initial displacement
  • analyzing eigenvalues and eigenmodes
  • other features of the GUI.

First, download the web3.zip file, and after unzipping it, change the Matlab directory to the one in which you unzipped web3.zip . Then, in the Matlab command window, type webgui3 to open up the GUI window. You should see a Matlab figure titled “Spiderweb creation GUI" with buttons on the left and an empty grid on the right.

Drawing the web

To draw the web, click first on the “Draw nodes" button. These will be either the endpoints of strings or the junctions at which strings connect together. If you left click on a space in the empty grid, you will place a node in that position. Continue to left click until you have placed all the nodes, then right click to indicate that you are finished.

Figure 1: Drawing the nodes
pic1.png

Next, once you have drawn the nodes, you can connect them together to create a network of strings. To do this, click on the “Connect nodes" button. Once you have pressed the button, you can click on a node, then on another node to place a connection between the two. Clicking on the first node will cause it to turn red, showing you which node you have chosen (if you choose wrong, right click to cancel).

Figure 2: Connecting the nodes
pic3.png

After clicking on both nodes, a blue line will appear on the grid connecting them. Note that you cannot connect a node to itself. Continue to do so until you have drawn your network, and right click to indicate you are finished.

If you click on a spot where there isn't a node, you will select the closest node to where you clicked.

Figure 3: Finished creating the network structure
pic4.png

Keep in mind that for these simulations, all webs must have endpoints that are considered anchored in place. Using the GUI, these endpoints are assigned to be nodes that are connected only to one other node. If no nodes fit these results, the discretization will contain errors, making it impossible to run simulations.

Adjusting grid size

Once the basic network is drawn, we can go on to adjusting the fineness of our grid. The fineness of the grid will determine the accuracy of your simulations, and is important if you want accurate approximations to a larger number of eigenvalues. However, with every node added, the size of our matrix discretization increases by 3 rows and 3 columns, so there is a computational tradeoff for accuracy.

There are two ways to increase the grid size - one is to click on the button labeled “Alter dx". The GUI will then query you for the desired step size between nodes, and will add the nodes automatically. Keep in mind that the query asks you to specify a number of units for step size, and a box is 1 unit by 1 unit.

Figure 4: Adjusting grid size
pic5.png

The second way to increase the grid size is to press the button labeled “Dbl grid pts" (double grid points). Each press of the button will place a grid point between all pairs of connected nodes, and you can continue to press the button until the desired density of grid points is achieved.

Adjusting parameters

There are several physical parameters that are adjustable in the model. The first box in the GUI is labeled “k,s, and a constants", with 3 boxes below with values that can be edited. kk represents the stiffness of a string, ss represents the prestress/tension in the string, and aa is a constant representing the strength of the damping factor. It is possible to vary these parameters for every connection between two nodes.

There are two ways to adjust parameters in a network. One is to simply adjust the values in the editable boxes as connections are drawn between nodes. The other is to first draw the outline of the network, and then to click on the button “Edit cnx params" (edit connection parameters). After clicking on this, if you click on two nodes with a connection between them, a box will appear with the current values for the k,sk,s, and aa constants inside. You may change them and press “OK" to submit these changes.

Running simulations

Running a simulation on a web allows you to provide an initial displacement (like choosing where to pluck a string) and see how the web will behave for a given time period. To run a simulation, the initial displacement should first be specified. By clicking on the “Run Simulation" button, you will be able to select nodes by clicking close to them. After clicking on a node, a box will appear and query you for the components of the forces in the x,yx,y, and zz directions. This simply lets you determine the orientation of your initial displacement. After pressing OK, you can continue to click on nodes and specify their component forces as well.

Figure 5: Creating the initial displacement for the Y-shaped web. Note the red circle over one of the nodes.
pic6.png

For one node, clicking an initial displacement will simulate a smooth displacement of the string. The selected node will be given an initial displacement, but the neighboring connected nodes will also be raised up a little, so that the initial displacement is smoother. Clicking on many nodes close together will cause these displacements to overlap and build on each other.

After selecting all the desired nodes to be displaced, right click to indicate you are finished. Another box will appear, querying you for the runtime of the simulation, the timestep desired (a smaller timestep is more accurate, but takes longer to compute with), as well as the total norm (size) of the initial displacement. After pressing OK, Matlab will run the simulation and play a movie of it on screen.

Figure 6: A simulation given the initial displacement in the above figure
simul.png

For data analysis, after the simulation has finished, a box will come up querying whether or not you want to save the data. If yes, you can specify a name for the Matlab data file, and the GUI will save the data structures, discretization matrices, and the data from the simulation into this file. The data from the simulation will contain a vector ff, which contains the initial displacement for each node, the vector tt, the discretization of time in the simulation, and a matrix cc, whose rows correspond roughly to the evolution of the positions of the nodes cc at the different times in the vector tt.

Viewing eigenvalues and eigenmodes

Another tool in the GUI is to view the eigenvalues and eigenmodes of a spiderweb. Once the web has been drawn and the grid has been adjusted as desired, clicking on the “See eigs" button will calculate the eigenvalues and eigenmodes of the web. A figure will appear, plotting the eigenvalues, and another figure will also appear, in which movies and sounds of the eigenmodes will be played. After one eigenmode movie is finished playing, press any key to continue to the next.

Figure 7: The eigenmode of a Y-shaped web
piceig.png

Note that the number of eigenvalues calculated is far less than the dimension of the matrix. This is because the discretization approximates only a few eigenvalues accurately. The size of the matrix is 3 times the number of nodes, but the number of eigenvalues calculated is only 10%10% the size of the matrix.

Figure 8: The first few eigenvalues of a Y-shaped web
piceig2.png

After all the eigenmode movies are played, a box will appear asking whether or not you want to save the data. The procedure to save the data is the same as saving data after running a simulation of spiderweb motion.

Other options

There are two other options available - one is to save a drawn web into a loadable file format, and the other is to load a picture into the background of the GUI.

Save/Load

To save a web after it has been drawn, click on the “Save/Load" button and select the “Save" option. A box will appear, querying you for the name of the web. After pressing OK, the web data will be saved in a .mat file in your current directory under the specified name. To load, press the same button, but select “Load" and specify the file name.

An easy way to use the GUI to create large webs is to draw the outline of a web, save it, and then reload it, adjusting grid size until satisfied.

Loading pictures

Since it's possible to trace the outline of any web, it's possible to use the web GUI to trace an actual web out. To do so, include (in the same directory as the GUI) a JPEG photo of the web to trace. Click the "Load pic" button, and it will display the picture as the background of the GUI.

Figure 9: The hyptiotes spider web, ready for tracing.
picweb.png

Comments, questions, feedback, criticisms?

Send feedback