Giter VIP home page Giter VIP logo

simspad's Introduction

SimSPAD

logo

A high performance avalanche multiplication based optical receiver simulator.

Build Simulator Tests version

About

SimSPAD is an input output converter which takes an input of simulation parameters and an arbitrary length vector of expected number of photons striking the detector array per time step. From here, the output of a silicon photomultiplier is simulated, and packaged into a binary file. Currently the software returns the total charge emitted per time step, which can then be pulse-shaped with a convolution further down the line. Pulse-shaping is being integrated into the software so in the future this step may be omitted.

SimSPAD does not:

  • Do fancy random walks to determine if microcells will fire when an electron-hole pair is generated - this is far too slow and can be encapsulated into the PDE approximation.
  • Calculate electrical fields present in the device.
  • Have an after-pulsing probability method (although this is easy to implement - I don't have enough time and will welcome pull requests).
  • Assume digital driving circuitry (although I will accept pull requests which add this functionality).

Background on SiPMs, and why simulation is necessary

Silicon Photomultipliers (SiPMs) are solid-state single-photon-sensitive optical receivers. SiPMs use a vast array of single photon avalanche diodes (SPADs) to enable single photon detection at an exceptionally high count rate.

For the purposes of my DPhil, I investigated using SiPMs with application of high-performance receivers for optical wireless communications. SiPMs consequently have turned out to be extremely good detectors as they have a high bandwidth, high gain, and large area when contrasted with other silicon based photo-detectors.

SiPMs unfortunately experience recovery-time based nonlinearity, which is due to the recharge period each microcell undergoes after detection of a photon. Interestingly, there are unobservable parameters inside the device as a result which dictate the shape of the output. These unobservable parameters include both the array average photon detection efficiency, and the mean fired charge per microcell. This simulation allows both simulation of SiPMs for arbitrary optical input, and observation of those unobservable parameters.

Simulation also allows for more complicated experiments to be performed in a contained environment where transmitter effects, thermal noise and more can be eliminated.

The simulation was originally written in MATLAB to interface with existing bit error rate detection code, but has since been migrated to c++ to enable the simulator to work (much, oh so much) faster.

Publications involving this simulation:

This is an experimental work in progress, and more documentation will follow. This work has been/will be published in:

  1. PRIME 2022: The negative impact of anode resistance on SiPMs as VLC receivers
  2. MDPI Photonics: An experimental and numerical study of the impact of ambient light of SiPMs in VLC receivers
  3. MDPI Sensors: A Roadmap for Gigabit to Terabit Optical Wireless Communications Receivers
  4. Upcoming Paper (Pending..? Equaliser based)
  5. Upcoming Paper (Pending.?? OFDM based)
  6. Upcoming Paper (Pending..? From an ex-colleague)
  7. My Thesis (Pending...)

How to Reference:

If you use this software in your work, please cite it as: William Matthews (2022) SimSPAD (Which version here) [Source Code]. https://github.com/WillMatthews/SimSPAD

If you use the simulation in a publication, please cite the following papers at your discretion as well: MDPI Photonics: An experimental and numerical study of the impact of ambient light of SiPMs in VLC receivers and MDPI Sensors: A Roadmap for Gigabit to Terabit Optical Wireless Communications Receivers.

Usage

Standalone

logo

SimSPAD can be run as a standalone program from the command line, taking an input binary file, and producing an output binary file. This binary file can be created using examples in the examples directory. Currently MATLAB and Python methods exist, and a C++ method will be added in the future.

Web Application

Once SimSPAD server is running, you are able to send a POST request to http://localhost:33232/simspad. The reply from the server will be the result from the simulation. The data to and from the server is packaged as characters - see below in the Binary Format section for more details.

To stop the server, access http://localhost:33232/stop. To see if the server is running, access http://localhost:33232/ where you should see a greeting message in plain text. Logs (the last 512KB of output to stdout) can be seen at http://localhost:33232/logs.

Install

Tests

Run make build to create the directories for the executables. Then run make test to create and run the tests.

Standalone

Run make build to create the directories for the executables. Make the executable with make. The executable will be produced as ./build/apps/simspad.

Web Application

Run make build to create the directories for the executables. Then run make configure to download the libraries for the web server. Finally, make the executable with make server. The executable will be produced as ./build/apps/server.

Create a new user useradd simspad

Create a systemd file to run the executable
[Unit]
Description=SimSPAD Avalanche Photo-detector Simulator
Requires=network-online.target
Wants=network-online.target
After=network.target syslog.target network-online.target

[Service]
User=simspad
ExecStart=/path/to/server
RestartSec=5
Restart=always

[Install]
WantedBy=multi-user.target

The following steps may be omitted if you are not planning on sharing the server over a network with multiple users.

Edit Nginx sites-available to proxy pass to the simspad server

This process means that users are not required to memorise the port number for the server, all you need to do is point your software at the link you define here. This action also means that you are able to add SSL encryption quite easily with a service like 'lets encrypt'.

Add the following location:

    location /whatever-you-want/ {
        # proxy_buffering off;
        proxy_pass http://127.0.0.1:33232/;
    }
Edit nginx.conf to increase maximum upload size

Add the following to the end of http{}:

    client_max_body_size 200M;

Binary Format

The binary files used by SimSPAD are vectors of double precision floating point numbers.

The first ten double floats are:
(in order)
    dt                - Simulation time step size
    numMicrocell      - Number of Detectors
    vBias             - Bias Voltage
    vBr               - Breakdown Voltage
    tauRecovery       - Recharge time constant
    pdeMax            - Max PDE for PDE-Vover equation
    vChr              - Characteristic Voltage for PDE-Vover equation
    cCell             - Capacitance per detector
    tauFwhm           - Output pulse full width half max time
    digitalThreshold - Detection Threshold (as a fraction of overvoltage from bias)

And the remainder of doubles in the file are the optical input in expected number of photons per time step dt striking the photo-detector.

The output file is identical, with the simulation parameters taking the first ten positions of the binary file, and the remainder of binary file are the detector's response (in terms of electrical charge output) for each time step.

This is identical to the input for the web application, except that the input and output are character encoded. A char is a 1 byte input, and eight bytes are needed for each double. This is packaged and unpackaged at either end of the process to reproduce the simulation inputs and outputs.

Contributing:

Pull requests are extremely welcome, as long as you obey the give key points in the design philosophy:

  • Keep SimSPAD fast.
  • Keep SimSPAD simple, and all in C++.
  • Ensure the output compares well to experimental data.
  • Do not use magic numbers - ground everything in device parameters and physical constants.
  • Keep SimSPAD fast (again).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.