Example #1
0
        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
        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

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

        os.chdir(cwd)
Example #3
0
        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


        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
Example #5
0
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)
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)
Example #7
0
        ## First limit part
        limit_dict, filter = read_limits()
        ## End of first limit part

        ## Post processing part
        filter.append('design.tank_level')
        filter.append('design.FuelTankVolume')
        filter.append('design.engine_heat_port.T')
        filter.append('driver_Land_Profile.driver_control.error_current.u2')

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

        start_fraction = pp.get_data_by_time('design.tank_level', 0.01)[0]
        end_fraction = pp.last_value('design.tank_level')
        tank_volume = pp.last_value('design.FuelTankVolume')
        distance_covered_m = pp.integrate(
            'driver_Land_Profile.driver_control.error_current.u2')

        print "start_fraction     : {0}".format(start_fraction)
        print "end_fraction       : {0}".format(end_fraction)
        print "tank_volume        : {0}".format(tank_volume)
        print "distance_covered_m : {0}".format(distance_covered_m)
        print "end_time           : {0}".format(pp.time[-1])

        metrics.update({
            'FuelConsumed': {
                'value': (start_fraction - end_fraction) * tank_volume,
                'unit': 'L'
            }
Example #8
0
        ## 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'}})
        metrics.update(
            {'Stopped_Moving': {
                'value': stopped_moving,
                'unit': 'T/F'
            }})
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)
    swing_uri = 'Excavator_.carriage2.swingRevolute.w'
    filter.append(swing_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)
    print 'Maximum pressure obtained at : {0}'.format(max_p_time)
    max_p_time = pp.global_max_time(armCylPressure_uri)
    print 'Maximum pressure obtained at : {0}'.format(max_p_time)
    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))
    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'
        },
        'boomCylRPressure': {
            'value': pp.global_abs_max(boomCylRPressure_uri) * 0.00001,
            'unit': 'bar'
        },
        'armCylLength_unit': {
            'value': pp.get_data_by_time(armCylLength_uri, max_p_time)[0],
            'unit': 'm'
        },
        'armCylPressure': {
            'value': pp.global_abs_max(armCylPressure_uri) * 0.00001,
            'unit': 'bar'
        },
        'bucketCylPressure': {
            'value': pp.global_abs_max(bucketCylPressure_uri) * 0.00001,
            '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'
        },
        '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'))
    pp.store_data_to_csv(bucketCylLength_uri,
                         '{0}.csv'.format(bucketCylLength_uri), 0, 0.1, 200)
    pp.store_data_to_csv(armCylLength_uri, '{0}.csv'.format(armCylLength_uri),
                         0, 0.1, 200)
    pp.store_data_to_csv(boomCylLength_uri,
                         '{0}.csv'.format(boomCylLength_uri), 0, 0.1, 200)
    pp.store_data_to_csv(boomCylRPressure_uri,
                         '{0}.csv'.format(boomCylRPressure_uri), 0, 0.1, 200)
    pp.store_data_to_csv(arm_ang_vel_uri, '{0}.csv'.format(arm_ang_vel_uri), 0,
                         0.1, 200)
    pp.store_data_to_csv(max_Y_uri, '{0}.csv'.format(max_Y_uri), 0, 0.1, 500)
    pp.store_data_to_csv(max_reach_uri, '{0}.csv'.format(max_reach_uri), 0,
                         0.1, 200)
    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)
        # 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(
Example #11
0
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)
    swing_uri = 'Excavator_.carriage2.swingRevolute.w'
    filter.append(swing_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)
    print 'Maximum pressure obtained at : {0}'.format(max_p_time)
    max_p_time = pp.global_max_time(armCylPressure_uri)
    print 'Maximum pressure obtained at : {0}'.format(max_p_time)
    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))
    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'},
                    'boomCylRPressure': {'value': pp.global_abs_max(boomCylRPressure_uri)*0.00001, 'unit': 'bar'},
                    'armCylLength_unit': {'value': pp.get_data_by_time(armCylLength_uri, max_p_time)[0], 'unit': 'm'},
                    'armCylPressure': {'value': pp.global_abs_max(armCylPressure_uri)*0.00001, 'unit': 'bar'},
                    'bucketCylPressure': {'value': pp.global_abs_max(bucketCylPressure_uri)*0.00001, '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'},
                    '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'))
    pp.store_data_to_csv(bucketCylLength_uri, '{0}.csv'.format(bucketCylLength_uri), 0, 0.1, 200)
    pp.store_data_to_csv(armCylLength_uri, '{0}.csv'.format(armCylLength_uri), 0, 0.1, 200)
    pp.store_data_to_csv(boomCylLength_uri, '{0}.csv'.format(boomCylLength_uri), 0, 0.1, 200)
    pp.store_data_to_csv(boomCylRPressure_uri, '{0}.csv'.format(boomCylRPressure_uri), 0, 0.1, 200)
    pp.store_data_to_csv(arm_ang_vel_uri, '{0}.csv'.format(arm_ang_vel_uri), 0, 0.1, 200)
    pp.store_data_to_csv(max_Y_uri, '{0}.csv'.format(max_Y_uri), 0, 0.1, 500)
    pp.store_data_to_csv(max_reach_uri, '{0}.csv'.format(max_reach_uri), 0, 0.1, 200)
    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)
        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'}})
        metrics.update({'Stopped_Moving': {'value': stopped_moving, 'unit': 'T/F'}})
        metrics.update({'Final_Position': {'value': abs(position),'unit': 'm'}})
        ## 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', 
                                                          pp.last_value('road_Wheel_Load_Both_Sides.Accel_20kph'),
                                                          'Acc20kph',
                                                          'last_value(road_Wheel_Load_Both_Sides.Accel_20kph)',
                                                          's'))
Example #14
0
            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

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

        os.chdir(cwd)  
        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(
        # 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