From c028d2680d81fe6bdb8f54a8e884269e4fca879f Mon Sep 17 00:00:00 2001
From: Fredrik Bagge Carlson <cont-frb@ulund.org>
Date: Sun, 20 Aug 2017 21:58:40 +0200
Subject: [PATCH] Add docstrings

---
 src/interface.jl                             |  1 +
 src/interface_documentation.jl               | 64 ++++++++++++++++++++
 src/interface_implementations/ballandbeam.jl |  1 +
 src/utilities.jl                             |  2 +-
 4 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 src/interface_documentation.jl

diff --git a/src/interface.jl b/src/interface.jl
index 53d15a1..82136bd 100644
--- a/src/interface.jl
+++ b/src/interface.jl
@@ -18,6 +18,7 @@ num_inputs(p::AbstractProcess)  = error("Function not implemented for $(typeof(p
 outputrange(p::AbstractProcess) = error("Function not implemented for $(typeof(p))")
 inputrange(p::AbstractProcess)  = error("Function not implemented for $(typeof(p))")
 isstable(p::AbstractProcess)    = error("Function not implemented for $(typeof(p))")
+isasstable(p::AbstractProcess)  = error("Function not implemented for $(typeof(p))")
 sampletime(p::AbstractProcess)  = error("Function not implemented for $(typeof(p))")
 
 control(p::AbstractProcess, u)  = error("Function not implemented for $(typeof(p))")
diff --git a/src/interface_documentation.jl b/src/interface_documentation.jl
new file mode 100644
index 0000000..608897d
--- /dev/null
+++ b/src/interface_documentation.jl
@@ -0,0 +1,64 @@
+# This file contains all the docstrings so that the interface specification file is not cluttered
+
+"""
+    AbstractProcess
+Base abstract type for all lab processes. This should not be inherited from directly, see [`PhysicalProcess`](@ref), [`SimulatedProcess`](@ref)
+"""
+AbstractProcess
+"""
+    PhysicalProcess
+Pysical processes should inherit from this abstract type.
+"""
+PhysicalProcess
+"""
+    SimulatedProcess
+Simulated processes should inherit from this abstract type.
+"""
+SimulatedProcess
+"""
+    ny = num_outputs(P::AbstractProcess)
+Return the number of outputs (measurement signals) of the process.
+"""
+num_outputs
+"""
+    nu = num_inputs(P::AbstractProcess)
+Return the number of inputs (control signals) of the process.
+"""
+num_inputs
+"""
+    range = outputrange(P::AbstractProcess)
+Return the range of outputs (measurement signals) of the process. `range` is a vector of
+tuples,  `length(range) = num_outputs(P), eltype(range) = Tuple(Real, Real)`
+"""
+outputrange
+"""
+    inputrange(P::AbstractProcess)
+Return the range of inputs (control signals) of the process. `range` is a vector of
+tuples,  `length(range) = num_inputs(P), eltype(range) = Tuple(Real, Real)`
+"""
+inputrange
+"""
+    isstable(P::AbstractProcess)
+Return true/false indicating whether or not the process is stable
+"""
+isstable
+"""
+    isasstable(P::AbstractProcess)
+Return true/false indicating whether or not the process is asymptotically stable
+"""
+isasstable
+"""
+    h = sampletime(P::AbstractProcess)
+Return the sample time of the process in seconds.
+"""
+sampletime
+"""
+    control(P::AbstractProcess, u)
+Send a control signal to the process. `u` must have dimension equal to `num_inputs(P)`
+"""
+control
+"""
+    y = measure(P::AbstractProcess)
+Return a measurement from the process. `y` has length `num_outputs(P)`
+"""
+measure
diff --git a/src/interface_implementations/ballandbeam.jl b/src/interface_implementations/ballandbeam.jl
index a88838a..3bbe8f6 100644
--- a/src/interface_implementations/ballandbeam.jl
+++ b/src/interface_implementations/ballandbeam.jl
@@ -18,6 +18,7 @@ num_inputs(p::BallAndBeamType)  = 1
 outputrange(p::BallAndBeamType) = [(-10,10),(-1,1)] # Beam angle, Ball position
 inputrange(p::BallAndBeamType)  = [(-10,10)]
 isstable(p::BallAndBeamType)    = false
+isstable(p::BallAndBeamType)    = false
 sampletime(p::BallAndBeamType)  = p.h
 
 control(p::BallAndBeam, u)  = ccall((:comedi_write, comedipath),Int32,
diff --git a/src/utilities.jl b/src/utilities.jl
index a8cb718..8be25e8 100644
--- a/src/utilities.jl
+++ b/src/utilities.jl
@@ -1,4 +1,4 @@
-export periodically, init_sysfilter, sysfilter!
+export @periodically, init_sysfilter, sysfilter!
 
 """
 	@periodically(h, body)
-- 
GitLab