Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 1.26 KB | None | 0 0
  1. # Parametre
  2. coil_group = 7
  3. filename = 'example.fem'
  4.  
  5.  
  6. # Inputgreier
  7. strom = -1.0;          % Stromstyrken din
  8.  
  9. Xmax = 5.0             % Største utsving i positiv retning
  10. Xmin = -5.0            % Største utsving i negativ retning
  11. Xinc = 0.5             % Størrelsen på inkrementet
  12. Xpos = Xmin:Xinc:Xmax  % Liste med alle posisjoner som simuleres
  13.  
  14. # Tom liste for a putte ting i...
  15. bl = [];               % Tom liste for a lagre Bl verdier i...
  16.  
  17. % open FEMM and initialize the problem
  18. openfemm;
  19. try
  20.     vv=ver; opendocument([cd,strjoin('/',filename)]);
  21. catch
  22.     opendocument(filename);
  23. end
  24. mi_saveas('temp.fem');
  25.  
  26. # Set stromstyrken til noe
  27. mi_setcurrent('Prove circuit',strom);
  28.  
  29. mi_selectgroup(7);
  30. mi_movetranslate(0, Xmin);
  31. mi_clearselected;
  32.  
  33. for i=Xpos,
  34.   mi_selectgroup(coil_group);
  35.   mi_movetranslate(0, Xinc);
  36.   mi_clearselected;
  37.  
  38.   # Kjor analysen
  39.   mi_analyze;
  40.   # Last opp resultat
  41.   mi_loadsolution;
  42.   # Ta ut en liste med noe greier som har me spolen a gjore
  43.   mo_groupselectblock(coil_group);
  44.   fz = mo_blockintegral(12);
  45.   bl = [bl; [i, fz]];
  46.   mo_close;
  47.   #mo_clearselected;
  48.  
  49.  
  50. end
  51. disp(bl)
  52. # Lag pizza
  53. #closefemm
  54.  
  55. plot(bl(:,1),bl(:,2));
  56. xlabel('Displacement, mm');
  57. ylabel('BL, N/A');
  58. title('BL vs. Displacement');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement