Skip to content

biophilross/fabsim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fabsim README

Personal Fabricator Diffusion Simulation

This it the protoype of a simulation package being used to study the socio-economics effects of the widespread adoption and diffusion of personal fabricators.

Install

  1. If you have git installed:

    1. Opening your command line tool of choice
    2. Changing to the directory you'd like to download the files to
    3. Using git clone https://github.com/thephilross/fabsim.git
  2. If you just want to download the source code:

    1. Download the zip file
  3. Open up your favorite command line tool and change to the fabsim project directory

  4. Run python setup.py to install any module dependencies (assuming you have python installed)

  5. Run cd src and then run simulation.py test.json to make sure the simulation runs properly

Wanna see a quick description of each *.py file? Run pydoc simulation (assuming yo have pydoc installed and note the lack of .py at the end). Same thing applies to all source code files replacing 'simulation' with the desired file name.

Module Dependencies

The prototype currently uses the latest versions of the following libraries:

  • json
  • matplotlib
  • numpy

If you python installed on your machine I would recommend installing via pip. In order to do so just open up your command line and run easy_install pip and then type in pip install json, pip install matplotlib, and pip install numpy. You can also do so using easy_install but I wouldn't recommend it...

Quick Start

If everything in the 'Install' section worked properly then you should have already been able to run your first simulation! If not…well I have some work to do.

Essentially you have two files within the src directory you can run from the command line. You can either run validate.py inputfile or simulation.py inputFile

validate.py is used to validate the model being used to run our simulation while simulation.py is a more scalable version of validate.py that should be used once the simulation results of validate.py are properly understood.

Inputs

The input files are formatted in JSON which follows a key-value data structure similar to a dictionary in python. You'll find the simulation file inputs within the inputs directory.

The inputs for simulation.py are:

  • SIMLENGTH - number of time steps per simulation
  • NUMGOODS - number of TOTAL goods in the simulation
  • NUMCONSUMERS - number of consumers
  • NUMPRODUCERS - number of produers
  • PERCENTFACTORY - decimal value dictating the percentage of NUMGOODS that a factory can hold within its inventory. 1 - PERCENTFACTORY is the percentage of goods that a fabricator can hold within its inventorys
  • numTrials - number of simulations to run
  • scenario - the distribution of producers you would like to see within your simulation; currently can only choose from all factories, all fabricators or half factories and half fabricators
  • monitor - True or False depending on whether you want to see the results of each invidual simulation in the console output

The inputs for validate.py are all the same except for the following addition:

  • testCase - see sim_overview.md to understand what I mean by this

Additionally there is no option to choose how many producers are present. There are always just two.

Outputs

Resulting data from each simulation on each producer is output to a file with the same name as the input file within the results directory in JSON format.

Additional Documentation

Additional documentation exists in the doc directory.

About

Personal Fabricator Simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages