Пример #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({
        'MaximumSpeed': {
            'value': pp.global_abs_max('SpeedSensor.v'),
            'unit': 'm/s'
        }
    })
    metrics.update({
        'MaximumSpeed10': {
            'value': pp.global_abs_max('SpeedSensor.v') * 10,
            '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)
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)
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)
Пример #4
0
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'
                }
            })
Пример #5
0
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)
        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]
Пример #6
0
        ## 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':
        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
Пример #8
0
from common import PostProcess, update_metrics_in_report_json
from common import read_limits, check_limits_and_add_to_report_json

if __name__ == '__main__':
    if len(sys.argv) > 1:
        try:
            mat_file_name = sys.argv[1]
            ## First limit part
            limit_dict, filter = read_limits()

            ## Post processing part
            filter.append('road_Wheel_Load_Both_Sides.vehicleSpeed')
            filter.append('road_Wheel_Load_Both_Sides.Accel_20kph')

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

            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'),
Пример #9
0
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
Пример #10
0
def main():
    print "in main....."
    sampleRate = 0.10
    startAnalysisTime = 50

    f = open('rawdata.csv', 'w')
    mat_file_name = sys.argv[1]
    print "Mat file name is " + mat_file_name
    if not os.path.exists(mat_file_name):
        raise IOError('Given result file does not exist: {0}'.format(
            sys.argv[1]))
    else:
        dstpath = os.path.join(os.getcwd(), 'matfiles')
        if not os.path.isdir(dstpath):
            os.makedirs(dstpath)
        numFiles = len(os.listdir(dstpath))
        dstname = '_' + str(numFiles) + mat_file_name
        shutil.copyfile(mat_file_name, os.path.join(dstpath, dstname))

    print "Line 24: Opened " + mat_file_name
    ## First limit part
    limit_dict, filter = read_limits()
    print "done limits"
    filter = []
    ## End of first limit part

    ## Post processing part
    #--------accelerations-----------------------------------------------

    #---------------------------------------------------------------------------------
    #                  Processing
    #---------------------------------------------------------------------------------
    # loads results with the filtered out variables (and 'time' which is default)
    filter = []
    pp = PostProcess(mat_file_name, filter)
    vars_available = pp.get_names()
    dumpList = []
    print vars_available[1]
    for vv in vars_available:
        if vv.find("current_") != -1:
            print "add to dumpList: " + vv
            dumpList.append(vv)
        if vv.find("voltage_") != -1:
            print "add to dumpList: " + vv
            dumpList.append(vv)
        if vv.find("angle_") != -1:
            print "add to dumpList: " + vv
            dumpList.append(vv)

    pp.print_time()
    print "Last time is " + str(pp.get_max_time())
    sampData = []
    for vv in dumpList:
        ndat = pp.resample_data(vv, sampleRate)
        print "got ndat size=", len(ndat)
        sampData.append(ndat)
        print 'sampdata=', len(sampData), 'cols', len(sampData[0]), 'rows'

    i = 0
    print "dumping raw data headers"
    for c, vv in enumerate(dumpList):
        print vv, c
        f.write(vv + ',')
    f.write("\n")
    print "dump data"
    print len(sampData), 'cols', len(sampData[0])
    while i < len(sampData[0]):
        if i % 1000 == 0:
            print "line ", i
        for c, vv in enumerate(dumpList):
            f.write(str(sampData[c][i]) + ',')
        f.write("\n")
        i = i + 1
    f.close()
    actAngleIdx = -1
    setAngleIdx = -1
    voltBusIdx = -1
    currGyroIdx = -1

    for c, vv in enumerate(dumpList):
        if vv.find("angle_set") != -1:
            setAngleIdx = c
        if vv.find("angle_act") != -1:
            actAngleIdx = c
        if vv.find("voltage_bus") != -1:
            voltBusIdx = c
        if vv.find("current_gyro") != -1:
            currGyroIdx = c
            print "gyro idx ", currGyroIdx

    maxErr = 0
    sumErr = 0
    avgErr = 0
    maxBusV = -1
    minBusV = 100
    minBattCap = 100
    maxGyroCurr = 0

    if actAngleIdx != -1 and setAngleIdx != -1:
        i = int(startAnalysisTime / sampleRate)
        first = i
        print "scanning angles from ", i, " to ", len(sampData[setAngleIdx])
        while i < len(sampData[setAngleIdx]):
            angErr = abs(sampData[setAngleIdx][i] - sampData[actAngleIdx][i])
            if angErr > maxErr:
                maxErr = angErr
            sumErr = sumErr + angErr
            i = i + 1
        avgErr = sumErr / (i - first + 1)

    if voltBusIdx != -1:
        i = int(startAnalysisTime / sampleRate)
        while i < len(sampData[voltBusIdx]):
            vts = abs(sampData[voltBusIdx][i])
            if vts > maxBusV:
                maxBusV = vts
            if vts < minBusV:
                minBusV = vts
            i = i + 1

    if currGyroIdx != -1:
        i = int(startAnalysisTime / sampleRate)
        print "scanning Gyro currents from ", i, " to ", len(
            sampData[currGyroIdx])
        while i < len(sampData[currGyroIdx]):
            vts = abs(sampData[currGyroIdx][i])
            if vts > maxGyroCurr:
                maxGyroCurr = vts
                print vts
            i = i + 1

    output_dir = "../"
    json_filename = os.path.join(output_dir, 'testbench_manifest.json')

    import json

    json_data = {}

    if os.path.isfile(json_filename):
        with open(json_filename, "r") as json_file:
            print "reading json"
            json_data = json.load(json_file)

    print "json_data is....."
    print json_data

    for metric in json_data['Metrics']:
        if metric["Name"] == "angleMaxError":
            metric["Value"] = str(maxErr)
        if metric["Name"] == "angleAvgError":
            metric["Value"] = str(avgErr)
        if metric["Name"] == "minBusVoltage":
            metric["Value"] = str(minBusV)
        if metric["Name"] == "maxBusVoltage":
            metric["Value"] = str(maxBusV)
        if metric["Name"] == "minBattCapacity":
            metric["Value"] = str(minBattCap)
        if metric["Name"] == "maxGyroCurrent":
            metric["Value"] = str(maxGyroCurr)
    print "dumping to ", json_filename
    print json_data
    with open(json_filename, "w") as json_file:
        json.dump(json_data, json_file, indent=4)

    # #---------------------------------------------------------------------------------
    # #                  Potential_Design
    # #---------------------------------------------------------------------------------
    # Potential_Design = 0
    # followTime = pp.get_data_by_index(followTime_uri, -1)
    # if (SettlingTime == -1 or riseTime == -1 or minDistance < .1*minDistanceVelocity*followTime):
    # Potential_Design = -1
    # else: Potential_Design = 1

    # print "Potential_Design: %d" %Potential_Design

    # #---------------------------------------------------------------------------------
    # #                  Metrics
    # #---------------------------------------------------------------------------------
    # metrics = {}
    # metrics.update({'vehicleMass':{'value': vehicleMass, 'unit':'kg'},
    # 'distanceTraveled':{'value': distanceTraveled, 'unit': 'm'},
    # 'minDistance': {'value': minDistance, 'unit': 'm'},
    # 'finalVelocity':{'value': Vf, 'unit': 'm/s'},
    # 'requiredTorque':{'value': requiredTorque, 'unit':'N-m'},
    # 'riseTime':{'value': np.amax(riseTime), 'unit' :''},
    # 'Overshoot':{'value': np.amax(Overshoot), 'unit' :''},
    # 'settlingTime':{'value': np.amax(SettlingTime), 'unit' :''},
    # 'rms_error':{'value': RMS_error, 'unit' : ''},
    # 'numSetpointCrossings':{'value':numSetPointCrossings, 'unit': ''},
    # 'averageA': {'value': maxAccel, 'unit': 'm/s2'},
    # 'averageJ': {'value': maxJerk, 'unit': 'm/s3'},
    # 'Potential_Design': {'value': Potential_Design, 'unit': ''},

    # #'chassisType':{'value': chassisType, 'unit' :''},
    # })
    #print metrics
    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(jerk_uri, '{0}.csv'.format(jerk_uri), 0, time_inc, numSamples)
    #pp.store_data_to_csv(a_uri, '{0}.csv'.format(a_uri), 0, time_inc, numSamples)
    #pp.store_data_to_csv(pp.time_array, '{0}.csv'.format(pp.time_array), 0, time_inc, numSamples)
    #pp.store_data_to_csv(boomCylLength_uri, '{0}.csv'.format(boomCylLength_uri), 0, time_inc, numSamples)
    #pp.store_data_to_csv(armCylLength_uri, '{0}.csv'.format(armCylLength_uri), 0, time_inc, numSamples)
    #pp.store_data_to_csv(bucketCylLength_uri, '{0}.csv'.format(bucketCylLength_uri), 0, time_inc, numSamples)
    #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)
    print "done main"
            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')
        
Пример #12
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('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

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':
Пример #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('driver_Land_Profile.driver_control.error_current.y')
        filter.append('driver_Land_Profile.driver_control.error_current.u2')

        #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)
        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')
        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"),
Пример #16
0
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)
Пример #17
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)
Пример #18
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)

    # 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)
    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)
Пример #19
0
        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('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({
Пример #20
0
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
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)
Пример #22
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)
Пример #23
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.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
        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": {
Пример #25
0
        ## 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')
Пример #26
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)
Пример #27
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.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', 
Пример #28
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


        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('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
            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('driver_Land_Profile.driver_control.error_current.y')
        filter.append('driver_Land_Profile.driver_control.error_current.u2')
        
        #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)
        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')
        
Пример #31
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.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'
Пример #32
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)
Пример #33
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('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'}})
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)
        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]
        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'