import math


def alpha_beta_to_d_q(ualpha,ubeta,wt):
	"""Convert alpha-beta to d-q."""
	Us = (ualpha + 1j*ubeta)*pow(math.e,-1j*(wt))
	#Us = (ualpha + 1j*ubeta)*pow(math.e,-1j*(wt-(math.pi/2)))
	
	ud = Us.real
	uq = Us.imag
	
	#ud = ualpha*math.sin(wt) - ubeta*math.cos(wt)
	#uq = ualpha*math.cos(wt) + ubeta*math.sin(wt)
	
	#ud = ualpha*math.cos(wt) + ubeta*math.sin(wt)
	#uq = -ualpha*math.sin(wt) + ubeta*math.cos(wt)
	
	return ud,uq