The ScenarioLoader Module

GenFSM.ScenarioLoaderModule
GenFSM_simrep

Simulation settings repository for GenFSM models.

This package sole function is load_settings.

The settings are stored in this repository as yaml files in:

  • [project]
    • scenarios
      • [scenario]

Where the default project and the default scenarios ae both named "default".

source

Module Index

Detailed API

GenFSM.ScenarioLoader.expand_dictMethod

expand_dict(d::Dict)

Expand dictionary keys that are tuples into nested dictionaries.

Example

d_input = Dict(("a","b","c") => 10, "e" => 30, ("a","b","d") => 20)
d_output = expand_dict(d_input) # Dict("a" => Dict("b" => Dict("c" => 10, "d" => 20)), "e" => 30)
source
GenFSM.ScenarioLoader.override_nested_dict!Method
override_nested_dict!(d1::AbstractDict, d2::AbstractDict; strict::Bool=true, expand=true)

Override the values in the dictionary d1 with the values in the dictionary d2.

d2 can be either another nested dictionary or a dictionary where the different levels are represented as tuple keys, e.g. d2 = Dict("a"=>Dict("b"=>1)) or d2 = Dict(("a","b")=>1). If d2 has new keys and strict is enabled, an error is raised.

source
GenFSM.ScenarioLoader.recursive_replace!Method
recursive_replace!(dict,replacement_pattern)

Replace a pattern in the values a possibly nested dictionary

d = Dict("a" => Dict(1 => "aaa", 2 => "bgggb"), 3=>"ccc")
recursive_replace!(d,"ggg" => "GGG") # Dict("a" => Dict(1 => "aaa", 2 => "bGGGb"), 3=>"ccc")
source