Exemple #1
0
def first_test():
    init_position = orbit_wrap.create_position(0, 0, 32650.1)
    init_orientation = orbit_wrap.create_orient(0, 0, 1)
    speed_first = orbit_wrap.create_vec(0, 0, 0)

    initial_position = orbit_wrap.create_ship_position(init_position,
                                                       init_orientation,
                                                       speed_first)

    quants = orbit_wrap.create_quants(10, 1000)

    ship_edge_length = 0.001
    ship_mass = 3
    fuel_mass = 10
    max_rotation = orbit_wrap.create_rotation(10, 10, 10)
    max_fuel_usage_per_second = 100
    impulse_per_fuel = 20
    max_overload = 200000
    max_heating = 100000000

    rot = orbit_wrap.create_rotation(0, 0, 0)
    parts_of_flight_plan = [
        orbit_wrap.create_part_of_flight_plan(1, 0, rot) for i in range(100000)
    ]

    vector_of_flight_plan = orbit_wrap.orbit.vector_of_part_flight_plan(
        parts_of_flight_plan)

    fl_plan_l = orbit_wrap.parse_input_code('delay 100000')

    ship_params = orbit_wrap.create_ship_params(ship_edge_length, ship_mass,
                                                fuel_mass, max_rotation,
                                                max_fuel_usage_per_second,
                                                impulse_per_fuel, max_overload,
                                                max_heating, fl_plan_l)
    #vector_of_flight_plan)

    flight_plan = orbit_wrap.orbit.computeFlightPlan(initial_position,
                                                     ship_params, quants)

    return orbit_wrap.generate_celestia_script(flight_plan,
                                               quants.quantSizeOfSec)
Exemple #2
0
def first_test():
    init_position = orbit_wrap.create_position(0, 0, 32650.1)
    init_orientation = orbit_wrap.create_orient(0, 0, 1)
    speed_first = orbit_wrap.create_vec(0, 0, 0)

    initial_position = orbit_wrap.create_ship_position(init_position,
                                                       init_orientation,
                                                       speed_first)

    quants = orbit_wrap.create_quants(10, 1000)

    ship_edge_length = 0.001
    ship_mass = 3
    fuel_mass = 10
    max_rotation = orbit_wrap.create_rotation(10, 10, 10)
    max_fuel_usage_per_second = 100
    impulse_per_fuel = 20
    max_overload = 200000
    max_heating = 100000000

    rot = orbit_wrap.create_rotation(0, 0, 0)
    parts_of_flight_plan = [orbit_wrap.create_part_of_flight_plan(1, 0, rot) for i in range(100000)]

    vector_of_flight_plan = orbit_wrap.orbit.vector_of_part_flight_plan(parts_of_flight_plan)

    fl_plan_l = orbit_wrap.parse_input_code('delay 100000')

    ship_params = orbit_wrap.create_ship_params(ship_edge_length,
                                                ship_mass,
                                                fuel_mass,
                                                max_rotation,
                                                max_fuel_usage_per_second,
                                                impulse_per_fuel,
                                                max_overload,
                                                max_heating,
                                                fl_plan_l)
                                                #vector_of_flight_plan)

    flight_plan = orbit_wrap.orbit.computeFlightPlan(initial_position, ship_params, quants)

    return orbit_wrap.generate_celestia_script(flight_plan, quants.quantSizeOfSec)
Exemple #3
0
def script(request):
    form = MainForm(data=request.POST)
    if request.method == "POST" and form.is_valid():
        PositionX = float(form.cleaned_data['PositionX']); request.session['PositionX'] = form.data['PositionX']
        PositionY = float(form.cleaned_data['PositionY']); request.session['PositionY'] = form.data['PositionY']
        PositionZ = float(form.cleaned_data['PositionZ']); request.session['PositionZ'] = form.data['PositionZ']
        OrientX = float(form.cleaned_data['OrientX']); request.session['OrientX'] = form.data['OrientX']
        OrientY = float(form.cleaned_data['OrientY']); request.session['OrientY'] = form.data['OrientY']
        OrientZ = float(form.cleaned_data['OrientZ']); request.session['OrientZ'] = form.data['OrientZ']
        shipMass = float(form.cleaned_data['shipMass']); request.session['shipMass'] = form.data['shipMass']
        fuelMass = float(form.cleaned_data['fuelMass']); request.session['fuelMass'] = form.data['fuelMass']
        shipEdgeLength = float(form.cleaned_data['shipEdgeLength']); request.session['shipEdgeLength'] = form.data['shipEdgeLength']
        speedFirstX = float(form.cleaned_data['speedFirstX']); request.session['speedFirstX'] = form.data['speedFirstX']
        speedFirstY = float(form.cleaned_data['speedFirstY']); request.session['speedFirstY'] = form.data['speedFirstY']
        speedFirstZ = float(form.cleaned_data['speedFirstZ']); request.session['speedFirstZ'] = form.data['speedFirstZ']
        maxRotationX = float(form.cleaned_data['maxRotationX']); request.session['maxRotationX'] = form.data['maxRotationX']
        maxRotationY = float(form.cleaned_data['maxRotationY']); request.session['maxRotationY'] = form.data['maxRotationY']
        maxRotationZ = float(form.cleaned_data['maxRotationZ']); request.session['maxRotationZ'] = form.data['maxRotationZ']
        maxFuelUsagePerSec = float(form.cleaned_data['maxFuelUsagePerSec']); request.session['maxFuelUsagePerSec'] = form.data['maxFuelUsagePerSec']
        impulsePerFuel = float(form.cleaned_data['impulsePerFuel']); request.session['impulsePerFuel'] = form.data['impulsePerFuel']
        limitOverload = float(form.cleaned_data['limitOverload']); request.session['limitOverload'] = form.data['limitOverload']
        maxTemperature = float(form.cleaned_data['maxTemperature']); request.session['maxTemperature'] = form.data['maxTemperature']
        maxFlightTime = float(form.cleaned_data['maxFlightTime']); request.session['maxFlightTime'] = form.data['maxFlightTime']
        numberOfQuants = int(form.cleaned_data['numberOfQuants']); request.session['numberOfQuants'] = form.data['numberOfQuants']
        quantSizeOfSec = float(form.cleaned_data['quantSizeOfSec']); request.session['quantSizeOfSec'] = form.data['quantSizeOfSec']
        displayPrecision = float(form.cleaned_data['displayPrecision']); request.session['displayPrecision'] = form.data['displayPrecision']
        Program = form.cleaned_data['Program']; request.session['Program'] = form.data['Program']

        init_position = orbit_wrap.create_position(PositionX, PositionY, PositionZ)
        init_orientation = orbit_wrap.create_orient(OrientX, OrientY, OrientZ)
        speed_first = orbit_wrap.create_vec(speedFirstX, speedFirstY, speedFirstZ)

        initial_position = orbit_wrap.create_ship_position( init_position,
                                                 init_orientation,
                                                 speed_first)

        quants = orbit_wrap.create_quants(numberOfQuants, quantSizeOfSec)

        ship_edge_length = shipEdgeLength
        ship_mass = shipMass
        fuel_mass = fuelMass
        max_rotation = orbit_wrap.create_rotation(maxRotationX, maxRotationY, maxRotationZ)
        max_fuel_usage_per_second = maxFuelUsagePerSec
        impulse_per_fuel = impulsePerFuel
        max_overload = limitOverload
        max_heating = maxTemperature


        rot = orbit_wrap.create_rotation(0, 0, 0)
        parts_of_flight_plan = [orbit_wrap.create_part_of_flight_plan(1, 0, rot) for i in range(100000)]

        vector_of_flight_plan = orbit_wrap.orbitswig.vector_of_part_flight_plan(parts_of_flight_plan)

        fl_plan_l = orbit_wrap.parse_input_code(Program)

        ship_params = orbit_wrap.create_ship_params(ship_edge_length,
                                            ship_mass,
                                            fuel_mass,
                                            max_rotation,
                                            max_fuel_usage_per_second,
                                            impulse_per_fuel,
                                            max_overload,
                                            max_heating,
                                            fl_plan_l)

        flight_plan = orbit_wrap.orbitswig.computeFlightPlan(initial_position, ship_params, quants)

        script = orbit_wrap.generate_celestia_script(flight_plan, quants.quantSizeOfSec)

        with open("getscript/result_script.txt", 'w') as file:
            file.write(script)     
        return render(request, 'flatpages/script.html', {'form': form, 'script': script})
    else:
        form = MainForm(data=request.POST)
        form_error = "Заполнены не все поля формы."    
    return render(request, 'flatpages/calculator.html', {'form': form, 'form_error': form_error})
Exemple #4
0
def script(request):
    form = MainForm(data=request.POST)
    if request.method == "POST" and form.is_valid():
        PositionX = float(form.cleaned_data['PositionX']); request.session['PositionX'] = form.data['PositionX']
        PositionY = float(form.cleaned_data['PositionY']); request.session['PositionY'] = form.data['PositionY']
        PositionZ = float(form.cleaned_data['PositionZ']); request.session['PositionZ'] = form.data['PositionZ']
        OrientX = float(form.cleaned_data['OrientX']); request.session['OrientX'] = form.data['OrientX']
        OrientY = float(form.cleaned_data['OrientY']); request.session['OrientY'] = form.data['OrientY']
        OrientZ = float(form.cleaned_data['OrientZ']); request.session['OrientZ'] = form.data['OrientZ']
        shipMass = float(form.cleaned_data['shipMass']); request.session['shipMass'] = form.data['shipMass']
        fuelMass = float(form.cleaned_data['fuelMass']); request.session['fuelMass'] = form.data['fuelMass']
        shipEdgeLength = float(form.cleaned_data['shipEdgeLength']); request.session['shipEdgeLength'] = form.data['shipEdgeLength']
        speedFirstX = float(form.cleaned_data['speedFirstX']); request.session['speedFirstX'] = form.data['speedFirstX']
        speedFirstY = float(form.cleaned_data['speedFirstY']); request.session['speedFirstY'] = form.data['speedFirstY']
        speedFirstZ = float(form.cleaned_data['speedFirstZ']); request.session['speedFirstZ'] = form.data['speedFirstZ']
        maxRotationX = float(form.cleaned_data['maxRotationX']); request.session['maxRotationX'] = form.data['maxRotationX']
        maxRotationY = float(form.cleaned_data['maxRotationY']); request.session['maxRotationY'] = form.data['maxRotationY']
        maxRotationZ = float(form.cleaned_data['maxRotationZ']); request.session['maxRotationZ'] = form.data['maxRotationZ']
        maxFuelUsagePerSec = float(form.cleaned_data['maxFuelUsagePerSec']); request.session['maxFuelUsagePerSec'] = form.data['maxFuelUsagePerSec']
        impulsePerFuel = float(form.cleaned_data['impulsePerFuel']); request.session['impulsePerFuel'] = form.data['impulsePerFuel']
        limitOverload = float(form.cleaned_data['limitOverload']); request.session['limitOverload'] = form.data['limitOverload']
        maxTemperature = float(form.cleaned_data['maxTemperature']); request.session['maxTemperature'] = form.data['maxTemperature']
       # maxFlightTime = float(form.cleaned_data['maxFlightTime']); request.session['maxFlightTime'] = form.data['maxFlightTime']
        numberOfQuants = int(form.cleaned_data['numberOfQuants']); request.session['numberOfQuants'] = form.data['numberOfQuants']
        quantSizeOfSec = float(form.cleaned_data['quantSizeOfSec']); request.session['quantSizeOfSec'] = form.data['quantSizeOfSec']
        displayPrecision = float(form.cleaned_data['displayPrecision']); request.session['displayPrecision'] = form.data['displayPrecision']
        Program = form.cleaned_data['Program']; request.session['Program'] = form.data['Program']

        init_position = orbit_wrap.create_position(PositionX, PositionY, PositionZ)
        init_orientation = orbit_wrap.create_orient(OrientX, OrientY, OrientZ)
        speed_first = orbit_wrap.create_vec(speedFirstX, speedFirstY, speedFirstZ)

        initial_position = orbit_wrap.create_ship_position( init_position,
                                                 init_orientation,
                                                 speed_first)

        quants = orbit_wrap.create_quants(numberOfQuants, quantSizeOfSec)

        ship_edge_length = shipEdgeLength
        ship_mass = shipMass
        fuel_mass = fuelMass
        max_rotation = orbit_wrap.create_rotation(maxRotationX, maxRotationY, maxRotationZ)
        max_fuel_usage_per_second = maxFuelUsagePerSec
        impulse_per_fuel = impulsePerFuel
        max_overload = limitOverload
        max_heating = maxTemperature


        rot = orbit_wrap.create_rotation(0, 0, 0)
        parts_of_flight_plan = [orbit_wrap.create_part_of_flight_plan(1, 0, rot) for i in range(100000)]

        vector_of_flight_plan = orbit_wrap.orbitswig.vector_of_part_flight_plan(parts_of_flight_plan)

        fl_plan_l = orbit_wrap.parse_input_code(Program)

        ship_params = orbit_wrap.create_ship_params(ship_edge_length,
                                            ship_mass,
                                            fuel_mass,
                                            max_rotation,
                                            max_fuel_usage_per_second,
                                            impulse_per_fuel,
                                            max_overload,
                                            max_heating,
                                            fl_plan_l)

        flight_plan = orbit_wrap.orbitswig.computeFlightPlan(initial_position, ship_params, quants)

        script = orbit_wrap.generate_celestia_script(flight_plan, quants.quantSizeOfSec)

        with open("getscript/Orbit-test/data/orbit.xyzv", 'w') as file:
            file.write(script)     
        return render(request, 'flatpages/script.html', {'form': form, 'script': script})
    else:
        form = MainForm(data=request.POST)
        form_error = "Заполнены не все поля формы."    
    return render(request, 'flatpages/calculator.html', {'form': form, 'form_error': form_error})
Exemple #5
0
def script(request):
    form = MainForm(data=request.POST)
    if request.method == "POST":
        if form.is_valid():
            PositionX = float(form.cleaned_data['PositionX'])
            PositionY = float(form.cleaned_data['PositionY'])
            PositionZ = float(form.cleaned_data['PositionZ'])
            OrientX = float(form.cleaned_data['OrientX'])
            OrientY = float(form.cleaned_data['OrientY'])
            OrientZ = float(form.cleaned_data['OrientZ'])
            shipMass = float(form.cleaned_data['shipMass'])
            fuelMass = float(form.cleaned_data['fuelMass'])
            shipEdgeLength = float(form.cleaned_data['shipEdgeLength'])
            speedFirstX = float(form.cleaned_data['speedFirstX'])
            speedFirstY = float(form.cleaned_data['speedFirstY'])
            speedFirstZ = float(form.cleaned_data['speedFirstZ'])
            maxRotationX = float(form.cleaned_data['maxRotationX'])
            maxRotationY = float(form.cleaned_data['maxRotationY'])
            maxRotationZ = float(form.cleaned_data['maxRotationZ'])
            maxFuelUsagePerSec = float(form.cleaned_data['maxFuelUsagePerSec'])
            impulsePerFuel = float(form.cleaned_data['impulsePerFuel'])
            limitOverload = float(form.cleaned_data['limitOverload'])
            maxTemperature = float(form.cleaned_data['maxTemperature'])
            maxFlightTime = float(form.cleaned_data['maxFlightTime'])
            numberOfQuants = int(form.cleaned_data['numberOfQuants'])
            quantSizeOfSec = float(form.cleaned_data['quantSizeOfSec'])
            displayPrecision = float(form.cleaned_data['displayPrecision'])
            Program = form.cleaned_data['Program']

            init_position = orbit_wrap.create_position(PositionX, PositionY,
                                                       PositionZ)
            init_orientation = orbit_wrap.create_orient(
                OrientX, OrientY, OrientZ)
            speed_first = orbit_wrap.create_vec(speedFirstX, speedFirstY,
                                                speedFirstZ)

            initial_position = orbit_wrap.create_ship_position(
                init_position, init_orientation, speed_first)

            quants = orbit_wrap.create_quants(numberOfQuants, quantSizeOfSec)

            ship_edge_length = shipEdgeLength
            ship_mass = shipMass
            fuel_mass = fuelMass
            max_rotation = orbit_wrap.create_rotation(maxRotationX,
                                                      maxRotationY,
                                                      maxRotationZ)
            max_fuel_usage_per_second = maxFuelUsagePerSec
            impulse_per_fuel = impulsePerFuel
            max_overload = limitOverload
            max_heating = maxTemperature

            rot = orbit_wrap.create_rotation(0, 0, 0)
            parts_of_flight_plan = [
                orbit_wrap.create_part_of_flight_plan(1, 0, rot)
                for i in range(100000)
            ]

            vector_of_flight_plan = orbit_wrap.orbitswig.vector_of_part_flight_plan(
                parts_of_flight_plan)

            fl_plan_l = orbit_wrap.parse_input_code(Program)

            ship_params = orbit_wrap.create_ship_params(
                ship_edge_length, ship_mass, fuel_mass, max_rotation,
                max_fuel_usage_per_second, impulse_per_fuel, max_overload,
                max_heating, fl_plan_l)

            flight_plan = orbit_wrap.orbitswig.computeFlightPlan(
                initial_position, ship_params, quants)

            script = orbit_wrap.generate_celestia_script(
                flight_plan, quants.quantSizeOfSec)

            with open("getscript/result_script.txt", 'w') as file:
                file.write(script)

            return render_to_response('flatpages/script.html', {
                'script': script,
            })
    else:
        form = MainForm()
    return HttpResponseRedirect('/home/')