Description Usage Arguments Details Value See Also Examples

View source: R/calc_spring_constant.R

This function adds the graph characteristic k which is the spring constant for a given Area and Young's modulus.

1 | ```
calc_spring_constant(g, youngs_mod = "E", A = "Area", distance = "distance")
``` |

`g` |
an igraph object. The graph representing the network |

`youngs_mod` |
a character string. The Young's modulus of the edge. The default is E |

`A` |
a character string. The cross sectional area of the line. The default is A. see details on values of A |

`distance` |
A character string. See details on values of distance |

When A and distance are both set to 1 `k=E`

and the spring constant is equivalent to Young's modulus.
In this case there is no need to call this function as the edge weight representing youngs modulus can be used for k instead.

The values A and distance are edge attributes referring to the cross-sectional area of the edge and the horizontal distance of the edge, in other words the distance between the two nodes at each end of the edge. These values can be set to anything the user wishes, they may be constant or not. However, consider carefully setting the values to anything else other than 1. There needs to be a clear reasoning or the results will be meaningless.

For example setting the distance of an edge that represents an electrical cable to the distance of the electrical cable will return very different results when compared to a constant of one. However, the physical distance between two points does not necessarily have an impact on the loading of the line and so the results would not be interpretable. In contrast setting the distance metric to be some function of the line resistance may have meaning and be appropriate. As a general rule distance and area should be set to 1.

and edge attribute called k with value `EA/distance`

[calc_spring_area]

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
library(igraph)
set.seed(234)
g_prep <- generate_peels_network("A") %>%
set.edge.attribute(., name = "edge_characteristic", value = rep(1:16, each = 10)) %>%
#set some pretend Young's modulus value
set.edge.attribute(., name = "E", value = rep(c(1e5, 5e5, 2e5, 3e5), each = 40)) %>%
#calculate the spring area from another edge characteristic
calc_spring_area(., value = "edge_characteristic", minimum_value = 10, range = 20) %>%
prepare_edges() %>%
prepare_categorical_force(., node_names = "name",
force_var = "class")
g <- calc_spring_constant(g_prep, youngs_mod = "E", A = "Area", distance = "distance")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.