Simco-Net-generator-2.nlogo

Gives a handy tool with a little interface to generate networks.

2013/2014/2015/2016/2017

Fabian Adelt, Andreas Ihrig (TU Dortmund)

Licence

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.  You should have received a copy of the GNU General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

Extensions

tablehelpers for tables
arrayhelpers for arrays
stringstring handling
pathdirdirectory handling
filefile handling
statshandling of simulation data, including some basic statistic methods

Includes

variables.nlscontains all breed- and global-variables (libs/variables.nls)
helpers.nlscontains some helper functions (libs/helpers.nls)
helpers-visualization.nlscontains code for visual representation of the macro-layer (libs/helpers-visualization.nls)
helpers-input.nlscontains heler functions for reading input files (libs/helpers-input.nls)
helpers-output.nlscontains helper functions for writing output files, generating the respective file-names etc.  (libs/helpers-output.nls)
helpers-file-handling.nlscontains functions to handle files and folders (libs/helpers-file-handling.nls)
helpers-lists.nlscontains functions for basic list operations (libs/helpers-lists.nls)
interactions.nlscontains functions handling all interactions between agents, technologies and infrastructure elements (nodes and edges) (libs/interactions.nls)
Summary
Simco-Net-generator-2.nlogoGives a handy tool with a little interface to generate networks.
globalsAdd further globals
choose-directoryLet the user choose a directory.
append-to-changes-listAppends the given string and source to the changes-list
import-dimensionsImport dimensions with names (maybe other values later)
import-technologiesImport technologies from file.
names-of-agent-typesReports the names of all agent types
filter-available-technologiesFilters only available technologies
import-node-typeImports a node type and creates a node-type-object
create-node-of-typeCreates a node of given type, using a node-type-object to derive the neccessary information.
create-edge-of-typeInstantiates an edge (fromt the calling node to the sink given, and sets its parameters according to the type given.
import-nodes-of-typeImports a node type and generates a number of nodes queried from user
import-edge-typeImports a edge-type and creates a edge-type-object
import-edges-of-typeImports an edge type and generates a number of edges queried from user, connecting nodes more or less randomly
import-agents-of-typeImports a agent type and generates a number of agents queried from user
save-as-masterSaves the changes-list as master file which could be load later instead of doing all steps one by one
read-from-masterReads a master file and generates a netwok based on its content.
save-networkWrites out the network into 6 files.
save-network-descriptionSaves the characteristics of the types used to create the scenario.
print-heading-of-orderPrints a heading of order n depending on the selected wiki style Parameter: n - integer, order of the heading message - string, name of the heading itself
wikitable-printPrints a tabular depending on the selected wiki style.
set-directorySets the working directory to the one given via interface.
create-type-file-pathReturns the full path to a file in the types directory
create-master-file-pathReturns the full path to a file in the masters’ directory

globals

Add further globals

Variables

dirdirectory to store output
number-of-dimensions# of dimensions
number-of-nodes# of nodes
number-of-edges# of edges
number-of-agents# of agents
number-of-technologies# of technologies
Summary
choose-directoryLet the user choose a directory.
append-to-changes-listAppends the given string and source to the changes-list
import-dimensionsImport dimensions with names (maybe other values later)
import-technologiesImport technologies from file.
names-of-agent-typesReports the names of all agent types
filter-available-technologiesFilters only available technologies
import-node-typeImports a node type and creates a node-type-object
create-node-of-typeCreates a node of given type, using a node-type-object to derive the neccessary information.
create-edge-of-typeInstantiates an edge (fromt the calling node to the sink given, and sets its parameters according to the type given.
import-nodes-of-typeImports a node type and generates a number of nodes queried from user
import-edge-typeImports a edge-type and creates a edge-type-object
import-edges-of-typeImports an edge type and generates a number of edges queried from user, connecting nodes more or less randomly
import-agents-of-typeImports a agent type and generates a number of agents queried from user
save-as-masterSaves the changes-list as master file which could be load later instead of doing all steps one by one
read-from-masterReads a master file and generates a netwok based on its content.
save-networkWrites out the network into 6 files.
save-network-descriptionSaves the characteristics of the types used to create the scenario.
print-heading-of-orderPrints a heading of order n depending on the selected wiki style Parameter: n - integer, order of the heading message - string, name of the heading itself
wikitable-printPrints a tabular depending on the selected wiki style.
set-directorySets the working directory to the one given via interface.
create-type-file-pathReturns the full path to a file in the types directory
create-master-file-pathReturns the full path to a file in the masters’ directory

choose-directory

to choose-directory

Let the user choose a directory.  Directory chooser opens at subdir “networks”.  Chosen directory will be saved at “dir”.

append-to-changes-list

to append-to-changes-list [item-type value-list]

Appends the given string and source to the changes-list

Parameters

item-typestring, indicating type of change
value-listlist, containing file-name to be memorized

Returns

listchanges list, supplemented by input elements

import-dimensions

to import-dimensions [dims-file]

Import dimensions with names (maybe other values later)

import-technologies

Import technologies from file.  The number of dimensions here defines them for the hole network.

names-of-agent-types

to-report names-of-agent-types

Reports the names of all agent types

filter-available-technologies

to-report filter-available-technologies [available-techs techs]

Filters only available technologies

import-node-type

to-report import-node-type [my-nodes-file]

Imports a node type and creates a node-type-object

create-node-of-type

to create-node-of-type [my-node-type]

Creates a node of given type, using a node-type-object to derive the neccessary information.

create-edge-of-type

to create-edge-of-type [my-edge-sink my-edge-type]

Instantiates an edge (fromt the calling node to the sink given, and sets its parameters according to the type given.

Parameters

my-edge-sinknode that shall be reached by the edge instantiated within this function.
my-edge-typethe edge-type that shall be used to instantiate the edge

import-nodes-of-type

to import-nodes-of-type [my-nodes-file my-nodes-number]

Imports a node type and generates a number of nodes queried from user

import-edge-type

to-report import-edge-type [my-edge-file]

Imports a edge-type and creates a edge-type-object

import-edges-of-type

to import-edges-of-type [my-edges-file my-edges-number]

Imports an edge type and generates a number of edges queried from user, connecting nodes more or less randomly

import-agents-of-type

to import-agents-of-type [my-agents-file my-agents-number]

Imports a agent type and generates a number of agents queried from user

save-as-master

to save-as-master

Saves the changes-list as master file which could be load later instead of doing all steps one by one

read-from-master

to read-from-master

Reads a master file and generates a netwok based on its content.

save-network

to save-network

Writes out the network into 6 files.  All file names start with the network name.

save-network-description

to save-network-description

Saves the characteristics of the types used to create the scenario.  This can be used as a starting point for a scenario-description by including verbal fragments to the respective parts.  Uses wikimedia style formats, such that the output-file can be inserted to any wiki page.

print-heading-of-order

to print-heading-of-order [n message]

Prints a heading of order n depending on the selected wiki style Parameter: n - integer, order of the heading message - string, name of the heading itself

wikitable-print

Prints a tabular depending on the selected wiki style.

set-directory

to set-directory

Sets the working directory to the one given via interface.  If no directory given, a warning is issued.  Should be used in generator before handling files for reading or writing.

create-type-file-path

to-report create-type-file-path [file-name]

Returns the full path to a file in the types directory

Parameters

file-nameString of file-name Returns: full path

create-master-file-path

to-report create-master-file-path [file-name]

Returns the full path to a file in the masters’ directory

Parameters

file-nameString of file-name Returns: full path
to choose-directory
Let the user choose a directory.
to append-to-changes-list [item-type value-list]
Appends the given string and source to the changes-list
to import-dimensions [dims-file]
Import dimensions with names (maybe other values later)
to-report names-of-agent-types
Reports the names of all agent types
to-report filter-available-technologies [available-techs techs]
Filters only available technologies
to-report import-node-type [my-nodes-file]
Imports a node type and creates a node-type-object
to create-node-of-type [my-node-type]
Creates a node of given type, using a node-type-object to derive the neccessary information.
to create-edge-of-type [my-edge-sink my-edge-type]
Instantiates an edge (fromt the calling node to the sink given, and sets its parameters according to the type given.
to import-nodes-of-type [my-nodes-file my-nodes-number]
Imports a node type and generates a number of nodes queried from user
to-report import-edge-type [my-edge-file]
Imports a edge-type and creates a edge-type-object
to import-edges-of-type [my-edges-file my-edges-number]
Imports an edge type and generates a number of edges queried from user, connecting nodes more or less randomly
to import-agents-of-type [my-agents-file my-agents-number]
Imports a agent type and generates a number of agents queried from user
to save-as-master
Saves the changes-list as master file which could be load later instead of doing all steps one by one
to read-from-master
Reads a master file and generates a netwok based on its content.
to save-network
Writes out the network into 6 files.
to save-network-description
Saves the characteristics of the types used to create the scenario.
to print-heading-of-order [n message]
Prints a heading of order n depending on the selected wiki style Parameter: n - integer, order of the heading message - string, name of the heading itself
to set-directory
Sets the working directory to the one given via interface.
to-report create-type-file-path [file-name]
Returns the full path to a file in the types directory
to-report create-master-file-path [file-name]
Returns the full path to a file in the masters’ directory
Contains all breed- and global-variables.
Helper functions.
Code for visual representation of the macro-layer
Helper functions for input.
Handling all output helpers, p.e.
Helper functions to handle files and folders.
Helper functions to handle lists and sets.
Hold the agents.
Hold the technology objects.
Hold the nodes.
Hold the edges.
Handling all interactions between agents, technologies and infrastructure elements (nodes and edges).
Hold the nodes’ information concerning their characteristics as well as actual values, indicating their state.
Holds the edges
Holds data used to instantiate edges of distinct types (as given by input file and differentiated by edge-type-name)
Close