氟塑料離心泵www.buybeng.com

          jquery教程http://www.software8.co/wzjs/jquery/

          用JAVA寫的小工具(空心線圈電感量計算)

          [java] view plaincopyprint?
          1. import javax.swing.*;  
          2. import java.awt.*;  
          3. import java.awt.event.*;  
          4. import java.io.IOException;  
          5. import java.math.*;  
          6. public class Inductance {  
          7.     static JTextField resultTextField;  
          8.     static JTextField rTextField;  
          9.     static JTextField lTextField;  
          10.     static JTextField nTextField;  
          11.     public static void main(String[] args) {  
          12.         JFrame frame = new JFrame("空心線圈電感量");  
          13.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
          14.         JPanel panel = new JPanel();  
          15.         frame.add(panel);  
          16.         Box mainBox = Box.createVerticalBox();  
          17.         panel.add(mainBox);  
          18.         //線圈的半徑R  
          19.         Box rBox = Box.createHorizontalBox();  
          20.         mainBox.add(rBox);  
          21.         JLabel rLabel = new JLabel("半徑(單位米):");  
          22.         rTextField = new JTextField(5);  
          23.         rBox.add(rLabel);  
          24.         rBox.add(rTextField);  
          25.         //線圈的長度L  
          26.         Box lBox = Box.createHorizontalBox();  
          27.         mainBox.add(lBox);  
          28.         JLabel lLabel = new JLabel("長度(單位米):");  
          29.         lTextField = new JTextField(5);  
          30.         lBox.add(lLabel);  
          31.         lBox.add(lTextField);  
          32.         //線圈的圈數N  
          33.         Box nBox = Box.createHorizontalBox();  
          34.         mainBox.add(nBox);  
          35.         JLabel nLabel = new JLabel("圈數(單位圈):");  
          36.         nTextField = new JTextField(5);  
          37.         nBox.add(nLabel);  
          38.         nBox.add(nTextField);  
          39.         //真空磁導率μ0,默認為4π*10^(-7)  
          40.         Box μ0Box = Box.createHorizontalBox();  
          41.         mainBox.add(μ0Box);  
          42.         JLabel μ0Label = new JLabel("真空磁導率μ0");  
          43.         JTextField μ0TextField = new JTextField(5);  
          44.         μ0TextField.setText("4π*10^(-7)");  
          45.         μ0TextField.enable(false);  
          46.         μ0Box.add(μ0Label);  
          47.         μ0Box.add(μ0TextField);  
          48.         //線圈內部磁芯的相對磁導率μs,空心線圈時μs=1  
          49.         Box μsBox = Box.createHorizontalBox();  
          50.         mainBox.add(μsBox);  
          51.         JLabel μsLabel = new JLabel("相對磁導率μs");  
          52.         JTextField μsTextField = new JTextField(5);  
          53.         μsTextField.setText("1");  
          54.         μsTextField.enable(false);  
          55.         μsBox.add(μsLabel);  
          56.         μsBox.add(μsTextField);  
          57.         //空心線圈電感量計算的結果  
          58.         Box resultBox = Box.createHorizontalBox();  
          59.         mainBox.add(resultBox);  
          60.         JLabel resultLabel = new JLabel("線圈電感量(單位微亨)");  
          61.         resultTextField = new JTextField(5);  
          62.         resultTextField.enable(false);  
          63.         resultBox.add(resultLabel);  
          64.         resultBox.add(resultTextField);  
          65.         //計算按鍵  
          66.         Box lastBox = Box.createHorizontalBox();  
          67.         mainBox.add(lastBox);  
          68.         JButton calButton = new JButton("計算");  
          69.         JLabel edwardLabel = new JLabel("徐方鑫制作");  
          70.         lastBox.add(calButton);  
          71.         lastBox.add(edwardLabel);  
          72.         calButton.addActionListener(new ActionListener()  
          73.         {  
          74.             public void actionPerformed(ActionEvent e)  
          75.             {  
          76.                 double r = 0,l = 0;  
          77.                 float n = 0,k = 0,rl = 0;  
          78.                 double pi=3.14,result=0;  
          79.                 String resultString;  
          80.                 try{  
          81.                 r=Double.parseDouble(rTextField.getText());  
          82.                 l=Double.parseDouble(lTextField.getText());  
          83.                 n=(float) Double.parseDouble(nTextField.getText());  
          84.                 rl=(float)(2*r/l);  
          85.                 if(0<rl&rl<0.1) k=0.96f;  
          86.                 else if(0.1<rl&rl<0.2) k=0.92f;  
          87.                 else if(0.2<rl&rl<0.3) k=0.88f;  
          88.                 else if(0.3<rl&rl<0.4) k=0.85f;  
          89.                 else if(0.4<rl&rl<0.6) k=0.79f;  
          90.                 else if(0.6<rl&rl<0.8) k=0.74f;  
          91.                 else if(0.8<rl&rl<1.0) k=0.69f;  
          92.                 else if(1.0<rl&rl<1.5) k=0.60f;  
          93.                 else if(1.5<rl&rl<2.0) k=0.52f;  
          94.                 else if(2.0<rl&rl<3.0) k=0.43f;  
          95.                 else if(3.0<rl&rl<4.0) k=0.37f;  
          96.                 else if(4.0<rl&rl<5.0) k=0.32f;  
          97.                 else if(5.0<rl&rl<10.0) k=0.20f;  
          98.                 else if(10.0<rl&rl<20.0) k=0.12f;  
          99.                 else throw new IOException();  
          100.                 result = k*4*pi*(Math.pow(10,-7))*1*(Math.pow(n,2))*pi*(Math.pow(r,2))/l;  
          101.                 result = result*(Math.pow(106));  
          102.                 }catch(IOException ex)  
          103.                 {  
          104.                     JOptionPane.showMessageDialog(null"半徑與長度填寫有誤");  
          105.                 }catch(Exception ex)  
          106.                 {  
          107.                     JOptionPane.showMessageDialog(null"請填寫完整數據");  
          108.                 }  
          109.                 resultString=String.valueOf(String.format("%.2f",result));  
          110.                 System.out.println(result);  
          111.                 System.out.println(resultString);  
          112.                 resultTextField.setText(resultString);  
          113.             }  
          114.         });   
          115.         frame.setSize(250,220);  
          116.         frame.setVisible(true);  
          117.     }  
          118.   
          119. }  

          posted on 2012-10-04 11:05 你爸是李剛 閱讀(178) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2012年10月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          文章檔案

          技術網站

          行業網站

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          站長網 氟塑料離心泵 注塑機 液晶廣告機
          主站蜘蛛池模板: 平安县| 隆德县| 平远县| 青冈县| 南通市| 喀喇沁旗| 长汀县| 江门市| 木里| 科技| 囊谦县| 阿城市| 平顺县| 光山县| 鹤壁市| 湘乡市| 砚山县| 平凉市| 开平市| 永州市| 东山县| 福清市| 天气| 阳信县| 德兴市| 玉门市| 崇阳县| 正蓝旗| 眉山市| 呼图壁县| 盐津县| 阳原县| 永城市| 循化| 渑池县| 亚东县| 延吉市| 扶风县| 勐海县| 米林县| 师宗县|