<commit_before>
# Copyright (c) 2016 <NAME>. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html

"""
Controlled process
"""

import control
import logging
import matplotlib.pyplot as plt

def create_plant(args):
    """Creates the controlled process determined by the user input
       Plant creation supports poles (max:5), zeros (max:5), time delay

    :param poles
    :param zeros
    :param time_delay
    :param user_defined_plant
    :
    :type
    :type
    :type
    :type
    """
    poles = args.poles
    zeros = args.zeros
    time_delay = args.time_delay
    plant = control.TransferFunction(1, [1,1])
    (T , yout) = control.step_response(plant)
    plt.plot(T, yout)
    plt.show()


def plant_estimation(poles,zeros,time_delay,user_defined_plant):
    """The method takes the real plant as an input and returns the settling
       time of the plant's step response, the estimated DC gain (plant's steady
       state gain, an estimation of the plant's unmodelled dynamics and the
       plant transfer function [first order mode] based on the step response
       measurements). All above measurements will be used as an input for
       initializing the automatic tuning algorith,

       Plant creation supports poles (max:5), zeros (max:5), time delay

    :param poles
    :param zeros
    :param time_delay
    :param user_defined_plant
    :
    :type
    :type
    :type<commit_msg>Added step response plotting for Gp<commit_after>
# Copyright (c) 2016 <NAME>. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html

"""
Controlled process
"""

import control
import logging
import matplotlib
import matplotlib.pyplot as plt

def create_plant(args):
    """Creates the controlled process determined by the user input
       Plant creation supports poles (max:5), zeros (max:5), time delay

    :param poles
    :param zeros
    :param time_delay
    :param user_defined_plant
    :
    :type
    :type
    :type
    :type
    """
    poles = args.poles
    zeros = args.zeros
    time_delay = args.time_delay
    plant = control.TransferFunction(1, [1,1])
    (T , yout) = control.step_response(plant)
    fig, ax = plt.subplots()
    ax.plot(T, yout)
    
    ax.set(xlabel='time (s)', ylabel='yout (mV)',
           title='Plant Open Loop step response')
    plt.grid(color='k', linestyle='-.', linewidth=0.1)
    plt.show()


def plant_estimation(poles,zeros,time_delay,user_defined_plant):
    """The method takes the real plant as an input and returns the settling
       time of the plant's step response, the estimated DC gain (plant's steady
       state gain, an estimation of the plant's unmodelled dynamics and the
       plant transfer function [first order mode] based on the step response
       measurements). All above measurements will be used as an input for
       initializing the automatic tuning algorith,

       Plant creation supports poles (max:5), zeros (max:5), time delay

    :param poles
    :param zeros
    :param time_delay
    :param user_defined_plant
    :
    :type
    :type
    :type
{'fraction_non_alphanumeric': 0.0822637106184364, 'fraction_numerical': 0.009334889148191364, 'mean_word_length': 3.2229064039408866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4831485', 'n_tokens_mistral': 1020, 'n_tokens_neox': 975, 'n_words': 375}