本文整理汇总了Python中common.PostProcess.data_array方法的典型用法代码示例。如果您正苦于以下问题:Python PostProcess.data_array方法的具体用法?Python PostProcess.data_array怎么用?Python PostProcess.data_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.PostProcess
的用法示例。
在下文中一共展示了PostProcess.data_array方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_limits
# 需要导入模块: from common import PostProcess [as 别名]
# 或者: from common.PostProcess import data_array [as 别名]
if not os.path.exists(mat_file_name):
print "Given result file does not exist: {0}".format(sys.argv[1])
os._exit(3)
## First limit part
limit_dict, filter = read_limits()
## End of first limit part
## Post processing part
filter.append("road_Wheel_Load_Both_Sides.vehicleSpeed")
# loads results with the filtered out variables (and 'time' which is default)
pp = PostProcess(mat_file_name, filter)
metrics = {}
speed_array = pp.data_array("road_Wheel_Load_Both_Sides.vehicleSpeed")
time_array = pp.time_array()
n = len(speed_array)
acc10kph = -1
points = range(n)
for i in points:
if speed_array[i] < -10:
acc10kph = time_array[i]
break
max_rev_speed = speed_array[-1]
points.reverse()
tol = 0.001
time_to_max = 0
示例2: read_limits
# 需要导入模块: from common import PostProcess [as 别名]
# 或者: from common.PostProcess import data_array [as 别名]
## First limit part
limit_dict, filter = read_limits()
## End of first limit part
## Post processing part
filter.append('PositionSensor.s')
filter.append('SpeedSensor.v')
filter.append('AccSensor.a')
# loads results with the filtered out variables (and 'time' which is default)
pp = PostProcess(mat_file_name, filter)
metrics = {}
time_array = pp.time_array()
velocity_array = pp.data_array('SpeedSensor.v')
acceleration_array = pp.data_array('AccSensor.a')
position = pp.last_value('PositionSensor.s')
zero = pp.find_zero(velocity_array,acceleration_array,time_array)
if zero != -1:
time_to_zero = zero
stopped_moving = True
else:
time_to_zero = 10000
stopped_moving = False
metrics.update({'Time_to_Zero': {'value': time_to_zero, 'unit': 's'}})
示例3: variables
# 需要导入模块: from common import PostProcess [as 别名]
# 或者: from common.PostProcess import data_array [as 别名]
# loads results with the filtered out variables (and 'time' which is default)
pp = PostProcess(mat_file_name, filter)
t = pp.time
# Liters of fuel used per 100km
#volume_var_name = [var_name for var_name in filter if var_name.endswith('tank.V')][0]
#volume = pp.data_array(volume_var_name)
fuel_used = 1 #(volume[0] - volume[-1])*1000
distance_covered_m = pp.integrate('driver_Land_Profile.driver_control.error_current.u2')
if distance_covered_m != 0:
fuel_consumption = fuel_used/(distance_covered_m*1000*100)
else:
fuel_consumption = -1
#vehicle_speed_SI = pp.data_array('driver_Land_Profile.driver_control.error_current.u2')
# Deviation from requested speed
e = pp.data_array('driver_Land_Profile.driver_control.error_current.y')
index_neg = np.where(e < 0)[0]
index_pos = np.where(e > 0)[0]
rms_tot = RMS(e, t, t[-1])
rms_e_neg = RMS(e[index_neg], t[index_neg], t[-1])
rms_e_pos = RMS(e[index_pos], t[index_pos], t[-1])
avg_response = 1 / (1 + rms_tot)
acc_response = 1 / (1 + rms_e_neg)
dec_response = 1 / (1 + rms_e_pos)
metrics = {}
#metrics.update({'VehicleSpeed': {'value': pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"), 'unit': 'kph'}})
metrics.update({'DistanceCovered': {'value': distance_covered_m/1000, 'unit': 'km'}})
示例4: read_limits
# 需要导入模块: from common import PostProcess [as 别名]
# 或者: from common.PostProcess import data_array [as 别名]
limit_dict, filter = read_limits()
## End of first limit part
## Post processing part
filter.append('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed')
filter.append('driver_Land_Profile.ModelicaModel_Driver_Land_Profile.driver_control.error_current.y')
filter.append('driver_Land_Profile.ModelicaModel_Driver_Land_Profile.driver_control.error_current.u2')
#filter.append('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_40kph')
# loads results with the filtered out variables (and 'time' which is default)
pp = PostProcess(mat_file_name, filter)
t = pp.time
# Liters of fuel used per 100km
volume_var_name = [var_name for var_name in filter if var_name.endswith('tank.V')][0]
volume = pp.data_array(volume_var_name)
fuel_used = (volume[0] - volume[-1])*1000
distance_covered_m = pp.integrate('driver_Land_Profile.ModelicaModel_Driver_Land_Profile.driver_control.error_current.u2')
if distance_covered_m != 0:
fuel_consumption = fuel_used/(distance_covered_m*1000*100)
else:
fuel_consumption = -1
#vehicle_speed_SI = pp.data_array('driver_Land_Profile.ModelicaModel_Driver_Land_Profile.driver_control.error_current.u2')
# Deviation from requested speed
e = pp.data_array('driver_Land_Profile.ModelicaModel_Driver_Land_Profile.driver_control.error_current.y')
index_neg = np.where(e < 0)[0]
index_pos = np.where(e > 0)[0]
rms_tot = RMS(e, t, t[-1])