基于学习共同体的微课学习平台源码(C#)
- 格式:doc
- 大小:801.44 KB
- 文档页数:72
10个经典的C++源码开源世界有许多优秀的开源项⽬,我选取其中⼗个最优秀的、最轻量级的C语⾔的项⽬,希望可以为C语⾔开发⼈员提供参考。
1. Webbench2. Tinyhttpd3. cJSON4. CMockery5. Libev6. Memcached7. Lua8. SQLite9. UNIX v610. NETBSD⼗个最值得阅读学习的C开源项⽬代码1. WebbenchWebbench是⼀个在linux下使⽤的⾮常简单的⽹站压测⼯具。
它使⽤fork()模拟多个客户端同时访问我们设定的URL,测试⽹站在压⼒下⼯作的性能,最多可以模拟3万个并发连接去测试⽹站的负载能⼒。
Webbench使⽤C语⾔编写, 代码实在太简洁,源码加起来不到600⾏。
下载链接:2. Tinyhttpdtinyhttpd是⼀个超轻量型Http Server,使⽤C语⾔开发,全部代码只有502⾏(包括注释),附带⼀个简单的Client,可以通过阅读这段代码理解⼀个 Http Server 的本质。
下载链接:3. cJSONcJSON是C语⾔中的⼀个JSON编解码器,⾮常轻量级,C⽂件只有500多⾏,速度也⾮常理想。
cJSON也存在⼏个弱点,虽然功能不是⾮常强⼤,但cJSON的⼩⾝板和速度是最值得赞赏的。
其代码被⾮常好地维护着,结构也简单易懂,可以作为⼀个⾮常好的C语⾔项⽬进⾏学习。
项⽬主页:4. CMockerycmockery是google发布的⽤于C单元测试的⼀个轻量级的框架。
它很⼩巧,对其他开源包没有依赖,对被测试代码侵⼊性⼩。
cmockery的源代码⾏数不到3K,你阅读⼀下will_return和mock的源代码就⼀⽬了然了。
主要特点:1. 免费且开源,google提供技术⽀持;2. 轻量级的框架,使测试更加快速简单;3. 避免使⽤复杂的编译器特性,对⽼版本的编译器来讲,兼容性好;4. 并不强制要求待测代码必须依赖C99标准,这⼀特性对许多嵌⼊式系统的开发很有⽤下载链接:5. Libevlibev是⼀个开源的事件驱动库,基于epoll,kqueue等OS提供的基础设施。
“学习共同体”方式下的语文阅读教学作者:琚运涛来源:《中国校外教育(上旬)》2018年第11期【摘要】“学习共同体”(learning community)或译为“学习社区”,是支撑以知识建构与意义协商为内涵的学习的平台。
学校班级学习共同体是由学习者(学生)和助学者(教师)共同组成的,以完成共同的学习任务为载体,以促进成员全面成长为目的的,强调在学习过程中以相互作用式的学习观作指导,通过人际沟通、交流和分享各种学习资源而相互影响、相互促进的基层学习集体。
它与传统教学班和教学组织的主要区别在于强调人际心理相容与沟通,在学习中发挥群体动力作用。
“学共体”充分展现了以学生为中心,以学习为重心的教育理念。
“学共体”的概念最早于1896年由教育学家杜威提出,20世纪70年代在欧美一些国家的教育改革中得到传承。
1992年,日本教育改革开始引入,并在以佐藤学为代表的一批教育专家、一线教育工作者的推动下很快席卷日本全土。
那么,“学共体”的教学方式有哪些要素,又如何具体操作?从阅读教学的实践进行分析。
【关键词】阅读教学学习共同体对话时代在发展,社会在变革,我们身边的一切也都在发生着全面、深刻而复杂的变化。
新情况、新问题层出不穷。
我们传统的语文教学在信息化社会全面到来的今天,也不可避免卷入其中。
各种新观点、新思想、新尝试让身处教学一线的语文老师眼花缭乱,不知所从,但是变革不可避免,关键在于怎么变。
20世纪90年代末,我所在的宁海县西店中学语文教研组开始尝试“基于学情的课堂教学”的教学模式,利用“课堂工作纸”了解学生的“学情”,再依据“学情”,进行二次备课,最后进入课堂教学。
教学过程分为自学(学生利用课堂工作纸的自主学习)、互学(学生小组合作学习)、问学(师生共同学习)。
这种教学方式极大地调动了学生学习的积极性,充分展现了学生学习的自主性,活跃了课堂学习气氛,提高了课堂学习效率,取得了显著成效。
当然,也出现了一些问题,最主要的就是学生学习基础的不同,导致了学生在合作学习中的参与度不均衡,教学无法关照到所有学生。
1. 引言Scratch是一种通过积木式编程语言进行可视化编程的工具,它适合初学者学习编程的利器。
在Scratch中,学习者可以通过拖拽积木来搭建程序,而不需要直接编写代码,这样能够降低学习编程的门槛,让更多的人能够轻松地接触编程。
2. Scratch循序渐进的学习方法在Scratch中学习编程,最好采用循序渐进的学习方法。
这样能够建立起学生对编程的信心和兴趣,使他们更容易掌握编程的基本原理和技巧。
下面是200个Scratch的实例源代码,希望能够帮助学习者更好地掌握Scratch编程。
3. Scratch实例源代码(以下为部分实例源代码,共200个实例源代码未一一列举出来)1)画一个圆形当flag被点击重复360次移动1步转动1度2)画一个正方形当flag被点击重复4次移动100步转动90度3)画一个三角形当flag被点击重复3次移动100步转动120度4)制作一个跳动的小猫当flag被点击重复10次移动10步跳跃到高度1005)制作一个闪烁的星星当flag被点击无限循环显示等待1秒隐藏等待1秒6)制作一个变化颜色的气球当flag被点击无限循环改变颜色至蓝色等待1秒改变颜色至红色等待1秒4. 结语通过以上200个Scratch实例源代码的学习,相信读者能够更好地掌握Scratch编程的基本原理和技巧。
希望大家能够通过不断的实践和学习,掌握更多的编程知识,将编程技能运用到实际的项目中去。
祝大家学习进步,编写出更加精彩的程序!7. Scratch应用实例Scratch的学习不仅仅是为了理解编程的基本原理和技巧,更重要的是将所学知识应用到实际项目中。
下面将介绍几个常见的Scratch应用实例,希望能够启发读者将自己的创意和想法用Scratch实现出来。
7.1)编写一个物理模拟程序利用Scratch的角色和积木,可以编写一个简单的物理模拟程序,比如模拟抛物运动、弹簧振动等。
通过设置不同的参数和条件,可以观察不同情况下的运动规律,这有助于学生深入理解物理学中的一些概念,比如加速度、速度、力等。
c语言乌云高娃配套源代码
C语言乌云高娃配套源代码
1、开发环境:
(1)语言:C语言
(2)IDE:Visual Studio 2008;
(3)操作系统:Windows 7 或更高版本。
2、乌云高娃源代码简介
乌云高娃是一款教学性项目,主要用于展示C语言的基础知识。
该项目中包含多个编程练习,涵盖变量、运算符、选择流程、循环流程、函数等内容,旨在帮助更好地掌握C语言知识。
3、对源代码的使用
(1)根据流程,自主学习知识:乌云高娃项目提供了一个简明易懂的编程规范,通过自主学习这种编程流程,逐步学习C语言知识,进一步提高编程技术。
(2)原行代码,实现可用程序:通过使用乌云高娃源代码,可以实现可用的程序。
使用者可以对代码进行任意定制,针对不同的项目、应用场景,运用自己掌握的C语言知识,实现自己的理想程序。
4、优势
(1)易理解、易操作:乌云高娃源代码编程流程以最简洁的方式表达,一目了然,便可知晓源码所表达的意思,易于上手使用。
(2)灵活定制:乌云高娃源代码提供了多种定制方案,使用者可以针
对不同的项目、应用场景,运用自己掌握的C语言知识,实现自己的
理想程序。
(3)精准学习:乌云高娃源代码涉及到C语言的各个细节,学习者可
以使用其中的各种源代码,在操作中深入学习C语言的数据结构以及
复杂的知识点。
(4)实时反馈:学习者可以在源代码的基础上,动手实现自己想要的
程序,实时反馈可以帮助学习者更好地掌握C语言知识。
C++程序设计源代码1.引言本文档旨在为读者提供详细的C++程序设计指南。
它涵盖了C++语言的基础知识、常用编程技巧和实例代码。
通过学习本文档,你将能够掌握C++语言的核心概念,并能够编写高效、可维护的程序。
2.C++语言简介2.1 C++的起源●C++的由来●C++的演变过程2.2 C++的特性●面向对象编程●泛型编程●支持底层操作●多线程支持2.3 C++开发环境搭建●安装编译器●配置开发环境●Hello World程序演示3.C++基础知识3.1 变量和数据类型●基本数据类型●常量●变量声明和定义3.2 运算符和表达式●算术运算符●逻辑运算符●条件运算符3.3 控制流语句●条件语句●循环语句●跳转语句3.4 函数●函数的定义和调用●函数参数传递●函数重载和递归3.5 数组和字符串●数组定义和使用●字符串处理3.6 指针和引用●指针的基本概念●指针与数组●引用的概念和用法4.面向对象编程4.1 类和对象●类的定义和使用●对象的创建和初始化●析构函数的使用4.2 封装、继承和多态●封装的概念和实现●继承的概念和实现●多态的概念和实现5.标准库和常用工具5.1 标准库概览●标准输入输出库●容器和算法库●字符串和正则表达式库●并发编程库5.2 常用工具介绍●调试工具●性能分析工具●代码工具●文档工具6.实例代码演示6.1 示例1:计算器程序●界面设计●基本功能实现●扩展功能实现6.2 示例2:学绩管理系统●数据结构设计●基本操作实现●高级功能实现7.附件本文档附带的附件包括示例代码、编译运行的截图和相关资料。
请查阅附件以获得更多信息和资源。
8.法律名词及注释8.1 版权●版权法定义●版权声明8.2 开源许可证●不同开源许可证的区别●开源许可证的要求和限制●常用开源许可证列表8.3 商标●商标法定义●商标使用和保护●商标注册流程。
CC++开源库及⽰例代码C/C++ 开源库及⽰例代码Table of Contents说明本页⾯汇总俺收集的各种 C 和 C++ 的开源代码库,不定期更新。
如果你发现本页⾯的开源库有错漏之处,⾮常欢迎给俺提供反馈——有 GitHub 帐号的同学,可以;没帐号的同学,可以去留⾔。
1 综合性的库BoostHome:Wikipedia:、Boost ⼤概是最重要的第三⽅ C++ 库。
其作者有很多是 C++ 标准委员会的成员。
Boost 的很多⼦库后来都成为 C++ 的标准库。
本页⾯的其它章节还会继续提及 Boost 在各种领域的应⽤。
wxWidgetsHome:Wikipedia:、这是⼀个⾮常⽼牌的 C++ 开源 GUI 框架,诞⽣于1992年。
原先叫做 wxWindows,后来因为微软的法律纠纷,改为现名。
它⽀持的操作系统平台很多(包括嵌⼊式系统)。
很多开源项⽬⽤到它,⽐如:BitTorrent、aMule、FileZilla、Code::Blocks、Dolphin......虽然它以 GUI 为主,但是也提供了其它⼀些辅助功能(⽐如:进程间通讯、⽹络、数据库、多媒体......)QtHome:Wikipedia:、它⽀持的操作系统平台很多(包括嵌⼊式系统)。
虽然它以 GUI 为主,但是也提供了其它⼀些辅助功能(⽐如:⽹络、数据库、多媒体、3D引擎......)APR(Apache Portable Runtime)Home:Wikipedia:、这是由 Apache 社区维护的 C 开源库,主要提供操作系统相关的功能(⽂件系统、进程、线程、⽤户、IPC)。
此外还提供了⼀些⽹络相关的功能。
APR 原先是 Apache Web 服务器的⼀个组成部分,后来独⽴出来,成为⼀个单独的开源项⽬。
ACE(Adaptive Communication Environment)Home:Wikipedia:、这是⼀个跨平台的 C++ 库,提供了⼀套⽹络通讯的框架;另外还⽀持线程、进程和 IPC。
“学习共同体”在高职课程教学应用中的初步研究作者:朱昭锦来源:《现代商贸工业》2022年第05期摘要:学习共同体教学模式是以建构主义教学观为基础的教学模式,它与传统教学班和教学组织相比,学习共同体更强调学习者与助学者的人际沟通与心理相容,共同体成员之间互相影响,在学习过程中发挥群体动力作用。
本研究旨在探讨学习共同体教学模式在高职《临床康复治疗学》课程教学中的效果。
试验组采用学习共同体的模式进行教学,对照组采用传统的教学方法,研究结果显示学习共同体教学模式可以提升康复治疗技术专业学生临床康复治疗学课程综合成绩及综合素质,同时也对教师提出了更高的要求。
关键词:学习共同体;康复治疗技术;康复教育中图分类号:G4 文献标识码:A doi:10.19311/ki.1672-3198.2022.05.072课堂是用来传授知识、开阔视野、启发思维的舞台,是教师和学生学习交流的主要场所。
“学习共同体”是在建构主义理论基础上设计的一种新的教学模式,是围绕学习活动而展开的、共同体成员内部以共同的目标为愿景、以实际问题为核心的一种学习组织形式。
“学习共同体”(learning community)是指一个由学习者及其助学者(包括教师、辅导员、专家等)共同构成的团体,学习者之间、学习者与助学者之间在学习过程中进行多方沟通、交流,分享学习资源,互相探讨问题,合作完成学习任务。
与传统教学相比,学习共同体更强调学习者与助学者的人际沟通与心理相容,共同体成员之间相互影响,并在学习过程中发挥群体动力作用。
康复治疗技术专业培养具有扎实的自然科学知识、生物医学基础理论和康复治疗基础理论、良好的职业道德和创新精神,集康复、医疗、预防、保健于一体的应用型技术人才。
康复治疗师的工作特点,以及“以患者为中心”的团队工作模式都将越来越考验康复人才的专业水平、人际交流能力和团队协作能力。
而“学习共同体”的理念与之有所联系。
《临床康复治疗学》是高职康复治疗技术专业的核心课程,是康复评估和康复治疗技术的集中体现,将前导课程中所学到的专业知识和技能运用到患者身上,具有很强的实用性和应用性。
using System;using System.Collections.Generic;using System.Text;///<summary>/// ????///</summary>///<param name="strdata"></param>///<returns></returns>public static bool SetCycTime(string strdata,boolresult,.TcpClient tc){try{CmdBase cmdInfo = new CmdBase();SetBase(strdata, cmdInfo);//ST=91;CN=9011;PW=123456;MN=88888880000001;Flag=0;CP=&&QN=20040516010101001;QnRtn =1&& string strSend =String.Format("ST=91;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};QnRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionEquipment, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi1 = new HistoryDataInfo();hdi1.Value = strSend;hdi1.tc = tc;Cod.SendData(hdi1);//ST=32;CN=1011;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;SystemTime=200405160 10102&&// DateTime dt = System.DateTime.Now;// string dateTime = dt.Year.ToString("0000") + dt.Month.ToString("00") + dt.Day.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") +dt.Second.ToString("00");strSend =String.Format("ST=91;CN={0};PW={1};MN={2};CP=&&QN={3};ExeRtn={4}&&",(int)ServerEventType.CMD_SYSTEM_ResponsionComputer, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN, result ? 1 : 2);HistoryDataInfo hdi2 = new HistoryDataInfo();hdi2.Value = strSend;hdi2.tc = tc;Cod.SendData(hdi2);return true;}catch{return false;}}///<summary>/// ??yY??///</summary>///<paramname="sdata">QN=20040516010101001;ST=32;CN=1041;PW=123456;MN=88888880000001;Flag=1;CP=&&&& </param>///<returns></returns>public static bool GetDayReportTime(string sdata,.TcpClient tc) {try{CmdBase cmdInfo = new CmdBase();SetBase(sdata, cmdInfo);//ST=91;CN=9011;PW=123456;MN=88888880000001;Flag=0;CP=&&QN=20040516010101001;QnRtn=1&& string strSend =String.Format("ST=91;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};QnRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionEquipment, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi1 = new HistoryDataInfo();hdi1.Value = strSend;hdi1.tc = tc;Cod.SendData(hdi1);//ST=32;CN=1041;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;ReportTime=0101&&string sReportTime = "";strSend =String.Format("ST=91;CN={0};PW={1};MN={2};CP=&&QN={3};ReportTime={4}&&",(int)ServerEventType.CMD_SYSTEM_ResponsionComputer, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN, sReportTime);HistoryDataInfo hdi2 = new HistoryDataInfo();hdi2.Value = strSend;hdi2.tc = tc;Cod.SendData(hdi2);//ST=91;CN=9012;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;ExeRtn =1&&strSend =String.Format("ST=91;CN={0};PW={1};MN={2};CP=&&QN={3};ExeRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionComputer, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi3 = new HistoryDataInfo();hdi3.Value = strSend;hdi3.tc = tc;Cod.SendData(hdi3);return true;}catch{return false;}}//public static bool GetHistoryReport(string sdata)//{// try// {// CmdBase cmdInfo = new CmdBase();// SetBase(sdata, cmdInfo);////ST=91;CN=9011;PW=123456;MN=88888880000001;Flag=0;CP=&&QN=20040516010101001;QnRtn=1&& // string strSend =String.Format("ST=91;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};QnRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionEquipment, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);// HistoryDataInfo hdi1 = new HistoryDataInfo();// hdi1.Value = strSend;// Cod.SendData(hdi1);// //********************************************************// List<ReportItems> reportTable =DBAccess.GetSendReportData(ReportTypeEnum.Minute, new DateTime(), new DateTime());// for (int i = 0; i < reportTable.Count; i += 10)// {// }// //********************************************************////ST=91;CN=9012;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;ExeRtn =1&& // strSend =String.Format("ST=91;CN={0};PW={1};MN={2};CP=&&QN={3};ExeRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionComputer, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);// HistoryDataInfo hdi3 = new HistoryDataInfo();// hdi3.Value = strSend;// Cod.SendData(hdi3);// return true;// }// catch// return false;// }//}public static bool GetIp(string sdata, .TcpClient tc){string ip = "";string port="";try{CmdBase cmdInfo = new CmdBase();SetBase(sdata, cmdInfo);//ST=91;CN=9011;PW=123456;MN=88888880000001;Flag=0;CP=&&QN=20040516010101001;QnRtn =1&& string strSend =String.Format("ST=91;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};QnRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionEquipment, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi1 = new HistoryDataInfo();hdi1.Value = strSend;hdi1.tc = tc;Cod.SendData(hdi1);//ST=32;CN=1011;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;SystemTime=200405160 10102&&DateTime dt = System.DateTime.Now;string dateTime = dt.Year.ToString("0000") + dt.Month.ToString("00") + dt.Day.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") +dt.Second.ToString("00");if (tc == Cod.tcpClient1)//D???D{ip = .RemortIP;port = .DataPort.ToString();}else if (tc == Cod.tcpClient2)//t????D{}else if (tc == Cod.tcpClient3)//???D{ip= .RemortIP;port = .DataPort.ToString();else if (tc == Cod.tcpClientMaintain1)//????D{ip = .IP1;port = .Port1.ToString();}else if (tc == Cod.tcpClientMaintain2)//????D2{ip = .IP2;port = .Port2.ToString();}strSend =String.Format("ST=32;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};IP={4},Port={5}&&",(int)ServerEventType.CMD_SYSTEM_GetDateTime, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN,ip,port);HistoryDataInfo hdi2 = new HistoryDataInfo();hdi2.Value = strSend;hdi2.tc = tc;Cod.SendData(hdi2);//ST=91;CN=9012;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;ExeRtn =1&&strSend =String.Format("ST=91;CN={0};PW={1};MN={2};CP=&&QN={3};ExeRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionComputer, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi3 = new HistoryDataInfo();hdi3.Value = strSend;hdi3.tc = tc;Cod.SendData(hdi3);return true;}catch{return false;}}public static bool SetIp(string sdata, .TcpClient tc){try{string cp = sdata.Substring(sdata.IndexOf("&&")+2,stIndexOf("&&")-sdata.IndexOf("&&")-2);string[] cparray = cp.Split(';');string ip="", port="";foreach (string str in cparray){if (str.Contains("IP")){ip = str.Substring(str.IndexOf("IP=") + 3, str.IndexOf(',')-3); port = str.Substring(str.IndexOf("Port=") + 5);}}// string ip = cparray[1].Substring(cparray[1].IndexOf("IP=") + 3,cparray[1].IndexOf(",") - (cparray[1].IndexOf("IP=") + 3));// string port = cparray[1].Substring(cparray[1].IndexOf("Port=") + 5, cparray[1].Length - (cparray[1].IndexOf("Port=") + 5));CmdBase cmdInfo = new CmdBase();SetBase(sdata, cmdInfo);//ST=91;CN=9011;PW=123456;MN=88888880000001;Flag=0;CP=&&QN=20040516010101001;QnRtn =1&& string strSend =String.Format("ST=91;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};QnRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionEquipment, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi1 = new HistoryDataInfo();hdi1.Value = strSend;hdi1.tc = tc;Cod.SendData(hdi1);//ST=32;CN=1011;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;SystemTime=200405160 10102&&DateTime dt = System.DateTime.Now;string dateTime = dt.Year.ToString("0000") + dt.Month.ToString("00") + dt.Day.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") +dt.Second.ToString("00");if (tc == Cod.tcpClient1)//D???D{.RemortIP=ip;.DataPort=Convert.ToInt32( port);}else if (tc == Cod.tcpClient2)//t????D{}else if (tc == Cod.tcpClient3)//???D{.RemortIP=ip;.DataPort = Convert.ToInt32(port);}else if (tc == Cod.tcpClientMaintain1)//????D{.IP1=ip;.Port1 = Convert.ToInt32(port);}else if (tc == Cod.tcpClientMaintain2)//????D2{.IP2=ip;.Port2 = Convert.ToInt32(port);}strSend =String.Format("ST=32;CN={0};PW={1};MN={2};Flag=0;CP=&&QN={3};ExeRtn=1&&",(int)ServerEventType.CMD_SYSTEM_GetDateTime, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi2 = new HistoryDataInfo();hdi2.Value = strSend;hdi2.tc = tc;Cod.SendData(hdi2);//ST=91;CN=9012;PW=123456;MN=88888880000001;CP=&&QN=20040516010101001;ExeRtn =1&&strSend =String.Format("ST=91;CN={0};PW={1};MN={2};CP=&&QN={3};ExeRtn=1&&",(int)ServerEventType.CMD_SYSTEM_ResponsionComputer, cmdInfo.PW, cmdInfo.MN, cmdInfo.QN);HistoryDataInfo hdi3 = new HistoryDataInfo();hdi3.Value = strSend;hdi3.tc = tc;Cod.SendData(hdi3);return true;}catch{return false;}}}}using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Text;using System.IO.Ports;using OA.Model;using OA.Mesosphere;namespace m {///<summary>/// ???///</summary>public class ClsFMFlux1 : CommBase {public ClsFMFlux1(){base.setComPort(rs232Info);}private Rs232Info rs232Info = Rs232Model.ModelFlux1;private byte startByte = 6;private byte endByte = 8;///<summary>/// T??///</summary>///<param name="_address"></param>///<returns></returns>public string ModifyAddress(byte _address) {//yY?a10?int chkSum = 0;byte[] sendByte = new byte[9];sendByte[0] = startByte;sendByte[1] = 48;sendByte[2] = 50;chkSum += 48 + 50;string saddress = _address.ToString("00");sendByte[3] = Convert.ToByte(((int)saddress.Substring(0, 1).ToCharArray()[0]).ToString("X"));chkSum += (int)saddress.Substring(0, 1).ToCharArray()[0];sendByte[4] = Convert.ToByte(((int)saddress.Substring(1, 1).ToCharArray()[0]).ToString("X"));chkSum += (int)saddress.Substring(1, 1).ToCharArray()[0];string send = chkSum.ToString("X");for (int i = 0; i < 3 - send.Length; ++i) {send = "0" + send;}sendByte[5] = Convert.ToByte(((int)send.Substring(0, 1).ToCharArray()[0]).ToString("X"));sendByte[6] = Convert.ToByte(((int)send.Substring(1, 1).ToCharArray()[0]).ToString("X"));sendByte[7] = Convert.ToByte(((int)send.Substring(2, 1).ToCharArray()[0]).ToString("X"));sendByte[8] = endByte;//**********base.setComPort(rs232Info);//try {if (!Port.IsOpen)Port.Open();Port.Write(sendByte, 0, 9);System.Threading.Thread.Sleep(100);//string str = Port.ReadTo(Convert.ToChar(8).ToString());//} catch {// return null;//}return"";}private static double dTotalValue = 0;public FluxValueInfo GetValue(int minValue, int maxValue,int delay){CODInfo codInfo = new CODInfo();Random radom = new Random();double dCurrentValue = 0.99 * radom.Next(minValue, maxValue);dTotalValue += dCurrentValue * delay / 10000;//???????????????????????????????FluxValueInfo fluxValueInfo = new FluxValueInfo(1,dCurrentValue, dTotalValue);return fluxValueInfo;}public FluxValueInfo GetValue(){rs232Info = Rs232Model.ModelFlux1;switch (rs232Info.Version){case"?-??":return GetValue(1);case"?286":return GetBeiHuanKe286();case"WL-1A1?-":return GetWL_1A1JiuBo();case"WL-1A1?-":return GetWL_1A1YiWen();case"MLF-100W":return GetMeiLun100(rs232Info);case"??-??FLV":return GetXianChao2000(rs232Info);case"????":return GetGelepuTDS_100();default: return GetValue(1);}}///<summary>/// ?????TDS-100??/// modbus rtu??///</summary>///<returns></returns>private FluxValueInfo GetGelepuTDS_100(){//throw new Exception("The method or operation is not implemented.");List<byte> request = new List<byte>();List<byte> response = new List<byte>();request.Add((byte)rs232Info.ModbusAddress);request.Add(3);request.Add(0);request.Add(0);request.Add(0);request.Add(10);char crc = ClsFMCOD.GetCrc16(request);request.Add((byte)crc);request.Add((byte)(crc >> 8));lock (ManualReset.fluxCommLock){try{using (SerialPort port = new SerialPort(rs232Info.PortName, rs232Info.BaudRate, rs232Info.Parity, rs232Info.DataBits)){if (!port.IsOpen){port.ReadTimeout = 500;port.Open();port.Write(request.ToArray(), 0, request.Count);try{while (true){response.Add((byte)port.ReadByte());if (response.Count == 25)break;}}catch{// ReadTimeOut}}}}catch{}}//byte[] val = new byte[4];//val[0] = 0x51;//val[1] = 0x06;//val[2] = 0x9E;//val[3] = 0x3F;// double b = BitConverter.ToSingle(val, 0);try{if (response.Count == 25 && response[0] == request[0] && response[1] == request[1] && response[2] == 20){byte[] val = new byte[4];val[0] = response[4];val[1] = response[3];val[2] = response[6];val[3] = response[5];double fluxvalue = BitConverter.ToSingle(val, 0) / 3.6;// m3/h / 3.6 -> L/Slong tota = long.Parse(response[21].ToString("X2") +response[22].ToString("X2") + response[19].ToString("X2") + response[20].ToString("X2"), System.Globalization.NumberStyles.HexNumber);FluxValueInfo flux = new FluxValueInfo();flux.CurrentValue = fluxvalue;flux.TotalValue = tota;return flux;}}catch{ }return null;}///<summary>/// ???XCT-2000??///</summary>///<param name="rs232Info"></param>///<returns></returns>private FluxValueInfo GetXianChao2000(Rs232Info rs232Info){// throw new Exception("The method or operation is not implemented.");string request = "NXDQS&DI+" + "\r";List<byte> res = new List<byte>();lock (ManualReset.fluxCommLock){using (SerialPort port = new SerialPort(rs232Info.PortName,rs232Info.BaudRate)){try{if (!port.IsOpen){port.ReadTimeout = 500;port.Open();port.Write(request);try{int cr = 0;//??ywhile (true){int readbyte = port.ReadByte();res.Add((byte)readbyte);if (readbyte == 0x0D){cr++;if (cr == 2){break;}}}}catch//timeout{res.Clear();}}}catch//port error{ }}}try{//+2.702503E-01m3/s//+4225888E+0m3if (res.Count > 20)// 10 00036859 0001674578 30 :3.6859M3/S 16745.78M3{string response = ASCIIEncoding.ASCII.GetString(res.ToArray());if (response.IndexOf("\r") != stIndexOf("\r")){string[] valuetotal = response.Split('\r');valuetotal[0] = valuetotal[0].Trim();valuetotal[1] = valuetotal[1].Trim();string value = valuetotal[0].Substring(0,valuetotal[0].IndexOf('E'));double val = Convert.ToDouble(value) * Math.Pow(10,Convert.ToDouble(valuetotal[0].Substring(valuetotal[0].IndexOf('E') + 1, 3)));string total = valuetotal[1].Substring(0,valuetotal[1].IndexOf('E'));double tot = Convert.ToDouble(total) * Math.Pow(10,Convert.ToDouble(valuetotal[1].Substring(valuetotal[1].IndexOf('E') + 1, 2)));// string value = response.Substring(2, 8);// string total = response.Substring(10, 12);FluxValueInfo flux = new FluxValueInfo();flux.CurrentValue = val * 1000; // M3/S->L/Sflux.TotalValue = tot;return flux;}}}catch{}return null;}///<summary>/// -///</summary>///<returns></returns>private FluxValueInfo GetMeiLun100(Rs232Info rs232){// throw new Exception("The method or operation is not implemented.");string request = "*" + rs232.ModbusAddress.ToString().PadLeft(3, '0') + "1";List<byte> res = new List<byte>();lock (ManualReset.flux1CommLock){using (SerialPort port = new SerialPort(rs232.PortName, rs232.BaudRate)) {try{if (!port.IsOpen){port.ReadTimeout = 500;port.Open();port.Write(request);try{while (true){int readbyte = port.ReadByte();res.Add((byte)readbyte);if (res.Count == 24)break;}}catch//timeout{}}}catch//port error{ }}}try{if (res.Count == 24)// 10 00036859 0001674578 30 :36.859M3/S16745.78M3{string response = ASCIIEncoding.ASCII.GetString(res.ToArray());//ASCIIEncoding.ASCII.ToString(res.ToArray());if (response.Substring(0, 1) == "1" && response.Substring(1, '1') =="0"){string value = response.Substring(2, 8);string total = response.Substring(10, 12);FluxValueInfo flux = new FluxValueInfo();flux.CurrentValue = Convert.ToDouble(value) / 10; // M3/S->L/Sflux.TotalValue = Convert.ToDouble(total) / 1000;return flux;}}}catch{}return null;}///<summary>/// ??///</summary>///<param name="porto?"></param>///<param name="lengtho??"></param>///<returns></returns>public Collection<byte> ReadPort(SerialPort port, int length){Collection<byte> respones = new Collection<byte>();try{while (true){int byteread = port.ReadByte();respones.Add((byte)byteread);if (respones.Count == length)return respones;}}catch (TimeoutException){return null;}}///<summary>/// ????yY///</summary>///<returns></returns>private FluxValueInfo GetBeiHuanKe286(){List<byte> request = new List<byte>();request.Add(0xEB);request.Add(0x4D);request.Add(0x90);request.Add(0x01);try{lock (ManualReset.flux1CommLock){using (SerialPort port = new SerialPort(Port.PortName, 9600)) {port.ReadTimeout = 500;if (!port.IsOpen){port.Open();port.Write(request.ToArray(), 0, request.Count);Collection<byte> response = ReadPort(port, 11);if (response.Count == 11){double dCurrentValue =Convert.ToInt32(response[5].ToString("X").PadLeft(2, '0') +response[6].ToString("X").PadLeft(2, '0'));//int in1 =Math.Pow( 10, (4 - response[4]) >= 0 ? 4 - response[4] : 0);//dCurrentValue = dCurrentValue / (10 * ((4 -response[4]) >= 0 ? 4 - response[4] : 0));dCurrentValue = dCurrentValue / Math.Pow(10, (4 - response[4]) >= 0 ? 4 - response[4] : 0);//double dCurrentValue =Convert.ToDouble(value.Substring(0, 4) + "." + value.Substring(4, 3));dCurrentValue = dCurrentValue / 3.6;//??yY?aM3/H,a?aL/Sdouble dTotalValue =Convert.ToDouble(response[7].ToString("X")) + Convert.ToDouble(response[8].ToString("X")) * 100 + Convert.ToDouble(response[9].ToString("X")) * 10000 +Convert.ToDouble(response[10].ToString("X")) * 1000000;FluxValueInfo fluxValueInfo = new FluxValueInfo(1, dCurrentValue, dTotalValue);return fluxValueInfo;}}}}}catch{}finally{try{if (Port.IsOpen){Port.Close();}}catch{}}return null;}///<summary>/// ?-///</summary>///<returns></returns>private FluxValueInfo GetWL_1A1JiuBo(){// throw new Exception("The method or operation is not implemented.");List<byte> request = new List<byte>();request.Add((byte)0x11);List<byte> response = new List<byte>();// string response="";try{lock (ManualReset.flux1CommLock){using (SerialPort port = new SerialPort(Port.PortName,Port.BaudRate, Port.Parity, Port.DataBits, Port.StopBits)){port.ReadTimeout = 1000;if (!port.IsOpen){port.Open();port.Write(request.ToArray(), 0, request.Count);// System.Threading.Thread.Sleep(1000);try{while (true){int byteread = port.ReadByte();if (byteread == 0x0D){break;}response.Add((byte)byteread);}}catch{}}}}}catch{}finally{if (Port.IsOpen){Port.Close();}}try{if (response.Count > 0){string result =System.Text.ASCIIEncoding.ASCII.GetString(response.ToArray());string[] splitResult = result.Split((char)0x0A);// result = result.Replace(" ", "");if (splitResult.Length == 8){ // YEAR MONTH DATEHOUR MINSECOND// string Time ="20"+splitResult[0].Substring(splitResult[0].IndexOf("=")+1) ;// "20" +result.Substring(result.IndexOf("T=") + 2, 2) + result.Substring(result.IndexOf("T=") + 5, 2) + result.Substring(result.IndexOf("T=") + 8, 2) + result.Substring(result.IndexOf("T=") + 10, 2) + result.Substring(result.IndexOf("T=") + 13, 2) +result.Substring(result.IndexOf("T=") + 16, 2);string Total = splitResult[1].Substring(splitResult[1].IndexOf("=") + 1);string Value = splitResult[2].Substring(splitResult[2].IndexOf("=") + 1, splitResult[2].IndexOf("(") - splitResult[2].IndexOf("=") - 1);FluxValueInfo flux = new FluxValueInfo();flux.CurrentValue = Convert.ToDouble(Value);if (splitResult[2].Contains("(22,"))//CODEo 21:L/S?22:M3/H?a?aL/S{flux.CurrentValue = flux.CurrentValue / 3.6;}flux.TotalValue = Convert.ToDouble(Total);return flux;}}}catch{ }return null;// if(response.Contains("T=")&&response.Contains("M=")&&response.Contains("T=") }///<summary>/// ?-///</summary>///<returns></returns>public FluxValueInfo GetWL_1A1YiWen(){// return null;List<byte> request = new List<byte>();request.Add((byte)0x11);List<byte> response = new List<byte>();try{lock (ManualReset.flux1CommLock){using (SerialPort port = new SerialPort(Port.PortName, 2400, Parity.Even, 8, System.IO.Ports.StopBits.One)){if (!port.IsOpen){port.ReadTimeout = 1000;port.Open();port.Write(request.ToArray(), 0, request.Count);try{while (true){int byteread = port.ReadByte();if (byteread == 0x0D){break;}response.Add((byte)byteread);}}catch{}}}}}catch{}try{if (response.Count > 0){string rec = ASCIIEncoding.ASCII.GetString(response.ToArray());if (rec.Contains("Q=") && rec.Contains("M="))//model:06m02d02:05Q=54.42L/S M=00022561 07A1{FluxValueInfo flux = new FluxValueInfo();string Val = rec.Substring(rec.IndexOf("Q=") + 2,rec.IndexOf("L/S") - rec.IndexOf("Q=") - 2);string Total = rec.Substring(rec.IndexOf("M=") + 2, rec.Length - rec.IndexOf("M=") - 2 - 4);flux.CurrentValue = Convert.ToDouble(Val);flux.TotalValue = Convert.ToDouble(Total);return flux;}}}catch{ }return null;}private double cou = 10;///<summary>/// ?yY///</summary>///<param name="_address"></param>///<returns></returns>public FluxValueInfo GetValue(byte _address){//**********?#if DEBUG//Random radom = new Random();//double dd = 0.99 * radom.Next(1, 10);//cou += dd;//FluxValueInfo _fluxValueInfo = new FluxValueInfo(_address,//radom.Next(8, 10), cou);//return _fluxValueInfo;#endif//**********//yY?a0?string ret = "";int chkSum = 0;byte[] sendByte = new byte[9];sendByte[0] = startByte;sendByte[1] = 57;sendByte[2] = 57;chkSum += 57 + 57;string saddress = _address.ToString("00");sendByte[3] = Convert.ToByte((int)saddress.Substring(0, 1).ToCharArray()[0]); chkSum += (int)saddress.Substring(0, 1).ToCharArray()[0];sendByte[4] = Convert.ToByte((int)saddress.Substring(1, 1).ToCharArray()[0]); chkSum += (int)saddress.Substring(1, 1).ToCharArray()[0];string send = chkSum.ToString("X");for (int i = 0; i < 3 - send.Length; ++i) {send = "0" + send;}sendByte[5] = Convert.ToByte((int)send.Substring(0, 1).ToCharArray()[0]);sendByte[6] = Convert.ToByte((int)send.Substring(1, 1).ToCharArray()[0]);sendByte[7] = Convert.ToByte((int)send.Substring(2, 1).ToCharArray()[0]);sendByte[8] = endByte;//**********try{if (!Port.IsOpen)Port.Open();Port.Write(sendByte, 0, 9);char _end = (char)3;ret = Port.ReadTo(_end.ToString());string value = ret.Substring(5, 17);double dCurrentValue = Convert.ToDouble(value.Substring(0, 4) + "." + value.Substring(4, 3));dCurrentValue = dCurrentValue / 3.6;//??yY?aM3/H,a?aL/Sdouble dTotalValue = Convert.ToDouble(value.Substring(7, 8) + "." + value.Substring(15, 2));FluxValueInfo fluxValueInfo = new FluxValueInfo(_address,dCurrentValue, dTotalValue);return fluxValueInfo;}catch{}finally{try{if (Port.IsOpen){Port.Close();}}catch{}}// Random r = new Random();//FluxValueInfo _fluxValueInfo = new FluxValueInfo(_address,// 0, 0);return null;}//**************//a???a1?Byte,???2???2??yY???3????1?//29?+yY???///<summary>/// ????T?///</summary>public string ModifyAddition(byte _address, double _value) {//yY?a10?int iData = 0;byte[] sendByte = new byte[19];sendByte[0] = startByte;sendByte[1] = 48;sendByte[2] = 49;string[] strValue = _value.ToString().Split('.');string saddress = _address.ToString("00");sendByte[3] = Convert.ToByte((int)saddress.Substring(0, 1).ToCharArray()[0]); sendByte[4] = Convert.ToByte((int)saddress.Substring(1, 1).ToCharArray()[0]);if (strValue[0].Length > 8)return"";for (int i = 0; i < 8 - strValue[0].Length; ++i) {sendByte[5 + i] = 48;iData += 48;}for (int i = 0; i < strValue[0].Length; ++i) {sendByte[5 + 8 - strValue[0].Length + i] =Convert.ToByte((int)strValue[0].Substring(i, 1).ToCharArray()[0]);iData += (int)strValue[0].Substring(i, 1).ToCharArray()[0];}if (strValue.Length < 2) {sendByte[13] = 48;sendByte[14] = 48;iData += 48 + 48;} else {sendByte[13] = Convert.ToByte((int)strValue[1].Substring(0,。