Skip to content
Snippets Groups Projects
Commit fa42374d authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

Update tests

parent a726e7da
Branches
Tags v2014.1
No related merge requests found
Pipeline #
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
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment