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


Python common.PostProcess类代码示例

本文整理汇总了Python中common.PostProcess的典型用法代码示例。如果您正苦于以下问题:Python PostProcess类的具体用法?Python PostProcess怎么用?Python PostProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PostProcess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    mat_file_name = sys.argv[1]
    limits_dict, filter = read_limits()
    
    filter.append('SpeedSensor.v')
    # loads results with the filtered out variables (and 'time' which is default)
    pp = PostProcess(mat_file_name, filter)
    metrics = {}
    # No need to convert values into string that is done in update_metrics_in_report_json
    metrics.update({'MaximumSpeed' : {'value': pp.global_max('SpeedSensor.v'), 'unit': 'm/s'}})
    
    cwd = os.getcwd()
    os.chdir('..')
    update_metrics_in_report_json(metrics)
    check_limits_and_add_to_report_json(pp, limits_dict)
    os.chdir(cwd)
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:16,代码来源:get_max_speed.py

示例2: main

def main():
    mat_file_name = sys.argv[1]
    limits_dict, filter = read_limits()

    filter.append("SpeedSensor.v")
    # loads results with the filtered out variables (and 'time' which is default)
    pp = PostProcess(mat_file_name, filter)
    metrics = {}
    # No need to convert values into string that is done in update_metrics_in_report_json
    metrics.update({"MaxSpeed": {"value": pp.global_abs_max("SpeedSensor.v"), "unit": "m/s"}})

    cwd = os.getcwd()
    os.chdir("..")
    update_metrics_in_report_json(metrics)
    check_limits_and_add_to_report_json(pp, limits_dict)
    os.chdir(cwd)
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:16,代码来源:get_max_speed.py

示例3: read_limits

        mat_file_name = sys.argv[1]
        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")
        filter.append("road_Wheel_Load_Both_Sides.Accel_20kph")
        filter.append("design_v1.EngineHeatPort.T")

        # loads results with the filtered out variables (and 'time' which is default)
        pp = PostProcess(mat_file_name, filter)
        metrics = {}

        metrics.update(
            {"MaxVehicleSpeed": {"value": pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"), "unit": "kph"}}
        )
        metrics.update({"Acc20kph": {"value": pp.last_value("road_Wheel_Load_Both_Sides.Accel_20kph"), "unit": "s"}})
        metrics.update(
            {"EngineTemperature": {"value": pp.last_value("design_v1.EngineHeatPort.T") - 273.15, "unit": "C"}}
        )

        cwd = os.getcwd()
        os.chdir("..")
        update_metrics_in_report_json(metrics)
        ## end of postprocessing part
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:30,代码来源:hill_climb_v2.py

示例4: read_limits

        mat_file_name = sys.argv[1]
        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.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed")
        filter.append("road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_20kph")
        filter.append("design_v1.EngineHeatPort.T")

        # loads results with the filtered out variables (and 'time' which is default)
        pp = PostProcess(mat_file_name, filter)
        metrics = {}

        metrics.update(
            {
                "MaxVehicleSpeed": {
                    "value": pp.global_abs_max(
                        "road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed"
                    ),
                    "unit": "kph",
                }
            }
        )
        metrics.update(
            {
                "Acc20kph": {
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:31,代码来源:hill_climb.py

示例5: main

def main():
    mat_file_name = sys.argv[1]
    if not os.path.exists(mat_file_name):
        raise IOError("Given result file does not exist: {0}".format(sys.argv[1]))

    ## First limit part
    limit_dict, filter = read_limits()
    ## End of first limit part

    ## Post processing part
    bucketCylLength_uri = "Excavator_.bucketCylLength_unit"
    filter.append(bucketCylLength_uri)
    armCylLength_uri = "Excavator_.armCylLength_unit"
    filter.append(armCylLength_uri)
    boomCylLength_uri = "Excavator_.boomCylLength_unit"
    filter.append(boomCylLength_uri)
    boomCylRPressure_uri = "Excavator_.boomCylLPressure_a"
    filter.append(boomCylRPressure_uri)
    armCylPressure_uri = "Excavator_.armCylPressure_a"
    filter.append(armCylPressure_uri)
    bucketCylPressure_uri = "Excavator_.bucketCylPressure_a"
    filter.append(bucketCylPressure_uri)
    arm_ang_vel_uri = "Excavator_.arm_ang_vel"
    filter.append(arm_ang_vel_uri)
    max_Y_uri = "Excavator_.yDistance"
    filter.append(max_Y_uri)
    max_reach_uri = "Excavator_.xDistance"
    filter.append(max_reach_uri)
    State_uri = "operator_Full.State_1"
    filter.append(State_uri)
    tip_uri = "Excavator_.tipping_torque"
    filter.append(tip_uri)
    deflection_uri = "Excavator_.yDistance"
    filter.append(deflection_uri)

    # loads results with the filtered out variables (and 'time' which is default)
    pp = PostProcess(mat_file_name, filter)

    max_p_time = pp.global_max_time(boomCylRPressure_uri)
    max_v_time = pp.global_max_time(arm_ang_vel_uri)
    # max_p_time = pp.global_max_time(armCylPressure_uri)
    # max_p_time = pp.global_max_time(bucketCylPressure_uri)
    print "Maximum pressure obtained at : {0}".format(max_p_time)
    print "Max tip torque : {0}".format(pp.global_abs_max(tip_uri))
    y_deflection = pp.get_data_by_index(deflection_uri, 0) - pp.last_value(deflection_uri)

    metrics = {}
    metrics.update(
        {
            "bucketCylLength_unit": {"value": pp.get_data_by_time(bucketCylLength_uri, max_p_time)[0], "unit": "m"},
            "boomCylLength_unit": {"value": pp.get_data_by_time(boomCylLength_uri, max_p_time)[0], "unit": "m"},
            "armCylLength_unit": {"value": pp.get_data_by_time(armCylLength_uri, max_p_time)[0], "unit": "m"},
            "bucketCylPressure": {"value": pp.global_abs_max(bucketCylPressure_uri) * 0.00001, "unit": "bar"},
            "boomCylRPressure": {"value": pp.global_abs_max(boomCylRPressure_uri) * 0.00001, "unit": "bar"},
            "armCylPressure": {"value": pp.global_abs_max(armCylPressure_uri) * 0.00001, "unit": "bar"},
            "tipTorque": {"value": pp.global_abs_max(tip_uri), "unit": "N-m"},
            "y_deflection": {"value": y_deflection, "unit": "m"},
            #'swing_speed': {'value': pp.last_value(swing_uri), 'unit':'rad/s'},
        }
    )

    cwd = os.getcwd()
    os.chdir("..")
    # print 'Plot saved to : {0}'.format(pp.save_as_svg(vehicle_speed,
    # pp.global_abs_max(vehicle_speed),
    # 'VehicleSpeed',
    # 'max(FTP_Driver.driver_bus.vehicle_speed)',
    # 'kph'))
    dur = 100
    pp.store_data_to_csv(bucketCylLength_uri, "{0}.csv".format(bucketCylLength_uri), 0, 0.1, dur)
    pp.store_data_to_csv(armCylLength_uri, "{0}.csv".format(armCylLength_uri), 0, 0.1, dur)
    pp.store_data_to_csv(boomCylLength_uri, "{0}.csv".format(boomCylLength_uri), 0, 0.1, dur)
    pp.store_data_to_csv(boomCylRPressure_uri, "{0}.csv".format(boomCylRPressure_uri), 0, 0.1, dur)
    pp.store_data_to_csv(arm_ang_vel_uri, "{0}.csv".format(arm_ang_vel_uri), 0, 0.1, dur)
    pp.store_data_to_csv(max_Y_uri, "{0}.csv".format(max_Y_uri), 0, 0.1, dur)
    pp.store_data_to_csv(max_reach_uri, "{0}.csv".format(max_reach_uri), 0, 0.1, dur)
    pp.store_data_to_csv(State_uri, "{0}.csv".format(State_uri), 0, 0.1, dur)
    ## end of postprocessing part

    ## Second limit part
    check_limits_and_add_to_report_json(pp, limit_dict)
    update_metrics_in_report_json(metrics)
    ## end of Second limit part
    os.chdir(cwd)
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:84,代码来源:Load.py

示例6: main

def main():
    mat_file_name = sys.argv[1]
    if not os.path.exists(mat_file_name):
        raise IOError('Given result file does not exist: {0}'.format(sys.argv[1]))

    ## First limit part
    limit_dict, filter = read_limits()
    ## End of first limit part

    ## Post processing part
    bucketCylLength_uri = 'Excavator_.bucketCylLength_unit'
    filter.append(bucketCylLength_uri)
    armCylLength_uri = 'Excavator_.armCylLength_unit'
    filter.append(armCylLength_uri)
    boomCylLength_uri = 'Excavator_.boomCylLength_unit'
    filter.append(boomCylLength_uri)
    boomCylRPressure_uri = 'Excavator_.boomCylLPressure_a'
    filter.append(boomCylRPressure_uri)    
    armCylPressure_uri = 'Excavator_.armCylPressure_a'
    filter.append(armCylPressure_uri)
    bucketCylPressure_uri = 'Excavator_.bucketCylPressure_a'
    filter.append(bucketCylPressure_uri)
    arm_ang_vel_uri = 'Excavator_.arm_ang_vel'
    filter.append(arm_ang_vel_uri)
    max_Y_uri = 'Excavator_.yDistance'
    filter.append(max_Y_uri)
    max_reach_uri = 'Excavator_.xDistance'
    filter.append(max_reach_uri)
    State_uri = 'operator_Full.State_1'
    filter.append(State_uri)

    # loads results with the filtered out variables (and 'time' which is default)
    pp = PostProcess(mat_file_name, filter)
    
    max_p_time = pp.global_max_time(boomCylRPressure_uri)
    max_v_time = pp.global_max_time(arm_ang_vel_uri)
    #max_p_time = pp.global_max_time(armCylPressure_uri)
    #max_p_time = pp.global_max_time(bucketCylPressure_uri)
    print 'Maximum pressure obtained at : {0}'.format(max_p_time)
    print 'Maximum velocity obtained at : {0}'.format(max_v_time)
    print 'Maximum Reach obtained at : {0}'.format(pp.global_max_time(max_reach_uri))
    print 'Max reach is : {0}'.format(pp.global_max(max_reach_uri))
    
    time = pp.get_time(State_uri,2)
    print 'First entry of State 2 at : {0}'.format(time)
    
    index = pp.get_index_from_time(time)
    print 'first entry of state2 index : {0}'.format(index)
    
    time2 = pp.get_time(State_uri, 4)
    print 'Exit of state 2 at : {0}'.format(time2)
    
    index2 = pp.get_index_from_time(time2)
    print 'Exit of state 2 index : {0}'.format(index2)    
    
    time3 = pp.get_time(State_uri,2,1e-4,1e-4,index2+1)
    print '2nd entry of state 2 : {0}'.format(time3)
    
    index3 = pp.get_index_from_time(time3)
    print 'index of second entry of state 2 : {0}'.format(index3)    
    
    dt = pp.delta_t(index, index3)
    print 'Cycle Time : {0}'.format(dt)
    initTime = pp.get_index_from_time(1)
    armPressure = pp.get_local_max(armCylPressure_uri,initTime,-1)*0.00001
    print 'arm Pressure : {0}'.format(armPressure)
    
    
	
    metrics = {}
    metrics.update({'bucketCylLength_unit': {'value': pp.get_data_by_time(bucketCylLength_uri, max_p_time)[0], 'unit': 'm'},
                    'boomCylLength_unit': {'value': pp.get_data_by_time(boomCylLength_uri, max_p_time)[0], 'unit': 'm'},
                    'armCylLength_unit': {'value': pp.get_data_by_time(armCylLength_uri, max_p_time)[0], 'unit': 'm'},
                    'bucketCylPressure': {'value': pp.global_abs_max(bucketCylPressure_uri)*0.00001, 'unit': 'bar'},
                    'boomCylRPressure': {'value': pp.global_abs_max(boomCylRPressure_uri)*0.00001, 'unit': 'bar'},                    
                    'armCylPressure': {'value': armPressure, 'unit': 'bar'},					
                    'arm_angVel' : {'value': pp.global_abs_max(arm_ang_vel_uri), 'unit':'rads/s'},
					
                    'max_reach':{'value':pp.global_max(max_reach_uri),'unit':'m'},
                    'max_high_reach' : {'value': pp.global_max(max_Y_uri), 'unit':'m'},
                    'max_low_reach': {'value': pp.global_min(max_Y_uri), 'unit':'m'},
                    'cycle_time': {'value': dt, 'unit':'s'},
                    #'swing_speed': {'value': pp.last_value(swing_uri), 'unit':'rad/s'},
                    })

    cwd = os.getcwd()
    os.chdir('..')
    # print 'Plot saved to : {0}'.format(pp.save_as_svg(vehicle_speed,
                                                      # pp.global_abs_max(vehicle_speed),
                                                      # 'VehicleSpeed',
                                                      # 'max(FTP_Driver.driver_bus.vehicle_speed)',
                                                      # 'kph'))
    dur = 100
    pp.store_data_to_csv(bucketCylLength_uri, '{0}.csv'.format(bucketCylLength_uri), 0, 0.1, dur)
    pp.store_data_to_csv(armCylLength_uri, '{0}.csv'.format(armCylLength_uri), 0, 0.1, dur)
    pp.store_data_to_csv(boomCylLength_uri, '{0}.csv'.format(boomCylLength_uri), 0, 0.1, dur)
    pp.store_data_to_csv(boomCylRPressure_uri, '{0}.csv'.format(boomCylRPressure_uri), 0, 0.1, dur)
    pp.store_data_to_csv(arm_ang_vel_uri, '{0}.csv'.format(arm_ang_vel_uri), 0, 0.1, dur)
    pp.store_data_to_csv(max_Y_uri, '{0}.csv'.format(max_Y_uri), 0, 0.1, dur)
    pp.store_data_to_csv(max_reach_uri, '{0}.csv'.format(max_reach_uri), 0, 0.1, dur)
#.........这里部分代码省略.........
开发者ID:cephdon,项目名称:meta-core,代码行数:101,代码来源:ROM.py

示例7: len

if __name__ == '__main__':
    if len(sys.argv) > 1:
        mat_file_name = sys.argv[1]
        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)
        #pressure_variable_name = [var_name for var_name in filter if var_name.endswith('hot_fluid_out.p')][0]
        metrics = {}
        metrics.update({'VehicleSpeed': {'value': pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"), 'unit': 'kph'}})
        #metrics.update({'EngineAirPressure': {'value': pp.last_value(pressure_variable_name), 'unit': 'Pascal'}})

        cwd = os.getcwd()
        os.chdir('..')
        update_metrics_in_report_json(metrics)
        ## end of postprocessing part

        ## Second limit part
        check_limits_and_add_to_report_json(pp, limit_dict)
        ## end of Second limit part
        os.chdir(cwd)
开发者ID:dyao-vu,项目名称:meta-core,代码行数:30,代码来源:full_speed_forward_1_metric.py

示例8: len

import os
from common import PostProcess, update_metrics_in_report_json, read_limits, check_limits_and_add_to_report_json

if __name__ == '__main__':
    if len(sys.argv) > 1:
        try:
            mat_file_name = sys.argv[1]
            if not os.path.exists(mat_file_name):
                print 'Given result file does not exist: {0}'.format(sys.argv[1])
                os._exit(3)
            
            limits_dict, filter = read_limits()
            
            filter.append('SpeedSensor.v')
            # loads results with the filtered out variables (and 'time' which is default)
            pp = PostProcess(mat_file_name, filter)

            metrics = {}
            # No need to convert values into string that is done in update_metrics_in_report_json
            metrics.update({'Velocity' : {'value': pp.global_abs_max('SpeedSensor.v'), 'unit': 'm/s'}})
            
            cwd = os.getcwd()
            os.chdir('..')      
            update_metrics_in_report_json(metrics)
            
            check_limits_and_add_to_report_json(pp, limits_dict)
            os.chdir(cwd)
        except Exception as err:
            print err.message
            if os.name == 'nt':
                import win32api
开发者ID:dyao-vu,项目名称:meta-core,代码行数:31,代码来源:get_velocity.py

示例9: read_limits

        mat_file_name = sys.argv[1]
        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')
        filter.append('road_Wheel_Load_Both_Sides.Accel_20kph')
        filter.append('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)
        #pressure_variable_name = [var_name for var_name in filter if var_name.endswith('hot_fluid_out.p')][0]
        metrics = {}
        metrics.update({'VehicleSpeed': {'value': pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"), 'unit': 'kph'}})
        metrics.update({'Acc20kph': {'value': pp.last_value('road_Wheel_Load_Both_Sides.Accel_20kph'), 'unit': 's'}})
        metrics.update({'Acc40kph': {'value': pp.last_value('road_Wheel_Load_Both_Sides.Accel_40kph'), 'unit': 's'}})
        #metrics.update({'EngineAirPressure': {'value': pp.last_value(pressure_variable_name), 'unit': 'Pascal'}})

        cwd = os.getcwd()
        os.chdir('..')
        print 'Plot saved to : {0}'.format(pp.save_as_svg('road_Wheel_Load_Both_Sides.vehicleSpeed', 
                                                          pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"),
                                                          'VehicleSpeed',
                                                          'max(road_Wheel_Load_Both_Sides.vehicleSpeed)',
                                                          'km/h'))
        print 'Plot saved to : {0}'.format(pp.save_as_svg('road_Wheel_Load_Both_Sides.Accel_20kph', 
开发者ID:dyao-vu,项目名称:meta-core,代码行数:31,代码来源:full_speed_forward_v2.py

示例10: read_limits

        mat_file_name = sys.argv[1]
        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.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed')
        filter.append('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_20kph')
        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)
        #pressure_variable_name = [var_name for var_name in filter if var_name.endswith('hot_fluid_out.p')][0]
        metrics = {}
        metrics.update({'VehicleSpeed': {'value': pp.global_abs_max("road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed"), 'unit': 'kph'}})
        metrics.update({'Acc20kph': {'value': pp.last_value('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_20kph'), 'unit': 's'}})
        metrics.update({'Acc40kph': {'value': pp.last_value('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_40kph'), 'unit': 's'}})
        #metrics.update({'EngineAirPressure': {'value': pp.last_value(pressure_variable_name), 'unit': 'Pascal'}})

        update_metrics_in_report_json(metrics)
        ## end of postprocessing part

        ## Second limit part
        check_limits_and_add_to_report_json(pp, limit_dict)
        ## end of Second limit part

开发者ID:dyao-vu,项目名称:meta-core,代码行数:29,代码来源:full_speed_forward.py

示例11: len

import os
from common import PostProcess, update_metrics_in_report_json, read_limits, check_limits_and_add_to_report_json

if __name__ == '__main__':
    if len(sys.argv) > 1:
        try:
            mat_file_name = sys.argv[1]
            if not os.path.exists(mat_file_name):
                print 'Given result file does not exist: {0}'.format(sys.argv[1])
                os._exit(3)
            
            limits_dict, filter = read_limits()
            
            filter.append('VoltageSensor.v')
            # loads results with the filtered out variables (and 'time' which is default)
            pp = PostProcess(mat_file_name, filter)

            metrics = {}
            # No need to convert values into string that is done in update_metrics_in_report_json
            metrics.update({'VoltageOverInductor' : {'value': pp.global_max('VoltageSensor.v'), 'unit': 'V'}})
            
            cwd = os.getcwd()
            os.chdir('..')      
            update_metrics_in_report_json(metrics)
            
            check_limits_and_add_to_report_json(pp, limits_dict)
            os.chdir(cwd)
        except Exception as err:
            print err.message
            if os.name == 'nt':
                import win32api
开发者ID:dyao-vu,项目名称:meta-core,代码行数:31,代码来源:RICircuit.py

示例12: read_limits

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

示例13: len

import os
from common import PostProcess, update_metrics_in_report_json, read_limits, check_limits_and_add_to_report_json

if __name__ == '__main__':
    if len(sys.argv) > 1:
        try:
            mat_file_name = sys.argv[1]
            if not os.path.exists(mat_file_name):
                print 'Given result file does not exist: {0}'.format(sys.argv[1])
                os._exit(3)
            
            limits_dict, filter = read_limits()
            
            filter.append('VoltageSensor.v')
            # loads results with the filtered out variables (and 'time' which is default)
            pp = PostProcess(mat_file_name, filter)

            metrics = {}
            # No need to convert values into string that is done in update_metrics_in_report_json
            metrics.update({'VoltageOverInductor' : {'value': pp.global_max('VoltageSensor.v'), 'unit': 'Volt'}})
            metrics.update({'VoltageOverInductor10' : {'value': pp.global_max('VoltageSensor.v') * 10, 'unit': 'deciVolt'}})
            metrics.update({'VoltageOverInductor100' : {'value': pp.global_max('VoltageSensor.v') * 100, 'unit': 'centiVolt'}})
            cwd = os.getcwd()
            os.chdir('..')      
            update_metrics_in_report_json(metrics)
            
            check_limits_and_add_to_report_json(pp, limits_dict)
            os.chdir(cwd)
        except Exception as err:
            print err.message
            if os.name == 'nt':
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:31,代码来源:RICircuit3Metrics.py

示例14: read_limits

        mat_file_name = sys.argv[1]
        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")
        filter.append("road_Wheel_Load_Both_Sides.Accel_20kph")
        filter.append("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)
        # pressure_variable_name = [var_name for var_name in filter if var_name.endswith('hot_fluid_out.p')][0]
        metrics = {}
        metrics.update(
            {"VehicleSpeed": {"value": pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"), "unit": "kph"}}
        )
        metrics.update({"Acc20kph": {"value": pp.last_value("road_Wheel_Load_Both_Sides.Accel_20kph"), "unit": "s"}})
        metrics.update({"Acc40kph": {"value": pp.last_value("road_Wheel_Load_Both_Sides.Accel_40kph"), "unit": "s"}})
        # metrics.update({'EngineAirPressure': {'value': pp.last_value(pressure_variable_name), 'unit': 'Pascal'}})

        cwd = os.getcwd()
        os.chdir("..")
        print "Plot saved to : {0}".format(
            pp.save_as_svg(
                "road_Wheel_Load_Both_Sides.vehicleSpeed",
                pp.global_abs_max("road_Wheel_Load_Both_Sides.vehicleSpeed"),
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:31,代码来源:full_speed_forward_v2.py

示例15: read_limits

        mat_file_name = sys.argv[1]
        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.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed')
        filter.append('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_20kph')
        filter.append('design_v1.EngineHeatPort.T')

        # loads results with the filtered out variables (and 'time' which is default)
        pp = PostProcess(mat_file_name, filter)
        metrics = {}
        
        metrics.update({'MaxVehicleSpeed': {'value': pp.global_abs_max("road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.vehicleSpeed"), 'unit': 'kph'}})
        metrics.update({'Acc20kph': {'value': pp.last_value('road_Wheel_Load_Both_Sides.ModelicaModel_road_Wheel_Load_Both_Sides.Accel_20kph'), 'unit': 's'}})
        metrics.update({'EngineTemperature': {'value': pp.last_value('design_v1.EngineHeatPort.T') - 273.15, 'unit': 'C'}})

        update_metrics_in_report_json(metrics)
        ## end of postprocessing part

        ## Second limit part
        check_limits_and_add_to_report_json(pp, limit_dict)
        ## end of Second limit part


开发者ID:dyao-vu,项目名称:meta-core,代码行数:28,代码来源:hill_climb.py


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