Example #1
0
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('..')
    print 'Plot saved to : {0}'.format(pp.save_as_svg('SpeedSensor.v', 
                                                  pp.global_abs_max('SpeedSensor.v'),
                                                  'MaxSpeed',
                                                  'max(SpeedSensor.v)',
                                                  'm/s'))
    update_metrics_in_report_json(metrics)
    check_limits_and_add_to_report_json(pp, limits_dict)
    os.chdir(cwd)
Example #2
0
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('..')
    print 'Plot saved to : {0}'.format(
        pp.save_as_svg('SpeedSensor.v', pp.global_abs_max('SpeedSensor.v'),
                       'MaxSpeed', 'max(SpeedSensor.v)', 'm/s'))
    update_metrics_in_report_json(metrics)
    check_limits_and_add_to_report_json(pp, limits_dict)
    os.chdir(cwd)
        })
        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',
                pp.last_value('road_Wheel_Load_Both_Sides.Accel_20kph'),
                'Acc20kph',
                'last_value(road_Wheel_Load_Both_Sides.Accel_20kph)', 's'))
        print 'Plot saved to : {0}'.format(
            pp.save_as_svg(
                'road_Wheel_Load_Both_Sides.Accel_40kph',
                pp.last_value('road_Wheel_Load_Both_Sides.Accel_40kph'),
                'Acc40kph',
                'last_value(road_Wheel_Load_Both_Sides.Accel_40kph)', 's'))
        update_metrics_in_report_json(metrics)
        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', 
                                                          pp.last_value('road_Wheel_Load_Both_Sides.Accel_20kph'),
                                                          'Acc20kph',
                                                          'last_value(road_Wheel_Load_Both_Sides.Accel_20kph)',
                                                          's'))
        print 'Plot saved to : {0}'.format(pp.save_as_svg('road_Wheel_Load_Both_Sides.Accel_40kph', 
                                                          pp.last_value('road_Wheel_Load_Both_Sides.Accel_40kph'),
                                                          'Acc40kph',
                                                          'last_value(road_Wheel_Load_Both_Sides.Accel_40kph)',
                                                          's'))
        update_metrics_in_report_json(metrics)
        ## end of postprocessing part
        # 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",
                pp.last_value("road_Wheel_Load_Both_Sides.Accel_20kph"),
                "Acc20kph",
                "last_value(road_Wheel_Load_Both_Sides.Accel_20kph)",
                "s",
            )
        )
        print "Plot saved to : {0}".format(
            pp.save_as_svg(