From 33801c71a2204ec2ace58f1b147f4648de68f8d5 Mon Sep 17 00:00:00 2001 From: schillic Date: Thu, 7 Mar 2024 07:02:38 +0100 Subject: [PATCH] update old SX models --- .../AFF/Powertrain/old/runSXDriveTrain.jl | 15 +++++++------ .../SX/runSX_filtered_oscillator.jl | 21 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/models/ARCH/AFF/Powertrain/old/runSXDriveTrain.jl b/models/ARCH/AFF/Powertrain/old/runSXDriveTrain.jl index 7a38f3c..3454196 100644 --- a/models/ARCH/AFF/Powertrain/old/runSXDriveTrain.jl +++ b/models/ARCH/AFF/Powertrain/old/runSXDriveTrain.jl @@ -1,8 +1,12 @@ # Drive train example # ============================ +using ReachabilityBenchmarks using HybridSystems, MathematicalSystems, LazySets, Plots -import SX: is_halfspace, is_hyperplane, convert, parse_sxmath +import Polyhedra +using SpaceExParser: is_halfspace, is_hyperplane, convert, parse_sxmath, Basic, readsxmodel + +HS = readsxmodel(@current_path "drivetrain_theta1_5percent_flat_manually.xml") x1 = parse_sxmath("x1 - -0.0488 == 0.0005600000000000001 * (x4 - 20.0)") x2 = parse_sxmath("x2 - -15.67 == 0.46699999999999997 * (x4 - 20.0)") @@ -15,6 +19,7 @@ x8 = parse_sxmath("x8 - -0.0019199999999999998 == 0.00005999999999999998 * (x4 - x9 = parse_sxmath("x9 - 20.0 == 1.0 * (x4 - 20.0)") t = parse_sxmath("t == 0.0") +# initial condition in mode 1 expr_p = parse_sxmath("x1 - -0.0488 == 0.0005600000000000001 * (x4 - 20.0) & x2 - -15.67 == 0.46699999999999997 * (x4 - 20.0) & x3 == 0.0 & x5 == 0.0 & x6 - 20.0 == 1.0 * (x4 - 20.0) & x7 - 240.0 == 12.0 * (x4 - 20.0) & x8 - -0.0019199999999999998 == 0.00005999999999999998 * (x4 - 20.0) & x9 - 20.0 == 1.0 * (x4 - 20.0) & 20.0 <= x4 & x4 <= 40.0 & t == 0.0") expr = [x1, x2, x3, x4, x5, x6, x7, x8, x9, t] x0sets = [] @@ -27,19 +32,13 @@ for expr_i in expr_p end end -AFFINE_SYSTEM = ConstrainedLinearControlContinuousSystem -HS = readsxmodel("models/ARCH2018/Drivetrain/drivetrain_theta1_5percent_flat_manually.xml"; - raw_dict=true) -# initial condition in mode 1 +prob = InitialValueProblem(HS, x0sets) # calculate reachable states up to time T -prob = InitialValueProblem(HS, x0sets) input_options = Options(:mode => "reach") - problem_options = Options(:vars => [1, 3, 10], :T => 10.0, :δ => 0.005, :plot_vars => [1, 3], :verbosity => 1); options_input = merge(problem_options, input_options) -using Polyhedra sol = solve(HS, options_input); plot(sol; indices=1:2:length(sol.Xk)) diff --git a/models/FilteredOscillator/SX/runSX_filtered_oscillator.jl b/models/FilteredOscillator/SX/runSX_filtered_oscillator.jl index 7701690..3f23b8e 100644 --- a/models/FilteredOscillator/SX/runSX_filtered_oscillator.jl +++ b/models/FilteredOscillator/SX/runSX_filtered_oscillator.jl @@ -1,9 +1,13 @@ -# Drive train example +# Filtered oscillator # ============================ +using ReachabilityBenchmarks using HybridSystems, MathematicalSystems, LazySets, Plots -import SX: is_halfspace, is_hyperplane, convert, parse_sxmath -import LazySets.HalfSpace +import Polyhedra +using SpaceExParser: is_halfspace, is_hyperplane, convert, parse_sxmath, Basic, readsxmodel + +AFFINE_SYSTEM = ConstrainedLinearControlContinuousSystem +HS = readsxmodel(@current_path "filtered_oscillator_flattened.xml"; ST=AFFINE_SYSTEM) expr_p = parse_sxmath("0.2<=x & x<=0.3 & -0.1<=y & y<=0.1 & z==0 & x1==0 & x2==0 & x3==0") #expr = [x,y,x1,x2,x3,z] @@ -17,18 +21,13 @@ for expr_i in expr_p end end -AFFINE_SYSTEM = ConstrainedLinearControlContinuousSystem -HS = readsxmodel("models/SpaceEx/FilteredOscillator/filtered_oscillator_flattened.xml"; - ST=AFFINE_SYSTEM) +prob = InitialValueProblem(HS, x0sets) # calculate reachable states up to time T -prob = InitialValueProblem(HS, x0sets) input_options = Options(:mode => "reach"); - -problem_options = Options(:vars => 1:system_dimension, :T => 5.0, :δ => 0.05, - :plot_vars => [1, 2], :max_jumps => 1, :verbosity => 1, :init_loc => 3); +problem_options = Options(:vars => 1:system_dimension, :T => 5.0, :δ => 0.05, :plot_vars => [1, 2], + :max_jumps => 1, :verbosity => 1, :init_loc => 3); options_input = merge(problem_options, input_options) -using Polyhedra sol = solve(prob, options_input); plot(sol; indices=1:2:length(sol.Xk))