电池分档算法
大仙2017/05/22电子技术 IP:四川
using System;
using XXXXXXXXXXXXXXXXXXXXXneric;
using XXXXXXXXXXponentModel;
using System.Data;
using System.Drawing;
using XXXXXXXXXnq;
using System.Text;
using XXXXXXXXXXXXXXXXXrms;

namespace WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //测试电池数据
            double jy = 10;
            double nz = 20;
            double rl = 10;
            double dy = 30;
            double yc = 30;

            bool jyng = false;
            bool nzng = false;
            bool rlng = false;
            bool dyng = false;
            bool ycng = false;

            //7行5列设置最小值和设置最大值数据初始化
            //给数组赋datatable中的值
            //档位8行
            //设置最大参数5列,设置最小参数5列,1.jy XXXX 3.rl 4.dy 5.yc
                                            //绝缘 内阻 容量 电压 压差
                                        //1行  00   01   02   03   04
                                        //2行  10   11   12   13   14          
                                        //3行  20   21   22   23   24                                  
                                        //4行  30   31   32   33   34                    
                                        //5行  40   41   42   43   44                    
                                        //6行  50   51   52   53   54        
                                        //7行  60   61   62   63   64            
                                        //8行  70   71   72   73   74            
                
            int[,] numbermax = new int[8, 5] { { 11, 12, 13, 14, 15 },
                                               { 21, 22, 23, 24, 25 },
                                               { 31, 32, 33, 34, 35 },
                                               { 41, 42, 43, 44, 45 },
                                               { 51, 52, 53, 54, 55 },
                                               { 61, 62, 63, 64, 65 },
                                               { 71, 72, 73, 74, 75 },
                                               { 81, 82, 83, 84, 85 } };
            int[,] numbermin = new int[8, 5] { { 1, 2, 3, 4, 5 } ,
                                               { 11, 12, 13, 14, 15 },
                                               { 21, 22, 23, 24, 25 },
                                               { 31, 32, 33, 34, 35 },
                                               { 41, 42, 43, 44, 45 },
                                               { 51, 52, 53, 54, 55 },
                                               { 61, 62, 63, 64, 65 },
                                               { 71, 72, 73, 74, 75 } };
            for(int a=0;a<8;a++)
                if (jy < numbermax[a,0] && jy > numbermin[a,0])//第一列
                {
                    if (nz < numbermax[a,1] && nz > numbermin[a,1])//第二列
                    {
                        if (rl < numbermax[a,2] && rl > numbermin[a,2 ])//第三列
                        {
                            if (dy < numbermax[a,3] && dy > numbermin[a,3])//第四列
                            {
                                if (yc < numbermax[a,4] && yc > numbermin[a,4])//第五列
                                {
                                    //如果第一行五个都满足那么就将此电池置为OK
                                    
                                    textBox1.Text = "电池第"+(a+1).ToString()+"档ok";
                                    break;
                                }
                                else
                                {
                                    if (a == 7)
                                    {
                                        textBox1.Text = "电池第8档ng";
                                    }
                                    else
                                    {
                                        ycng = true;
                                        
                                    }
                                }
                            }
                            else
                            {
                                dyng = true;
                                
                                
                            }
                        }
                        else
                        {
                            rlng = true;
                            
                            
                        }
                    }
                    else
                    {
                        nzng = true;
                        
                        
                    }
                }
                else
                {
                    jyng = true;
                    
                    
                }

            if (jyng == true) { textBox1.Text = "绝缘ng"; }
            if (nzng == true) { textBox1.Text = "内阻ng"; }
            if (rlng == true) { textBox1.Text = "容量ng"; }
            if (dyng == true) { textBox1.Text = "电压ng"; }
            if (ycng == true) { textBox1.Text = "压差ng"; }

        }
    }
}
来自:电子信息 / 电子技术
1
已屏蔽 原因:{{ notice.reason }}已屏蔽
{{notice.noticeContent}}
~~空空如也

想参与大家的讨论?现在就 登录 或者 注册

所属专业
上级专业
同级专业
大仙
学者 机友 笔友
文章
783
回复
1652
学术分
13
2008/05/17注册,21时20分前活动

传感器测试,物联网监控,测控。130 0345 0361 手机微信同号

主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:未同步
文件下载
加载中...
{{errorInfo}}
{{downloadWarning}}
你在 {{downloadTime}} 下载过当前文件。
文件名称:{{resource.defaultFile.name}}
下载次数:{{resource.hits}}
上传用户:{{uploader.username}}
所需积分:{{costScores}},{{holdScores}}下载当前附件免费{{description}}
积分不足,去充值
文件已丢失

当前账号的附件下载数量限制如下:
时段 个数
{{f.startingTime}}点 - {{f.endTime}}点 {{f.fileCount}}
视频暂不能访问,请登录试试
仅供内部学术交流或培训使用,请先保存到本地。本内容不代表科创观点,未经原作者同意,请勿转载。
音频暂不能访问,请登录试试
支持的图片格式:jpg, jpeg, png
插入公式
评论控制
加载中...
文号:{{pid}}
投诉或举报
加载中...
{{tip}}
请选择违规类型:
{{reason.type}}

空空如也

加载中...
详情
详情
推送到专栏从专栏移除
设为匿名取消匿名
查看作者
回复
只看作者
加入收藏取消收藏
收藏
取消收藏
折叠回复
置顶取消置顶
评学术分
鼓励
设为精选取消精选
管理提醒
编辑
通过审核
评论控制
退修或删除
历史版本
违规记录
投诉或举报
加入黑名单移除黑名单
查看IP
{{format('YYYY/MM/DD HH:mm:ss', toc)}}