diff --git a/src/interface.jl b/src/interface.jl index 53d15a1dc382aaf9deb371716a148cfa76eb995e..82136bd7019eb47b3e27bec6c535dbdb190ded7d 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 0000000000000000000000000000000000000000..608897dc6344a82959bf5338af4c4ccf7c6c1640 --- /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 a88838a4cf597cb26038c5263031810b07cab8b9..3bbe8f6dadaf48975fb674845f0931ce09d2cf7d 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 a8cb718cf5dc65090056f3e31fc6e79e606ffae0..8be25e8df3a7edb707ae26f388072d4744cfd8cf 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)