Ejemplo n.º 1
0
 def test_user_input(self):
     filename = "input.txt"
     f = open(filename, "r")
     inParams = InputParameters.get_input(f)
     f.close()
     validinput = InputConstraints.input_constraints(inParams, calledfunc)
     self.assertTrue(validinput, "Input parameters are not valid.")
Ejemplo n.º 2
0
 def test_invalid_angle(self):
     filename = "testcase_invalidangle.txt"
     f = open(filename, "r")
     for x in range(6):
         f.readline()
         inParams = InputParameters.get_input(f)
         validinput = InputConstraints.input_constraints(
             inParams, calledfunc)
         self.assertFalse(validinput,
                          "Angle is out of bound. It should be false.")
     f.close()
Ejemplo n.º 3
0
import DerivedValues
import InputConstraints
import InputFormat
import InputParameters
import OutputFormat

filename = sys.argv[1]
outfile = open("log.txt", "a")
print("var 'filename' assigned ", end="", file=outfile)
print(filename, end="", file=outfile)
print(" in module Control", file=outfile)
outfile.close()
inParams = InputParameters.InputParameters()
InputFormat.get_input(filename, inParams)
DerivedValues.derived_values(inParams, inParams.F_vect_1, inParams.x_1, inParams.x_2)
InputConstraints.input_constraints(inParams, pi)
F_vect_AC = Calculations.func_F_vect_AC(inParams)
outfile = open("log.txt", "a")
print("var 'F_vect_AC' assigned ", end="", file=outfile)
print(F_vect_AC, end="", file=outfile)
print(" in module Control", file=outfile)
outfile.close()
F_vect_BC = Calculations.func_F_vect_BC(inParams)
outfile = open("log.txt", "a")
print("var 'F_vect_BC' assigned ", end="", file=outfile)
print(F_vect_BC, end="", file=outfile)
print(" in module Control", file=outfile)
outfile.close()
F_vect_AD = Calculations.func_F_vect_AD(inParams, F_vect_AC)
outfile = open("log.txt", "a")
print("var 'F_vect_AD' assigned ", end="", file=outfile)
Ejemplo n.º 4
0
start = time.time()

# start coverage
cov = coverage.Coverage()
cov.start()

filename = sys.argv[1]
f = open(filename, "r")
# read input
(F_1, X_1, X_2, theta_1, theta_2) = InputParameters.get_input(f)
f.close()
inParams = (F_1, X_1, X_2, theta_1, theta_2)
calledfunc = "Control"

# do the calculationsif inputs are valid
if (InputConstraints.input_constraints(inParams, calledfunc)):
    (F_Ax, F_Ay, F_By) = InputParameters.derived_values(F_1, X_1, X_2)
    F_AC = Calculations.func_F_AC(F_Ay, theta_1)
    F_AD = Calculations.func_F_AD(F_AC, theta_1)
    F_BC = Calculations.func_F_BC(F_By, theta_2)
    F_BD = Calculations.func_F_BD(F_BC, theta_2)
    F_CD = Calculations.func_F_CD(F_1)
    OutputFormat.write_output(F_AC, F_AD, F_BC, F_BD, F_CD)

cov.stop()
cov.save()

# generate coverage report
cov.html_report()

# end timer
import math
import InputParameters
import InputFormat
import DerivedValues
import InputConstraints
import Interpolation
import Calculations
import OutputFormat
import ReadTable


filename = sys.argv[1]
inparams = InputParameters.InputParameters()
InputFormat.get_input(filename, inparams)
DerivedValues.derived_params(inparams)
InputConstraints.check_constraints(inparams)
w_array = ReadTable.read_z_array("TSD.txt")
data_sd = ReadTable.read_x_array("TSD.txt")
data_q = ReadTable.read_y_array("TSD.txt")
j_array = ReadTable.read_z_array("SDF.txt")
data_asprat = ReadTable.read_x_array("SDF.txt")
data_qstar = ReadTable.read_y_array("SDF.txt")
q = Interpolation.interpY(data_sd, data_q, w_array, inparams.sd, inparams.wtnt)
q_hat = Calculations.calc_q_hat(q, inparams)
j_tol = Calculations.calc_j_tol(inparams)
j = Interpolation.interpZ(data_asprat, data_qstar, j_array, inparams.asprat, q_hat)
q_hat_tol = Interpolation.interpY(data_asprat, data_qstar, j_array, inparams.asprat, j_tol)
pb = Calculations.calc_pb(j, inparams)
nfl = Calculations.calc_nfl(q_hat_tol, inparams)
lr = Calculations.calc_lr(nfl, inparams)
is_safe1 = Calculations.calc_is_safe1(pb, inparams)
from __future__ import print_function
import sys
import math
import InputParameters
import DerivedValues
import InputConstraints
import InputFormat
import OutputFormat
import Calculations


inputfile = sys.argv[1]
inParams = InputParameters.InputParameters()
InputFormat.func_get_input(inputfile, inParams)
DerivedValues.derived_values(inParams)
InputConstraints.input_constraints(inParams)
J_tol = Calculations.func_J_tol(inParams)
q = Calculations.func_q(inParams)
q_hat = Calculations.func_q_hat(inParams, q)
q_hat_tol = Calculations.func_q_hat_tol(inParams, J_tol)
J = Calculations.func_J(inParams, q_hat)
NFL = Calculations.func_NFL(inParams, q_hat_tol)
B = Calculations.func_B(inParams, J)
LR = Calculations.func_LR(inParams, NFL)
is_safeLR = Calculations.func_is_safeLR(LR, q)
P_b = Calculations.func_P_b(B)
is_safePb = Calculations.func_is_safePb(inParams, P_b)
OutputFormat.write_output(is_safePb, is_safeLR, P_b)


Ejemplo n.º 7
0
import sys
import math
import InputParameters
import InputFormat
import DerivedValues
import InputConstraints
import Interpolation
import Calculations
import OutputFormat
import ReadTable

filename = sys.argv[1]
inparams = InputParameters.InputParameters()
InputFormat.get_input(filename, inparams)
DerivedValues.derived_params(inparams)
InputConstraints.check_constraints(inparams)
w_array = ReadTable.read_z_array("TSD.txt")
data_sd = ReadTable.read_x_array("TSD.txt")
data_q = ReadTable.read_y_array("TSD.txt")
j_array = ReadTable.read_z_array("SDF.txt")
data_asprat = ReadTable.read_x_array("SDF.txt")
data_qstar = ReadTable.read_y_array("SDF.txt")
q = Interpolation.interpY(data_sd, data_q, w_array, inparams.sd, inparams.wtnt)
q_hat = Calculations.calc_q_hat(q, inparams)
j_tol = Calculations.calc_j_tol(inparams)
j = Interpolation.interpZ(data_asprat, data_qstar, j_array, inparams.asprat,
                          q_hat)
q_hat_tol = Interpolation.interpY(data_asprat, data_qstar, j_array,
                                  inparams.asprat, j_tol)
pb = Calculations.calc_pb(j, inparams)
nfl = Calculations.calc_nfl(q_hat_tol, inparams)