Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Create design for Instrumentation API #11

Closed
fabianishere opened this issue Oct 13, 2017 · 0 comments
Closed

Create design for Instrumentation API #11

fabianishere opened this issue Oct 13, 2017 · 0 comments

Comments

@fabianishere
Copy link
Member

fabianishere commented Oct 13, 2017

For the first public release, we need a design for an Instrumentation API which is able to measure data from the system in simulation and process the data that has been measured.

Goals

  • Allow user to measure data from the system in simulation
  • Allow user to transform the measured data
  • Allow user to use the data (save/store)

Design

  • Measurement
    The measurement of data happens in an Instrument, which is similar to a Process and has access to the state of all entities in the model. These measurements can happen periodically, by making the instrument hold (sleep) between the measurements. The measurements are then emitted via the methods provided by the SendChannel interface.
val entity = ...
val instrument: Instrument<Int, Model> = {
    while(true) {
        send(entity.state.counter)
        hold(10)
    }
}
  • Installation
    The Kernel interface will provide a method install(instrument: Instrument<T, M>): ReceiveChannel<T> that allows a user to install an instrument into a (running) system. The method will return a stream of measurements of type T (we use ReceiveChannel from kotlinx-coroutines to represent a stream).
  • Transformation and Collection
    The idea is to use the channel returned by the install method to asynchronously transform the measurements into meaningful data:
val stream: ReceiveChannel<Int> = kernel.install(instrument)
val avg: Deferred<Int> = async(Confined) { stream.take(100).average() }

kernel.run(1000)
@fabianishere fabianishere added this to the v1.0 milestone Oct 13, 2017
@fabianishere fabianishere self-assigned this Oct 13, 2017
@fabianishere fabianishere changed the title Create architecture for instrumentation API Create architecture for Instrumentation API Oct 13, 2017
@fabianishere fabianishere changed the title Create architecture for Instrumentation API Create design for Instrumentation API Jan 11, 2018
fabianishere added a commit that referenced this issue Feb 19, 2018
This commit creates the interfaces for the new Instrumentation API
described in issue #11. This interface allows users to plug an
instrumentation device into a (live) simulation in order extract
measurements from the simulation.
fabianishere added a commit that referenced this issue Feb 19, 2018
These changes implement the Instrumentation API described in issue #11
into the Omega simulation kernel.
fabianishere added a commit that referenced this issue Feb 23, 2018
This commit creates the interfaces for the new Instrumentation API
described in issue #11. This interface allows users to plug an
instrumentation device into a (live) simulation in order extract
measurements from the simulation.
fabianishere added a commit that referenced this issue Feb 23, 2018
These changes implement the Instrumentation API described in issue #11
into the Omega simulation kernel.
fabianishere added a commit that referenced this issue Apr 22, 2018
These changes contain the specification of the new Instrumentation API for the simulator, in addition to the implementation for the Omega kernel. As an example, the API allows users to measure data from processes in simulation and interpolate data points between the measurements.

Closes #11, #12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant