Savelyev_Vyacheslav

DuvalTryAng5

Mar 7th, 2022 (edited)
935
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.25 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3.  
  4. # In[62]:
  5.  
  6.  
  7. import math
  8. # Xd = 1.8
  9. # Xq = 1
  10. # Xid = 0.3
  11. # Ug = 1
  12. # s = 1
  13. # cosfi = 0.85
  14. #####################naiti Id Iq Eq Eiq EQ
  15. # Xd = 2.04
  16. # Xq = 0.189
  17. # Xid = 0.271
  18. # Ug = 1
  19. # s = 1
  20. # cosfi = 0.8
  21. ##########################
  22. Xd = 1.670
  23. Xq = 0.173
  24. Xid = 0.258
  25. Ug = 1
  26. s = 1
  27. cosfi = 0.85
  28.  
  29.  
  30. # In[63]:
  31.  
  32.  
  33. Pg = s * cosfi
  34. Qg = s * (1-cosfi*cosfi)**0.5
  35. EQ = ( (Ug + Qg*Xq/Ug)**2 + (Pg*Xq/Ug)**2 )**0.5
  36.  
  37.  
  38. # In[64]:
  39.  
  40.  
  41. z = Pg*Xq/(Ug**2+Qg*Xq)
  42. LamdaG = math.atan(z)/math.pi*180
  43. LamdaR = math.atan(z)
  44.  
  45.  
  46. # In[65]:
  47.  
  48.  
  49. Id =( Ug*math.cos(LamdaR) - EQ) / Xq
  50. Iq = Ug*math.sin(LamdaR) / Xq
  51. Eq = EQ - (Xd - Xq)*Id
  52. Eiq = EQ - (Xid - Xq)*(Id)
  53.  
  54.  
  55. # In[66]:
  56.  
  57.  
  58. I = (Iq**2+Id**2)**0.5
  59. print(Pg,Qg,EQ,LamdaG,'||',I,Id, Iq,'||', Eq, Eiq)
  60.  
  61.  
  62. # In[67]:
  63.  
  64.  
  65. Uq = Ug * math.cos(LamdaR)
  66. Ud = Ug * math.sin(LamdaR)
  67.  
  68.  
  69. # In[68]:
  70.  
  71.  
  72. import numpy as pn
  73. import matplotlib.pyplot as plt
  74. import seaborn as sns
  75.  
  76.  
  77. # In[69]:
  78.  
  79.  
  80. sns.set()
  81. def t(nameIq):
  82.     s = nameIq+' = '+str(eval(nameIq))[0:6];
  83.     return s;
  84.  
  85. conn_style=[
  86.    t('Id'), t('Iq'), t('I'),t('Uq'),t('Ud'), t('Ug'),t('EQ'),t('Eq'),
  87. ]
  88.  
  89.  
  90. # In[70]:
  91.  
  92.  
  93. ss=-0.02
  94. #Lamda =39.1/180*3.14
  95.  
  96.  
  97. x=Eq*math.cos(LamdaR); y=Eq*math.sin(LamdaR);  plt.text(x, y, "Eq")
  98. plt.quiver(0,-ss*2,x,y-ss*2, scale_units='xy', angles='xy', scale=1, color='r')
  99.  
  100. x=EQ*math.cos(LamdaR); y=EQ*math.sin(LamdaR);  plt.text(x, y, "EQ")
  101. plt.quiver(0,ss,x,y+ss, scale_units='xy', angles='xy', scale=1, color='g')
  102.  
  103.  
  104. x = Ug*math.cos(LamdaR)**2; y = Ug*math.cos(LamdaR)*math.sin(LamdaR);  plt.text(x*0.8, y*1.3, "Uq")
  105. plt.quiver(0,ss,x,y+ss, scale_units='xy', angles='xy', scale=1, color='c')
  106. x = Ug*math.cos(math.pi/2 - LamdaR)*math.sin(LamdaR); y =-Ug*math.cos(math.pi/2-LamdaR)*math.cos(LamdaR);  plt.text(x*0.8, y*1.3, "Ud")
  107. plt.quiver(0,ss,x,y+ss, scale_units='xy', angles='xy', scale=1, color='c')
  108. x = Ug; y = 0; plt.text(x*1, y*1.3, "U")
  109. plt.quiver(0,ss,x,y+ss, scale_units='xy', angles='xy', scale=1, color='c')
  110.  
  111.  
  112. fi = math.acos(cosfi)
  113. I = (Iq**2+Id**2)**0.5
  114. x=Iq*math.cos(LamdaR); y=Iq*math.sin(LamdaR);  plt.text(x*0.8, y*1.3, "Iq")
  115. plt.quiver(0,0,x,y, scale_units='xy', angles='xy', scale=1, color='YELLOW')
  116. x=-Id*math.sin(LamdaR); y=Id*math.cos(LamdaR);  plt.text(x*0.8, y*1.3, "Id")
  117. plt.quiver(0,0,x,y, scale_units='xy', angles='xy', scale=1, color='YELLOW')
  118. #y=-I*(1-cosfi*cosfi)**0.5*math.cos(Lamda); x=I*cosfi;  plt.text(x, y, "I")
  119. #plt.quiver(0,0,x,y, scale_units='xy', angles='xy', scale=1, color='YELLOW')
  120. x = (-Id*math.sin(LamdaR)+Iq*math.cos(LamdaR)); y=(+Iq*math.sin(LamdaR)+Id*math.cos(LamdaR));  plt.text(x, y, "I")
  121. plt.quiver(0,0,x,y, scale_units='xy', angles='xy', scale=1, color='YELLOW')
  122.  
  123. x = Ug*math.cos(math.pi/2 - LamdaR)*math.sin(LamdaR); y =-Ug*math.cos(math.pi/2-LamdaR)*math.cos(LamdaR);  plt.text(x*0.8, y*1.3, "Ud")
  124. plt.quiver(0,ss,x,y+ss, scale_units='xy', angles='xy', scale=1, color='c')
  125.  
  126. m=-0.12
  127. for i in range(8):
  128.     plt.text(0, 1.4+m*i, conn_style[i])
  129. plt.xlabel("U = 1; S = 1 – значения взяты в относительных единицах")
  130. plt.ylabel("U = 1; S = 1 – (о.е.)")
  131. plt.title("Иллюстративная диаграмма синхронной машины")
  132. plt.xlim(-0.1,2.5)
  133. plt.ylim(-1,1.5)
  134. plt.show
  135.  
  136.  
Add Comment
Please, Sign In to add comment