NAssets.add_edges_gids!Method

add_edges_gids(g,lv,nbs_gids,gid)

Add edges between the local vertex lv and the list of gids (global ids passed) using property gid

source
NAssets.add_geo_coordinates_to_graph!Method

It annotates the graph with the coordinates obtained from the passed file name and location (location/name.csv). Annotating the graph is just adding attributes to the MetaGraph object passed.

source
NAssets.clear_cache!Method

Clears cache of control agent

TODO Opportunity to investigate ways to store relevant cache rather than clearing all

source
NAssets.clear_pending_query!Method

clear queries requested by sne to controller that have expired, so the same query can be requested after some time model.ofmsg_reattempt

source
NAssets.configMethod

config(bconfig)

It prepares a config object based on the plain configuration (bconfig) passed as parameter.

source
NAssets.create_subgraphMethod

create_subgraph(egs,eqv,gid_prop)

Creates a graph g (MetaGraph) for the given edge list egs, where g represents a subgraph of a global graph. In eqv, every pair has the form: (lv,gv) where lv is the local vertex id and gv is the global vertex id. gid_prop indicates the property of g used to reference gv.

source
NAssets.create_subgraphMethod

create_subgraph(m,eqv)

Creates a graph g (MetaGraph) for the given adjacency matrix m, where g represents a subgraph of a global graph. The vector eqv, gives the tuples: (lv,gv) where lv is the local vertex id and gv is the global vertex id.

source
NAssets.exp_cMethod
Determines criteria for valid values to TTF for
the exponential function.

    t₀: unused, defined to keep uniformity of function
        (TODO: check if this can be removed)
    t: value to evaluate
source
NAssets.exp_fMethod
Basic implementation of exponential deterioration function
according to:

* T. Wang, J. Yu, D. Siegel, and J. Lee, “2008 International Conference on Prognostics and Health Management, PHM2008,” 
  2008 Int. Conf. Progn. Heal. Manag. PHM 2008, 2008.

  * A. Salvador Palau, M. Dhada, and A. Parlikad, “Multi-Agent System architectures for collaborative prognostics,” 
  J. Intell. Manuf., 2019.

a: max expected value of condition/health indicator (i.e. 1 if normalised)
b: curvature parameter
t: remaining time-to-failure (generally calculated with exp_t function)
source
NAssets.exp_tMethod
Calculates remaining ttf(time-to-failure) for a given expected ttf
and current t
ttf: expected time-to-failure
t: current time
source
NAssets.exp_tsMethod
Scales exponential function considering shifting for long term
behaviour.

ttf: expected time-to-failure
t: value to scale
d: units to shift to the right (near TTF)
source
NAssets.get_dropping_timesMethod

return the times when random assets will fail according to total sim time (N), quantity (q) of assets and proportion. It receives also random

source
NAssets.get_graphMethod

get_graph(seed,size,topo;k=0,B=0,adj_m_csv=nothing,sep=';')

Helper function to get underlying graph, passing either the size and topo required or the name adj_m_csv of the csv file with the adjacency matrix and the separator.

source
NAssets.get_run_labelMethod

get_run_label(config)

It obtains the label for a simulation run based on the configuration parameters: config. Label is based on the graph model of the underlying controlled network and the control network, plus the size, seed and maintenance policy.

source
NAssets.get_subgraphMethod

get_subgraph(g,nodes,id_prop)

It generates subgraph for the vector of nodes passed. This is similar to egonet but it keeps custom indexes given in id_prop parameter.

  • g: graph
  • nodes: It receives vector of controlled assets (nodes)
  • id_prop: could be either :eid (simNE) or :aid (agent)
source
NAssets.install_flow!Method

Install the given flow in the sne. I t does not check if the flow is valid (the port is available), as this flow could be installed for the future.

source
NAssets.is_invalid_pathMethod

Check if path is invalid according to local knowledge. It does not mean is valid as this agent might not have all info to check validity. Only flags invalid if 100% sure. cnes:controlled nes by this agent (a)

source
NAssets.isless_pathsMethod

isless_paths(a,b)

Used to compare and ordering tuples of paths where tuples is of the form (tick,score)

source
NAssets.join_subgraphsMethod

join_subgraphs(g1,g2)

It joins two subgraphs assuming they are both part of a global graph. The id in the global graph is given by property :eid.

source
NAssets.link_down!Method

It simulates operations happening in a network asset when the link corresponding to the given dpnid goes down. sne is up and node went down is dpnid.

source
NAssets.link_up!Method

It simulates operations happening in a network asset when the link corresponding to the given rjnid rejoins. sne is up and node re-joining is rjnid.

source
NAssets.load_base_cfgsMethod

load_base_cfgs

It loads the simulation config parameters from csv file which location and name is passed. I passes a list with delimiters (delims) used in the file from outer, to inner. Default=[';',',']

source
NAssets.load_graph_from_csvMethod

loadgraphfrom_csv

This function loads a graph from csv file containing the adjacency matrix of the graph. The file location and name is passed as argument (location/name.csv) together with the separator used in the csv e.g. ';' or ','.

source
NAssets.log_cMethod
Determines criteria for valid values to TTF for
the logistics function.

    t₀: initial value for the cycle/phase
    t: value to evaluate
source
NAssets.maintenance_costMethod

Maintenance cost at a given time step:

rul_mnt: rul of an asset (sne) of the network that is undergoing maintenance. If rul == 0., then it is corrective maintenance, if rul > 0, then it is preventive maintenance. Otherwise (-1) no maintenance ongoing.

is_start: indicates if maintenance has just started so time-independent costs are added

is_active: indicates if the asset was active in the network before maintenance started, i.e. was part of an active flow.

dt_cost: downtime cost, cost of service flow/production loss per time step, time-dependent. Added when corrective maintenance.

l_cost: labour cost per time step, time-dependent.

p_cost: parts costs for maintenance regardless of the time it takes, time-independent, only added when maintenance starts.

r_cost: cost of loss of remaining life. Added when preventive maintenance.

source
NAssets.model_step!Method
It advance model one step. Agents are progressed here to ensure that one action is perform in
all agents before the next action is performed in all agents, instead of having one action
executed in some agents and then some start with second action.
source
NAssets.nnoisedMethod

Add random normally distributed noise to a given value. Ensures that always: 0 ⋜ v + ϵ ⋜ y, for a random noise ϵ.

v: original value without noise
ϵₛ: noise standard deviation
ϵ₀: noise μ
y:  max value the noised value can take
source
NAssets.pending_pkt_handlerMethod
It enqueues packets that were not processed in 
previous time steps. It discard packets according to defined size of the queue.
source
NAssets.port_delete_handlerMethod
It processes OF msg sent by controlled NE  to
remove a given port from its graph
This is done by the agent controlling the neighbour of a dropped node
source
NAssets.query_pathsMethod

query_paths(lg,s,d)

A wrapper of the Julia Graph ecosystem shortest_paths functions. It searches for a path between nodes with global id (eid) s and d in the local graph lg. It assumes property :eid of each vertex is global id of vertex

source
NAssets.query_pathsMethod

query_paths(lg,t)

Path search in local graph lg, receiving source s and destination d in a tuple t, such as t:(s,d).

source
NAssets.route_traffic!Method

It routes packets according to installed flow rules. There could be rules that are not valid in the current time step but will be valid later.

source
NAssets.run_simMethod

run_sim(config)

Based on config parameters received it creates objects required to trigger simulation run.

source
NAssets.schedule_event!Method

Schedules an event of type $type$ on the given agent $a$ at time $time$, affecting the snes with ids: $snes$.

source
NAssets.score_pathMethod

score_path(path)

Wrapper the path score function. It gives a score to the given path, initially only based on length of path

source
NAssets.single_runMethod

single_run(config) -> ctl_ags,ne_ags,model

It runs a single simulation with the passed configuration, returning simulation data in ctl_ags,ne_ags,model. Optionally logging to a file if parameter log_to_file set to true.

source
NAssets.soft_remove_vertexMethod

soft_remove_vertex(g::AbstractGraph,dpn_id::Int)

Given the graph g, this function creates a deep copy of g and removes all the edges of the vertex whose global id (eid) is dpn_id and returns the new graph. The vertex whose id is dpn_id is only disconnected from the graph.

source
NAssets.stop_mnt!Method

stop_mnt!(a::Agent,sne::SimNE,model::ABM)

It simulates completion of maintenance, refilling RUL and rejoining asset to the network.

source
NAssets.to_local_vertexMethod

to_local_vertex(lg,gv,gid)

It obtains the local id of a vertex in graph lg given its global gv in property in gid

source
NAssets.to_local_vertexMethod

to_local_vertex(lg,eid)

It obtains id of vertex in a local graph lg given vertex's global eid set to property :eid

source
NAssets.trigger_random_node_drops!Method

Triggers random failures on active nodes. This function is coupled to the model as it detects nodes that are active and make sure disruption happen to some of those nodes. If decoupled, cleaner, but then requires to know in advance what paths are used at every time, to make sure that dropping nodes are always active.

source
NAssets.update_maintenance_plan!Method

update_maintenance_plan!(a::Agent,mnt_policy::Type{PreventiveM},model::ABM)

It schedules maintenance events (start/stop maintenance) for assets under control of a that are configured with preventive or predictive mnt_policy

source
NAssets.update_maintenance_plan!Method

update_maintenance_plan!(a::Agent,mnt_policy::Type{PreventiveM},model::ABM)

It schedules maintenance events (start/stop maintenance) for assets under control of a that are configured with predictive mnt_policy with maintenance planning running in python.

source
NAssets.values_fMethod
Generates the time series until failure of an asset, given 
the provided parameters:

ttf: expected time-to-failure
n: maximum number of cycles the asset can last
Δᵩ: Delta of number of time steps that are reduced as the asset
    reaches a new cycle/phase
ϵₛ: Standard deviation of the gaussian noise 
f: function to generate values until ttf
params: params required by the f
tsf: function to scale t for the given function
tse: extra parameter required by tsf
f_c: function that defines criteria for a valid value in the time series.
source
NAssets.wb_tMethod

Weibull scaling function ttf: expected time-to-failure γ: factor to tune max y (yₙ) value, e.g. for max y=1, with ttf =100, λ=0.5, κ=05 => γ=8

TODO: check if γ might be calculated from ttf, λ and κ

source
NAssets.wb_tsMethod
Scales weibull input t value considering shifting 
for long term behaviour

ttf: expected time-to-failure
γ: factor to tune max y (yₙ) value, e.g. for max y=1, with ttf =100,
λ=0.5, κ=05 => γ=8
d: units to shift to the right (near TTF)
source
NAssets.weibull_fMethod
Basic implementation of Weibull function with 2-parameters
κ: shape parameter, κ > 0
λ: scale parameter, λ > 0
t: current time (generally calculated with wb_t function)
source
NAssets.xᵩMethod

Introduces a variation on the x value according to the phase (ϕ) Used concretely for long-term TTF, we assume: * An asset has expected TTF (x) * After TTF the asset can be repaired or maintained and then will operate for a number of cycles/phases. * The current cycle/phase is given by ϕ * After every phase ϕ, the asset reduces its TTF by Δᵩ

source