## ## Copyright (c) 2019 ## ## @author: Daniel Bankmann ## @company: Technische Universität Berlin ## ## This file is part of the python package analyticcenter ## (see https://gitlab.tu-berlin.de/PassivityRadius/analyticcenter/) ## ## License: 3-clause BSD, see https://opensource.org/licenses/BSD-3-Clause ## import numpy as np from analyticcenter import WeightedSystem A = np.matrix([[-1]]) B = np.matrix([[1]]) C = B.T D = C @ B Q = np.zeros((1,1)) sys = WeightedSystem(A, B, C, D, Q, B, D + D.T)
## ## Copyright (c) 2019 ## ## @author: Daniel Bankmann ## @company: Technische Universität Berlin ## ## This file is part of the python package analyticcenter ## (see https://gitlab.tu-berlin.de/PassivityRadius/analyticcenter/) ## ## License: 3-clause BSD, see https://opensource.org/licenses/BSD-3-Clause ## import numpy as np from analyticcenter import WeightedSystem A = -2 * np.matrix([[1, -1], [1, 1]]) B = np.matrix([[1], [1]]) C = B.T D = C @ B Q = 0 * np.identity(2) sys = WeightedSystem(A, B, C, D, Q, B, 2 * D)
## ## Copyright (c) 2017 ## ## @author: Daniel Bankmann ## @company: Technische Universität Berlin ## ## This file is part of the python package analyticcenter ## (see https://gitlab.tu-berlin.de/PassivityRadius/analyticcenter/) ## ## License: 3-clause BSD, see https://opensource.org/licenses/BSD-3-Clause ## import numpy as np from analyticcenter import WeightedSystem sysmat = np.load('test/test_examples/example-n-6-m-1.npy', allow_pickle=True) sys = WeightedSystem(*sysmat)
p = 0 # Number of systems to connect num = np.array([1 / (L * C)]) den = np.array([1, RR / L, 1 / (L * C)]) # # num = np.array([1 / (RR * C), 0]) # den = np.array([1, 1 / (RR * C), 1 / (L * C)]) tf = control.tf(num, den) ss = tf for i in range(p): ss = control.series(ss, tf) sys = control.tf2ss(ss) A = sys.A B = sys.B C = np.asmatrix(sys.C) D = np.asmatrix(sys.D) + 1 # D = np.matrix([1]) n = A.shape[0] Q = np.zeros((n, n)) S = C.H R = D + D.H sys = WeightedSystem(A, B, C, D, Q, S, R) # sys.check_passivity()
## ## @author: Daniel Bankmann ## @company: Technische Universität Berlin ## ## This file is part of the python package analyticcenter ## (see https://gitlab.tu-berlin.de/PassivityRadius/analyticcenter/) ## ## License: 3-clause BSD, see https://opensource.org/licenses/BSD-3-Clause ## import numpy as np from os.path import join, dirname import analyticcenter from analyticcenter import WeightedSystem, get_algorithm_object from analyticcenter import NewtonDirectionMultipleDimensionsCT from analyticcenter import SteepestAscentDirectionCT from pkg_resources import resource_filename _example_file = resource_filename(__name__, 'example-n-30-m-10.npy') sysmat = np.load(_example_file, allow_pickle=True) sys = WeightedSystem(*sysmat) if __name__=="__main__": alg = get_algorithm_object(sys, 'newton', discrete_time=False, save_intermediate=True) alg.maxiter = 1000 (ac_newton, success) = alg() sys_disc = sys.bilinear_discretization() alg_newton_disc = get_algorithm_object(sys_disc, 'newton', discrete_time=True, save_intermediate=True) (ac_newton_disc, success) = alg_newton_disc()