When creating many attack simulations it can be conveniant to save the resulting graphs to a folder so that re-runs are not required if further analysis is needed. This function saves the results of AttackTheGrid, and also allows the process to be interrupted. When the process is started again after and interuption the function finds the last save attack and starts the simulation process from there.
SaveMultiAttacks( g, AttackVectors, folder, MinMaxComp = 0, TotalAttackRounds = 10, CascadeMode = FALSE, Demand = "Demand", Generation = "Generation", EdgeName = "Link", VertexName = "name", Net_generation = "BalencedPower", Target = "Nodes" )
g | An igraph object representing a power grid. |
---|---|
AttackVectors | A dataframe. This is the output of the MultiAttackOrder function. If you expect. to interrupt the function this dataframe should be saved or the random seed used to generate the dataset recorded. |
folder | the folder data will be saved to. |
MinMaxComp | See AttackTheGrid. Default is 0 |
TotalAttackRounds | See AttackTheGrid. Default is 10 |
CascadeMode | See AttackTheGrid. Default is set to FALSE |
Demand | the name of the node Load variable. A character string. |
Generation | the name of the node generation variable. A character string. |
EdgeName | the variable that holds the edge names, a character string. |
VertexName | the variable that holds the names of the nodes, to identify the slack ref. a character string |
Net_generation | the name that the net generation data for each node is held in |
Target | whether nodes or edges are being attacked |
SaveMultiAttacks(g, AttackVectors, folder, CascadeMode = F)#> [1] "Calculating first simulation"#> Error in nrow(AttackVectors): object 'AttackVectors' not found