当前位置: 首页>>代码示例>>Python>>正文


Python PostProcess.data_array方法代码示例

本文整理汇总了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
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:33,代码来源:full_speed_reverse_v2.py

示例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'}})
开发者ID:pombreda,项目名称:metamorphosys-desktop,代码行数:32,代码来源:MSDPostProcessing.py

示例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'}})
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:33,代码来源:the_sunday_drive_v2.py

示例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])
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:33,代码来源:the_sunday_drive.py


注:本文中的common.PostProcess.data_array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。