From 6013f772aebac3ea684861112d46d5afc84ffae1 Mon Sep 17 00:00:00 2001 From: Julian Salt <juliansaltducaju@gmail.com> Date: Mon, 26 Aug 2019 07:43:18 +0200 Subject: [PATCH] Update furuta.jl --- src/interface_implementations/furuta.jl | 30 +++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/interface_implementations/furuta.jl b/src/interface_implementations/furuta.jl index 365d559..fc53e9d 100644 --- a/src/interface_implementations/furuta.jl +++ b/src/interface_implementations/furuta.jl @@ -19,17 +19,27 @@ struct Furuta <: PhysicalProcess h::Float64 bias::Float64 stream::LabStream - measure::AnalogInput10V + measure_phi::AnalogInput10V + measure_phi_dot::AnalogInput10V + measure_theta::AnalogInput10V + measure_theta_dot::AnalogInput10V + measure_theta_precise::AnalogInput10V + measure_theta_dot_precise::AnalogInput10V control::AnalogOutput10V end function Furuta(; h::Float64 = 0.01, bias::Float64 = 0., stream::LabStream = ComediStream(), - measure::AnalogInput10V = AnalogInput10V(4), + measure_phi::AnalogInput10V = AnalogInput10V(4), + measure_phi_dot::AnalogInput10V = AnalogInput10V(5), + measure_theta::AnalogInput10V = AnalogInput10V(6), + measure_theta_dot::AnalogInput10V = AnalogInput10V(7), + measure_theta_precise::AnalogInput10V = AnalogInput10V(2), + measure_theta_dot_precise::AnalogInput10V = AnalogInput10V(3), control::AnalogOutput10V = AnalogOutput10V(0)) - p = Furuta(Float64(h),Float64(bias),stream,measure,control) - init_devices!(p.stream, p.measure, p.control) + p = Furuta(Float64(h),Float64(bias),stream,measure_phi,measure_phi_dot,measure_theta,measure_theta_dot,measure_theta_precise,measure_theta_dot_precise,control) + init_devices!(p.stream, p.measure_phi, p.measure_phi_dot, p.measure_theta, p.measure_theta_dot, p.measure_theta_precise, p.measure_theta_dot_precise, p.control) p end @@ -45,9 +55,9 @@ end const AbstractFuruta = Union{Furuta, FurutaSimulator} num_outputs(p::AbstractFuruta) = 1 -num_inputs(p::AbstractFuruta) = 1 +num_inputs(p::AbstractFuruta) = 6 outputrange(p::AbstractFuruta) = [(-10,10)] -inputrange(p::AbstractFuruta) = [(-10,10)] +inputrange(p::AbstractFuruta) = [(-10,10),(-10,10),(-10,10),(-10,10),(-10,10),(-10,10)] isstable(p::AbstractFuruta) = false isasstable(p::AbstractFuruta) = false sampletime(p::AbstractFuruta) = p.h @@ -62,7 +72,13 @@ control(p::AbstractFuruta, u::Number) = send(p.control,u) control(p::FurutaSimulator, u::Number) = p.s(u) -measure(p::Furuta) = read(p.measure) +measure_phi(p::Furuta) = read(p.measure_phi) +measure_phi_dot(p::Furuta) = read(p.measure_phi_dot) +measure_theta(p::Furuta) = read(p.measure_theta) +measure_theta_dot(p::Furuta) = read(p.measure_theta_dot) +measure_theta_precise(p::Furuta) = read(p.measure_theta_precise) +measure_theta_dot_precise(p::Furuta) = read(p.measure_theta_dot_precise) + measure(p::FurutaSimulator) = p.s.sys.C*p.s.state initialize(p::Furuta) = nothing -- GitLab