# -*- coding: utf-8 -*-
"""
Created on Jun 2 2021

@author: Alex
"""

from pyro.dynamic                 import pendulum
from pyro.dynamic.tranferfunction import ss2tf
from pyro.dynamic.statespace      import linearize
    
non_linear_sys = pendulum.SinglePendulum()

non_linear_sys.lc1     = 1
non_linear_sys.m1      = 2
non_linear_sys.I1      = 2
non_linear_sys.d1      = 2
non_linear_sys.gravity = 9.81

linearized_sys = linearize( non_linear_sys )
siso_sys       = ss2tf( linearized_sys, 0, 0)

print('Poles',siso_sys.poles)
print('num',siso_sys.num)
print('den',siso_sys.den)

siso_sys.bode_plot()

# Shortcut
non_linear_sys.plot_linearized_bode()