基本信息
源码名称:电容充电计算器(源码)
源码大小:0.09M
文件格式:.rar
开发语言:C#
更新时间:2019-10-23
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
电容放电计时计算器
可以计算容性负载过流保护时间,配置熔断器等
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
float c, u, r, i, t, uc;
bool button2_clik;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
MessageBox.Show("请输入容值");
else if (textBox2.Text == "")
MessageBox.Show("请输入电压");
else if (textBox3.Text == "")
MessageBox.Show("请输入阻值");
else if (textBox4.Text == "")
MessageBox.Show("请输入电流");
else
{
c=float.Parse( textBox1.Text);
u = float.Parse(textBox2.Text);
r = float.Parse(textBox3.Text);
i = float.Parse(textBox4.Text);
t= ((float)(Math.Log(i * r / u,Math.E )))*(-r)*c; //Log(a,b)这里以b为底
uc = u * (1 -(float)( Math.Exp( -t / r / c)));
textBox5.Text = t.ToString();
textBox6.Text = uc.ToString();
}
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
int halfWidth = panel1.Width / 2;
int halfHeight = panel1.Height / 2;
Pen mypen = new Pen(Color.Blue, 2);
AdjustableArrowCap arrow = new AdjustableArrowCap(8, 8, false);
mypen.CustomEndCap = arrow;
g.DrawLine(mypen, 7, halfHeight, panel1.Width - 7, halfHeight);
g.DrawLine(mypen, halfWidth, panel1.Height - 5, halfWidth, 5);
g.TranslateTransform(panel1.Width / 2,panel1.Height / 2);
if(button2_clik)
{
Point[] points = new Point[1000];
for (int j = 1; j < points.Length; j )
{
points[j] = new Point(j, Convert.ToInt32(-u * (1 - (float)(Math.Exp(-j / r / c)))));
}
g.DrawLines(Pens.Red, points);
}
}
private void button2_Click(object sender, EventArgs e)
{
button2_clik = true;
panel1.Refresh();
}
}
}