How to calculate the rise time, power overshoot and settling time of a power vs. time graph using python

Viewed 4293

I am trying to measure the rise time, power overshoot and settling time of a power vs. time (signal output) graph in python. Do you know a python function that would allow me to calculate these 3 parameters?

The 3 parameters are defined as follows:

  1. Rise time = time to go from 10% to 90% of the 'on' power output values
  2. % Overshoot = ((maximum power value) - (final 'on' power value)) / (final 'on' power value)
  3. settling time = time for signal's power output to be within x% of a steady state value

The power (amplitude) vs. time graph is similar to the 1st graph on Matlab's stepinfo guide https://uk.mathworks.com/help/control/ref/stepinfo.html

I have a .csv file with the power and time values, so I load these in as a dataframe and plot power vs. time. But from this graph, I am not sure how to calculate the 3 parameters I need

import numpy as np
import matplotlib.pyplot as plt
import csv
import pandas as pd


time = [] # initialise time array
power = [] # initialise power array

df_csv = pd.read_csv('PvsV_SOA_comma.csv') # loads .csv file as a pandas 
dataframe

time = df_csv.iloc[:, 0] # sets time array equal to data in 1st (index 
from 0) column of datafram, selecting all rows
power = df_csv.iloc[:, 1] # sets voltage array

plt.plot(time, voltage) 
plt.xlabel('Time (s)')
plt.ylabel('Power (W)')
1 Answers

If your Power response like second order step response(as shown on Matlab's stepinfo guide)

Fast Method

  1. You need to find "steady state value" first. If you have real value you can use it if not, You need to capture long enough and use final value in csv as "steady state value"
  2. For first data in csv as "start value" now you can find time series that power cross 90% of steady state value
  3. you can find Max value on csv and compare with steady state value to get %OS
  4. You can trace backward from last value to find first data that cross +- x% of steady state value

Precise way

You need to know model of you system and use csv file to run system identification. then you got model parameter and you can calculate more precise time response characteristic

Related