def __init__(self, *inargs): if len(inargs) == 1: self.vert = inargs[0] self.A, self.s, self.b = vert2con(self.vert) self.closed = True elif len(inargs) == 3: if all(sign(inargs[1]) == -1): # ensure an all -1 sign vector self.A, self.s, self.b = inargs else: self.A, self.s, self.b = mat2ab(c_[inargs]) self.vert, self.closed = con2vert(self.A, self.b) else: exit(1) # TODO: Raise exception self.nd = self.A.shape[1] self.cscent = sum(self.vert, axis=0)/len(self.vert)
# - convertfuns # - auxfuns # - conclasses from conclasses import ConSet from scipy import array, linalg from auxfuns import mat2ab from fitting import fitset, fitmaxbox #MAIN START ================================================================= # define AIS and DOS (equations : Ax<b) # equations in the form Ax<b, matrix = [A s b] # with s the sign vector [1:>, -1:<] AISA, AISs, AISb = mat2ab(array([[1., 0., 1., 4], [1., 0., -1., 20], [0., 1., 1., 4], [0., 1., -1., 20.]])) AIS = ConSet(AISA, AISs, AISb) DOSA, DOSs, DOSb = mat2ab(array([[1., 0., 1., 1.2], [1., 0., -1., 1.5], [0., 1., 1., 15.], [0., 1., -1., 18.]])) DOS = ConSet(DOSA, DOSs, DOSb) POS = ConSet(*mat2ab(array([[1., 0., 1., 0], [1., 0., -1., 1.9], [0., 1., 1., 6.], [0., 1., -1., 25.]]))) # define G (steady-state model)
# - auxfuns # - conclasses from conclasses import ConSet from scipy import array, linalg from auxfuns import mat2ab from fitting import fitset from convertfuns import con2pscon #MAIN START ================================================================= # define AIS and DOS (equations : Ax<b) # equations in the form Ax<b, matrix = [A s b] # with s the sign vector [1:>, -1:<] AISA, AISs, AISb = mat2ab(array([[1., 0., 1., 11], [1., 0., -1., 15], [0., 1., 1., 25], [0., 1., -1., 90.]])) AIS = ConSet(AISA, AISs, AISb) DOSA, DOSs, DOSb = mat2ab(array([[1., 0., 1., 66.], [1., 0., -1., 68.], [0., 1., 1., 78.], [0., 1., -1., 82.]])) DOS = ConSet(DOSA, DOSs, DOSb) # define G (steady-state model) # R T10sp G = array([[-0.0575, 0.96], # T1 [ -0.146, 0.518]]) # T8 Gi = linalg.inv(G)
# Dependencies: - SciPy # - convertfuns # - auxfuns # - conclasses from conclasses import ConSet from scipy import array from auxfuns import mat2ab #MAIN START ================================================================= # define AIS and DOS (equations : Ax<b) # equations in the form Ax<b, matrix = [A s b] # with s the sign vector [1:>, -1:<] AISA, AISs, AISb = mat2ab(array([[1., 0., 1., -0.0525], [1., 0., -1., 0.125], [0., 1., 1., -10], [0., 1., -1., 10.]])) AIS = ConSet(AISA, AISs, AISb) DOSA, DOSs, DOSb = mat2ab(array([[1., 0., 1., -1.], [1., 0., -1., 1.], [0., 1., 1., -1.], [0., 1., -1., 1.]])) DOS = ConSet(DOSA, DOSs, DOSb) # define G (steady-state model) lss = array([[50., 50.]]) # nominal operating point (used for model generation) G = array([[1, 0.0025], [2, 0.0025]]) # gain matrix - atm linear steady state matrix # calc AOS (from G and AIS)