diff --git a/src/FRTN35_lab1.jl b/src/FRTN35_lab1.jl index 75472ae1b56dc6cebdcbd09bcdd99fdab69188dd..6b62e92940d5f81352dd6bcaf67c6dc587a22e6a 100644 --- a/src/FRTN35_lab1.jl +++ b/src/FRTN35_lab1.jl @@ -1,8 +1,7 @@ using BallAndBeam, ControlSystems, JLD, LabProcesses, Plots # @load "workspace.jld" # Run this command to restore a saved workspace -Bias = 0.01 # Change this if your process drifts over time -P = LabProcesses.Beam(0.01, Bias) # Replace for BeamSimulator(0.01) to run simulations +P = LabProcesses.Beam(bias = 0.) # Replace for BeamSimulator() to run simulations h = sampletime(P) settling_time = 1 diff --git a/test/runtests.jl b/test/runtests.jl index be2256f851e4ae3d1ccbe4a18648b1b3226ca556..d2541fc850fb5ff6f7e2e7821ecf03c3b008c80a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,13 +1,12 @@ using Base.Test using BallAndBeam, ControlSystems, LabProcesses +@testset "General" begin P = LabProcesses.Beam() -P = LabProcesses.Beam(0.01,0.) +P = LabProcesses.Beam(h=0.01,bias=0.) h = sampletime(P) @test h == 0.01 - - settling_time = 1 nbr_of_periods = 5 @@ -21,9 +20,11 @@ G2 = Number[w1_200 Complex.(ones(20),0)] G12 = sortfqs([G1; G2]) @test issorted(G12[:,1]) +println("Testing plots") bopl(G12) nypl(G12) + # Control ================================================================================== polevect = [1] zerovect = [] @@ -32,12 +33,13 @@ gain = 1 sysFBc,L,T,C = fbdesign(G12, polevect, zerovect, gain) sysFFc,YR,FF = ffdesign(T, polevect, zerovect, gain) sysFB,sysFF = c2d(sysFBc,h),c2d(sysFFc,h) - +end # Test BeamSimulator -P = LabProcesses.BeamSimulator(0.001) # Replace for BeamSimulator to run simulations +@testset "BeamSimulator" begin +P = LabProcesses.BeamSimulator(h=0.001) # Replace for BeamSimulator to run simulations h = sampletime(P) settling_time = 2 @@ -54,7 +56,7 @@ phase_true = angle.(true_resp[1][:]) |> ControlSystems.unwrap @test sum(abs, (phase_id-phase_true)[400:end]) < 5.3 # Some numerical errors for high freqs -P = LabProcesses.BeamSimulator(0.01) +P = LabProcesses.BeamSimulator(h=0.01) h = sampletime(P) prbs = PRBSGenerator() duration = 5 @@ -83,3 +85,4 @@ phase_id = angle.(arx_resp[1][:]) |> ControlSystems.unwrap # plot([log.(abs.(arx_resp[1][:])) log.(abs.(true_resp[1][:]))]) # bodeplot([P.sys, arxtf]) +end