ExportForm.cs 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Runtime.Serialization.Formatters.Binary;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using System.Xml.Serialization;
  11. using System.Text.RegularExpressions;
  12. using System.Net;
  13. using System.Reflection;
  14. using NPOI;
  15. using NPOI.SS.UserModel;
  16. using NPOI.HSSF.UserModel;
  17. using Spire.Xls;
  18. using Workbook = Spire.Xls.Workbook;
  19. namespace MOTINOVA_Motor_Factory_Set
  20. {
  21. public partial class ExportForm : Form
  22. {
  23. //参数按照字典类型存储
  24. Dictionary<string, UInt16> Params1 = new Dictionary<string, UInt16>();
  25. Dictionary<string, UInt16> Params2 = new Dictionary<string, UInt16>();
  26. Dictionary<string, UInt16> MotorParam = new Dictionary<string, UInt16>();
  27. Dictionary<string, string> Otherinfo = new Dictionary<string, string>();
  28. Dictionary<string, UInt16> TestThData = new Dictionary<string, ushort>();
  29. Dictionary<string, string> MarkInfo = new Dictionary<string, string>();
  30. //文件路径
  31. public string FilePath = "";
  32. public ExportForm()
  33. {
  34. InitializeComponent();
  35. }
  36. private void ExportForm_Load(object sender, EventArgs e)
  37. {
  38. }
  39. private void SetDefault()
  40. {
  41. //参数1
  42. Params1.Clear();
  43. Params1.Add("启动模式", 2);
  44. Params1.Add("停机时间", 100);
  45. Params1.Add("限速值", 25);
  46. Params1.Add("下降速度", 3);
  47. Params1.Add("前飞", 14);
  48. Params1.Add("后飞", 9);
  49. Params1.Add("限流", 15);
  50. Params1.Add("温度预警", 95);
  51. Params1.Add("温度保护", 125);
  52. Params1.Add("码表", 0x55);//有,不支持无码表
  53. Params1.Add("轮胎周长", 219);//cm
  54. Params1.Add("系列号", 0);
  55. Params1.Add("ECO增益", 100);//放大100倍
  56. Params1.Add("ECO加速", 100);
  57. Params1.Add("NORM增益", 100);
  58. Params1.Add("NORM加速", 100);
  59. Params1.Add("SPORT增益", 100);
  60. Params1.Add("SPORT加速", 100);
  61. Params1.Add("TURBO增益", 100);
  62. Params1.Add("TURBO加速", 100);
  63. Params1.Add("SMART增益", 100);
  64. Params1.Add("SMART加速", 100);
  65. Params1.Add("车速级数", 1);
  66. Params1.Add("踏频启动", 2);
  67. Params1.Add("指拨模式", 0x55);
  68. Params1.Add("速度信号来源", 0x55);//传感器
  69. Params1.Add("周长微调", 0);
  70. Params1.Add("低压保护", 3000);//mV
  71. Params1.Add("推行限速", 60);//放大10倍
  72. Params1.Add("推行转速", 135);
  73. //参数2
  74. Params2.Clear();
  75. Params2.Add("姿态传感器", 0x55);//不支持
  76. Params2.Add("俯仰角零偏", 0);
  77. Params2.Add("横滚角零偏", 0);
  78. Params2.Add("尾灯模式", 2);
  79. Params2.Add("前灯电压", 12);
  80. Params2.Add("尾灯电压", 12);
  81. //马达参数
  82. MotorParam.Clear();
  83. MotorParam.Add("额定功率", 250);
  84. MotorParam.Add("额定转速", 1200);
  85. MotorParam.Add("定子电阻", 10);
  86. MotorParam.Add("定子Lq", 10);
  87. MotorParam.Add("定子Ld", 10);
  88. MotorParam.Add("反电动势", 36000);
  89. MotorParam.Add("额定电压", 36);
  90. //其它信息
  91. Otherinfo.Clear();
  92. Otherinfo.Add("生产商", "TTIUM");
  93. Otherinfo.Add("生产地", "WUHAN");
  94. Otherinfo.Add("生产日期", DateTime.Now.ToString("yyyyMMdd"));
  95. Otherinfo.Add("校验密钥", "AVONITOM");
  96. Otherinfo.Add("信息1", "");
  97. Otherinfo.Add("信息2", "");
  98. Otherinfo.Add("信息3", "");
  99. //测试阈值
  100. TestThData.Clear();
  101. TestThData.Add("空载电流", 1000);
  102. TestThData.Add("车速", 150);
  103. TestThData.Add("指拨转速", 1200);
  104. TestThData.Add("零偏最小值", 100);
  105. TestThData.Add("零偏最大值", 1800);
  106. TestThData.Add("标定系数最小值", 25);
  107. TestThData.Add("标定系数最大值", 75);
  108. TestThData.Add("启动值最小值", 350);
  109. TestThData.Add("启动值最大值", 750);
  110. //其它测试备注信息
  111. MarkInfo.Clear();
  112. MarkInfo.Add("PCBA版号", "");
  113. }
  114. private void ParamsDisplayUpdate()
  115. {
  116. //参数1
  117. comboBox_StartMode.SelectedIndex = Params1["启动模式"] - 1;
  118. textBox_StopTime.Text = Params1["停机时间"].ToString();
  119. textBox_SpeedLimit.Text = Params1["限速值"].ToString();
  120. textBox_Dec.Text = Params1["下降速度"].ToString();
  121. textBox_T_Front.Text = Params1["前飞"].ToString();
  122. textBox_T_Tail.Text = Params1["后飞"].ToString();
  123. textBox_MaxCurrent.Text = Params1["限流"].ToString();
  124. textBox_NTC_Alarm.Text = Params1["温度预警"].ToString();
  125. textBox_NTC_Ptotect.Text = Params1["温度保护"].ToString();
  126. if (Params1["码表"] == 0x55)
  127. {
  128. comboBox_NoPBU.SelectedIndex = 1;
  129. }
  130. else if (Params1["码表"] == 0xAA)
  131. {
  132. comboBox_NoPBU.SelectedIndex = 0;
  133. }
  134. textBox_WheelSize.Text = Params1["轮胎周长"].ToString();
  135. textBox_Serial.Text = Params1["系列号"].ToString();
  136. textBox_ECO_Gain.Text = ((float)(Params1["ECO增益"]) / 100.0f).ToString("#0.00");
  137. textBox_ECO_Acc.Text = ((float)(Params1["ECO加速"]) / 100.0f).ToString("#0.00");
  138. textBox_NORM_Gain.Text = ((float)(Params1["NORM增益"]) / 100.0f).ToString("#0.00");
  139. textBox_NORM_Acc.Text = ((float)(Params1["NORM加速"]) / 100.0f).ToString("#0.00");
  140. textBox_SPORT_Gain.Text = ((float)(Params1["SPORT增益"]) / 100.0f).ToString("#0.00");
  141. textBox_SPORT_Acc.Text = ((float)(Params1["SPORT加速"]) / 100.0f).ToString("#0.00");
  142. textBox_TURBO_Gain.Text = ((float)(Params1["TURBO增益"]) / 100.0f).ToString("#0.00");
  143. textBox_TURBO_Acc.Text = ((float)(Params1["TURBO加速"]) / 100.0f).ToString("#0.00");
  144. textBox_SMART_Gain.Text = ((float)(Params1["SMART增益"]) / 100.0f).ToString("#0.00");
  145. textBox_SMART_Acc.Text = ((float)(Params1["SMART加速"]) / 100.0f).ToString("#0.00");
  146. textBox_SpeedSensor.Text = Params1["车速级数"].ToString();
  147. textBox_CadenceStart.Text = Params1["踏频启动"].ToString();
  148. if (Params1["指拨模式"] == 0x55)
  149. {
  150. comboBox_GasMode.SelectedIndex = 0;
  151. }
  152. else if (Params1["指拨模式"] == 0xAA)
  153. {
  154. comboBox_GasMode.SelectedIndex = 1;
  155. }
  156. if (Params1["速度信号来源"] == 0x55)
  157. {
  158. comboBox_SpeedSensor.SelectedIndex = 0;
  159. }
  160. else if (Params1["速度信号来源"] == 0xAA)
  161. {
  162. comboBox_SpeedSensor.SelectedIndex = 1;
  163. }
  164. else if (Params1["速度信号来源"] == 0xEE)
  165. {
  166. comboBox_SpeedSensor.SelectedIndex = 2;
  167. }
  168. textBox_WheelSizeAdj.Text = Params1["周长微调"].ToString();
  169. textBox_UV_Protect.Text = Params1["低压保护"].ToString();
  170. textBox_Walk_SpeedLimit.Text = ((float)(Params1["推行限速"]) / 10.0f).ToString("#0.0");
  171. textBox_WalkSpeed.Text = Params1["推行转速"].ToString();
  172. //参数2
  173. if (Params2["姿态传感器"] == 0x55)
  174. {
  175. comboBox_AstSensor.SelectedIndex = 0;
  176. }
  177. else if (Params1["姿态传感器"] == 0xAA)
  178. {
  179. comboBox_AstSensor.SelectedIndex = 1;
  180. }
  181. textBox_Angle_P.Text = ((float)(Params2["俯仰角零偏"]) / 10.0f).ToString("#0.0");
  182. textBox_Angle_R.Text = ((float)(Params2["横滚角零偏"]) / 10.0f).ToString("#0.0");
  183. comboBox_LightMode.SelectedIndex = Params2["尾灯模式"] - 1;
  184. if (Params2["前灯电压"] == 6)
  185. {
  186. comboBox_HeadLightVol.SelectedIndex = 0;
  187. }
  188. else if (Params2["前灯电压"] == 12)
  189. {
  190. comboBox_HeadLightVol.SelectedIndex = 1;
  191. }
  192. else if (Params2["前灯电压"] == 0xFF)
  193. {
  194. comboBox_HeadLightVol.SelectedIndex = 2;
  195. }
  196. else if (Params2["前灯电压"] == 0)
  197. {
  198. comboBox_HeadLightVol.SelectedIndex = 3;
  199. }
  200. if (Params2["尾灯电压"] == 6)
  201. {
  202. comboBox_TailLightVol.SelectedIndex = 0;
  203. }
  204. else if (Params2["尾灯电压"] == 12)
  205. {
  206. comboBox_TailLightVol.SelectedIndex = 1;
  207. }
  208. else if (Params2["尾灯电压"] == 0xFF)
  209. {
  210. comboBox_TailLightVol.SelectedIndex = 2;
  211. }
  212. else if (Params2["尾灯电压"] == 0)
  213. {
  214. comboBox_TailLightVol.SelectedIndex = 3;
  215. }
  216. //马达参数
  217. textBox_RatePower.Text = MotorParam["额定功率"].ToString();
  218. textBox_RateSpeed.Text = MotorParam["额定转速"].ToString();
  219. textBox_RotorR.Text = MotorParam["定子电阻"].ToString();
  220. textBox_Rotor_Lq.Text = MotorParam["定子Lq"].ToString();
  221. textBox_Rotor_Ld.Text = MotorParam["定子Ld"].ToString();
  222. textBox_E.Text = MotorParam["反电动势"].ToString();
  223. textBox_Rate_Vol.Text = MotorParam["额定电压"].ToString();
  224. //其它信息
  225. textBox_Mac.Text = Otherinfo["生产商"].ToString();
  226. textBox_Mac_Addr.Text = Otherinfo["生产地"].ToString();
  227. textBox_Mac_Date.Text = Otherinfo["生产日期"].ToString();
  228. textBox_Secrect.Text = Otherinfo["校验密钥"].ToString();
  229. textBox_Info1.Text = Otherinfo["信息1"].ToString();
  230. textBox_Info2.Text = Otherinfo["信息2"].ToString();
  231. textBox_Info3.Text = Otherinfo["信息3"].ToString();
  232. //测试阈值
  233. textBox_NC_Current.Text = TestThData["空载电流"].ToString();
  234. textBox_SpeedTh.Text = TestThData["车速"].ToString();
  235. textBox_GasSpeedTh.Text = TestThData["指拨转速"].ToString();
  236. textBox_Zero_Min.Text = TestThData["零偏最小值"].ToString();
  237. textBox_Zero_Max.Text = TestThData["零偏最大值"].ToString();
  238. textBox_K_Min.Text = ((float)(TestThData["标定系数最小值"]) / 100.0f).ToString("#0.00");
  239. textBox_K_Max.Text = ((float)(TestThData["标定系数最大值"]) / 100.0f).ToString("#0.00");
  240. textBox_Start_Min.Text = TestThData["启动值最小值"].ToString();
  241. textBox_Start_Max.Text = TestThData["启动值最大值"].ToString();
  242. //其它测试备注信息
  243. textBox_HW_Version.Text = MarkInfo["PCBA版号"];
  244. }
  245. private bool DisplaySetToParams()
  246. {
  247. try
  248. {
  249. //参数1
  250. Params1.Clear();
  251. if (comboBox_StartMode.Text == "柔和")
  252. {
  253. Params1.Add("启动模式", 1);
  254. }
  255. else if (comboBox_StartMode.Text == "正常")
  256. {
  257. Params1.Add("启动模式", 2);
  258. }
  259. else if (comboBox_StartMode.Text == "强劲")
  260. {
  261. Params1.Add("启动模式", 3);
  262. }
  263. else
  264. {
  265. MessageBox.Show("请检查启动模式设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  266. return false;
  267. }
  268. Params1.Add("停机时间", Convert.ToUInt16(textBox_StopTime.Text));
  269. if (Params1["停机时间"] < 50 || Params1["停机时间"] > 500)
  270. {
  271. MessageBox.Show("停机时间有效值:50~500 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  272. return false;
  273. }
  274. Params1.Add("限速值", Convert.ToUInt16(textBox_SpeedLimit.Text));
  275. if (Params1["限速值"] < 5 || Params1["限速值"] > 120)
  276. {
  277. MessageBox.Show("限速值有效值:5~120 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  278. return false;
  279. }
  280. Params1.Add("下降速度", Convert.ToUInt16(textBox_Dec.Text));
  281. if (Params1["下降速度"] < 1 || Params1["下降速度"] > 5)
  282. {
  283. MessageBox.Show("下降速度有效值:1~5 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  284. return false;
  285. }
  286. Params1.Add("前飞", Convert.ToUInt16(textBox_T_Front.Text));
  287. if (Params1["前飞"] < 5 || Params1["前飞"] > 100)
  288. {
  289. MessageBox.Show("前飞有效值:5~100 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  290. return false;
  291. }
  292. Params1.Add("后飞", Convert.ToUInt16(textBox_T_Tail.Text));
  293. if (Params1["后飞"] < 5 || Params1["后飞"] > 100)
  294. {
  295. MessageBox.Show("后飞有效值:5~100 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  296. return false;
  297. }
  298. Params1.Add("限流", Convert.ToUInt16(textBox_MaxCurrent.Text));
  299. if (Params1["限流"] < 5 || Params1["限流"] > 25)
  300. {
  301. MessageBox.Show("限流有效值:5~25 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  302. return false;
  303. }
  304. Params1.Add("温度预警", Convert.ToUInt16(textBox_NTC_Alarm.Text));
  305. Params1.Add("温度保护", Convert.ToUInt16(textBox_NTC_Ptotect.Text));
  306. if (comboBox_NoPBU.Text == "有")
  307. {
  308. Params1.Add("码表", 0x55);
  309. }
  310. else if (comboBox_NoPBU.Text == "无")
  311. {
  312. Params1.Add("码表", 0xAA);
  313. }
  314. else
  315. {
  316. MessageBox.Show("请检查无码表设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  317. return false;
  318. }
  319. Params1.Add("轮胎周长", Convert.ToUInt16(textBox_WheelSize.Text));
  320. if (Params1["轮胎周长"] < 80 || Params1["轮胎周长"] > 250)
  321. {
  322. MessageBox.Show("轮胎周长有效值:80~250 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  323. return false;
  324. }
  325. Params1.Add("系列号", Convert.ToUInt16(textBox_Serial.Text));
  326. if (Params1["系列号"] < 1 || Params1["系列号"] > 16)
  327. {
  328. MessageBox.Show("系列号有效值:1~16 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  329. return false;
  330. }
  331. Params1.Add("ECO增益", Convert.ToUInt16(float.Parse(textBox_ECO_Gain.Text) * 100));//放大100倍
  332. Params1.Add("ECO加速", Convert.ToUInt16(float.Parse(textBox_ECO_Acc.Text) * 100));
  333. Params1.Add("NORM增益", Convert.ToUInt16(float.Parse(textBox_NORM_Gain.Text) * 100));
  334. Params1.Add("NORM加速", Convert.ToUInt16(float.Parse(textBox_NORM_Acc.Text) * 100));
  335. Params1.Add("SPORT增益", Convert.ToUInt16(float.Parse(textBox_SPORT_Gain.Text) * 100));
  336. Params1.Add("SPORT加速", Convert.ToUInt16(float.Parse(textBox_SPORT_Acc.Text) * 100));
  337. Params1.Add("TURBO增益", Convert.ToUInt16(float.Parse(textBox_TURBO_Gain.Text) * 100));
  338. Params1.Add("TURBO加速", Convert.ToUInt16(float.Parse(textBox_TURBO_Acc.Text) * 100));
  339. Params1.Add("SMART增益", Convert.ToUInt16(float.Parse(textBox_SMART_Gain.Text) * 100));
  340. Params1.Add("SMART加速", Convert.ToUInt16(float.Parse(textBox_SMART_Acc.Text) * 100));
  341. Params1.Add("车速级数", Convert.ToUInt16(textBox_SpeedSensor.Text));
  342. Params1.Add("踏频启动", Convert.ToUInt16(textBox_CadenceStart.Text));
  343. if (comboBox_GasMode.Text == "不支持")
  344. {
  345. Params1.Add("指拨模式", 0x55);
  346. }
  347. else if (comboBox_GasMode.Text == "支持")
  348. {
  349. Params1.Add("指拨模式", 0xAA);
  350. }
  351. else
  352. {
  353. MessageBox.Show("请检查指拨模式设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  354. return false;
  355. }
  356. if (comboBox_SpeedSensor.Text == "传感器")
  357. {
  358. Params1.Add("速度信号来源", 0x55);
  359. }
  360. else if (comboBox_SpeedSensor.Text == "踏频")
  361. {
  362. Params1.Add("速度信号来源", 0xAA);
  363. }
  364. else if (comboBox_SpeedSensor.Text == "通信")
  365. {
  366. Params1.Add("速度信号来源", 0xEE);
  367. }
  368. else
  369. {
  370. MessageBox.Show("请检查速度信号来源设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  371. return false;
  372. }
  373. Params1.Add("周长微调", Convert.ToUInt16(textBox_WheelSizeAdj.Text));
  374. Params1.Add("低压保护", Convert.ToUInt16(textBox_UV_Protect.Text));//mV
  375. Params1.Add("推行限速", Convert.ToUInt16(float.Parse(textBox_Walk_SpeedLimit.Text) * 10));//放大10倍
  376. Params1.Add("推行转速", Convert.ToUInt16(textBox_WalkSpeed.Text));
  377. //参数2
  378. Params2.Clear();
  379. if (comboBox_AstSensor.Text == "不支持")
  380. {
  381. Params2.Add("姿态传感器", 0x55);
  382. }
  383. else if (comboBox_AstSensor.Text == "支持")
  384. {
  385. Params2.Add("姿态传感器", 0xAA);
  386. }
  387. else
  388. {
  389. MessageBox.Show("请检查姿态传感器设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  390. return false;
  391. }
  392. Params2.Add("俯仰角零偏", Convert.ToUInt16(float.Parse(textBox_Angle_P.Text) * 10));
  393. Params2.Add("横滚角零偏", Convert.ToUInt16(float.Parse(textBox_Angle_R.Text) * 10));
  394. if (comboBox_LightMode.Text == "模式 1")
  395. {
  396. Params2.Add("尾灯模式", 1);
  397. }
  398. else if(comboBox_LightMode.Text == "模式 2")
  399. {
  400. Params2.Add("尾灯模式", 2);
  401. }
  402. else if (comboBox_LightMode.Text == "模式 3")
  403. {
  404. Params2.Add("尾灯模式", 3);
  405. }
  406. else if (comboBox_LightMode.Text == "模式 4")
  407. {
  408. Params2.Add("尾灯模式", 4);
  409. }
  410. if (comboBox_HeadLightVol.Text == "6V")
  411. {
  412. Params2.Add("前灯电压", 6);
  413. }
  414. else if (comboBox_HeadLightVol.Text == "12V")
  415. {
  416. Params2.Add("前灯电压", 12);
  417. }
  418. else if (comboBox_HeadLightVol.Text == "随电池")
  419. {
  420. Params2.Add("前灯电压", 0xFF);
  421. }
  422. else if (comboBox_HeadLightVol.Text == "硬件配置")
  423. {
  424. Params2.Add("前灯电压", 0);
  425. }
  426. if (comboBox_TailLightVol.Text == "6V")
  427. {
  428. Params2.Add("尾灯电压", 6);
  429. }
  430. else if (comboBox_TailLightVol.Text == "12V")
  431. {
  432. Params2.Add("尾灯电压", 12);
  433. }
  434. else if (comboBox_TailLightVol.Text == "随电池")
  435. {
  436. Params2.Add("尾灯电压", 0xFF);
  437. }
  438. else if (comboBox_TailLightVol.Text == "硬件配置")
  439. {
  440. Params2.Add("尾灯电压", 0);
  441. }
  442. //马达参数
  443. MotorParam.Clear();
  444. MotorParam.Add("额定功率", Convert.ToUInt16(textBox_RatePower.Text));
  445. MotorParam.Add("额定转速", Convert.ToUInt16(textBox_RateSpeed.Text));
  446. MotorParam.Add("定子电阻", Convert.ToUInt16(textBox_RotorR.Text));
  447. MotorParam.Add("定子Lq", Convert.ToUInt16(textBox_Rotor_Lq.Text));
  448. MotorParam.Add("定子Ld", Convert.ToUInt16(textBox_Rotor_Ld.Text));
  449. MotorParam.Add("反电动势", Convert.ToUInt16(textBox_E.Text));
  450. MotorParam.Add("额定电压", Convert.ToUInt16(textBox_Rate_Vol.Text));
  451. //其它信息
  452. Otherinfo.Clear();
  453. Otherinfo.Add("生产商", textBox_Mac.Text);
  454. Otherinfo.Add("生产地", textBox_Mac_Addr.Text);
  455. Otherinfo.Add("生产日期", textBox_Mac_Date.Text);
  456. Otherinfo.Add("校验密钥", textBox_Secrect.Text);
  457. Otherinfo.Add("信息1", textBox_Info1.Text);
  458. Otherinfo.Add("信息2", textBox_Info2.Text);
  459. Otherinfo.Add("信息3", textBox_Info3.Text);
  460. //测试阈值
  461. TestThData.Clear();
  462. TestThData.Add("空载电流", Convert.ToUInt16(textBox_NC_Current.Text));
  463. TestThData.Add("车速", Convert.ToUInt16(textBox_SpeedTh.Text));
  464. TestThData.Add("指拨转速", Convert.ToUInt16(textBox_GasSpeedTh.Text));
  465. TestThData.Add("零偏最小值", Convert.ToUInt16(textBox_Zero_Min.Text));
  466. TestThData.Add("零偏最大值", Convert.ToUInt16(textBox_Zero_Max.Text));
  467. TestThData.Add("标定系数最小值", Convert.ToUInt16(float.Parse(textBox_K_Min.Text) * 100));
  468. TestThData.Add("标定系数最大值", Convert.ToUInt16(float.Parse(textBox_K_Max.Text) * 100));
  469. TestThData.Add("启动值最小值", Convert.ToUInt16(textBox_Start_Min.Text));
  470. TestThData.Add("启动值最大值", Convert.ToUInt16(textBox_Start_Max.Text));
  471. //其它测试备注信息
  472. MarkInfo.Clear();
  473. if (textBox_HW_Version.Text == string.Empty)
  474. {
  475. MessageBox.Show("请输入PCBA版号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  476. return false;
  477. }
  478. else
  479. {
  480. MarkInfo.Add("PCBA版号", textBox_HW_Version.Text);
  481. }
  482. return true;
  483. }
  484. catch(Exception ex)
  485. {
  486. MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  487. return false;
  488. }
  489. }
  490. private void button_Default_Click(object sender, EventArgs e)
  491. {
  492. if (MessageBox.Show("确认恢复默认值?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
  493. {
  494. return;
  495. }
  496. SetDefault();
  497. ParamsDisplayUpdate();
  498. }
  499. private void button_Generate_Click(object sender, EventArgs e)
  500. {
  501. if (MessageBox.Show("确认提交?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
  502. {
  503. return;
  504. }
  505. //空间内容更新到字典
  506. if (DisplaySetToParams() == false)
  507. {
  508. MessageBox.Show("参数生成失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  509. return;
  510. }
  511. //保存为配置文件
  512. if (textBox_Model.Text == string.Empty) //判断型号是否填写
  513. {
  514. MessageBox.Show("请输入电机型号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  515. return;
  516. }
  517. if (textBox_Client.Text == string.Empty) //判断订单编号是否填写
  518. {
  519. MessageBox.Show("请输入订单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  520. return;
  521. }
  522. if (textBox_HW_Version.Text == String.Empty) //判断PCBA板号是否填写
  523. {
  524. MessageBox.Show("请输入PCBA板号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  525. return;
  526. }
  527. if (comboBox_Baudrate.SelectedIndex == -1)
  528. {
  529. MessageBox.Show("请设定波特率!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  530. return;
  531. }
  532. Regex Reg = new Regex(@"[V][0-9].[0-9]|[0-9][0-9].[0-9]|[0-9][0-9].[0-9]|[0-9][0-9].[0-9]|[0-9][0-9]_20\d{6}");
  533. if (Reg.IsMatch(textBox_FW_Version.Text) == false) //判断主控软件版本是否填写
  534. {
  535. MessageBox.Show("主控软件版本格式不正确,例如V1.0.0.0.0_20210101 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  536. return;
  537. }
  538. if (textBox_TE_FW_Version.Text != "N_A")//兼容单MCU主控板,无TE时填写N_A
  539. {
  540. Reg = new Regex(@"[V][0-9].[0-9].[0-9]_20\d{6}"); //判断TE软件版本是否填写
  541. if (Reg.IsMatch(textBox_TE_FW_Version.Text) == false) //判断TE软件版本是否填写
  542. {
  543. MessageBox.Show("TE软件版本格式不正确,例如N_A或V1.0.0_20210101 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  544. return;
  545. }
  546. }
  547. button_Generate.BackColor = Color.Red;
  548. button_Generate.Text = "生成中";
  549. button_Generate.Enabled = false;
  550. if (System.IO.Directory.Exists(FilePath) == false)
  551. System.IO.Directory.CreateDirectory(FilePath);
  552. string Datenow = DateTime.Now.ToString("yyyy-MM-dd") + "\\";
  553. if (System.IO.Directory.Exists(FilePath + Datenow) == false)
  554. System.IO.Directory.CreateDirectory(FilePath + Datenow);
  555. string fileName = FilePath + Datenow + textBox_Model.Text + "_" + textBox_Client.Text + "_" + textBox_FW_Version.Text + "_" + textBox_TE_FW_Version.Text + "_" + ((textBox_Remark.Text == string.Empty) ? "" : textBox_Remark.Text + "_") + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".ttcfg";
  556. using (StreamWriter file = new StreamWriter(fileName))
  557. {
  558. //用户参数1
  559. file.WriteLine("[{0}]", "用户参数1");
  560. foreach (var entry in Params1)
  561. if (entry.Key == "码表")
  562. file.WriteLine("{0},{1},{2}", entry.Key, entry.Value, entry.Value == 0x55 ? "有" : entry.Value == 0xAA ? "无" : "无效");
  563. else if (entry.Key == "指拨模式")
  564. file.WriteLine("{0},{1},{2}", entry.Key, entry.Value, entry.Value == 0x55 ? "不支持" : entry.Value == 0xAA ? "支持" : "无效");
  565. else if (entry.Key == "速度信号来源")
  566. file.WriteLine("{0},{1},{2}", entry.Key, entry.Value, entry.Value == 0x55 ? "传感器" : entry.Value == 0xAA ? "踏频" : entry.Value == 0xEE ? "通信" : "无效");
  567. else
  568. file.WriteLine("{0},{1}", entry.Key, entry.Value);
  569. //用户参数2
  570. file.WriteLine("");
  571. file.WriteLine("[{0}]", "用户参数2");
  572. foreach (var entry in Params2)
  573. if (entry.Key == "姿态传感器")
  574. file.WriteLine("{0},{1},{2}", entry.Key, entry.Value, entry.Value == 0x55 ? "不支持" : entry.Value == 0xAA ? "支持" : "无效");
  575. else if (entry.Key == "前灯电压")
  576. file.WriteLine("{0},{1},{2}", entry.Key, entry.Value, entry.Value == 0xFF ? "随电池" : entry.Value == 0 ? "硬件配置" : entry.Value + "V");
  577. else if (entry.Key == "尾灯电压")
  578. file.WriteLine("{0},{1},{2}", entry.Key, entry.Value, entry.Value == 0xFF ? "随电池" : entry.Value == 0 ? "硬件配置" : entry.Value + "V");
  579. else
  580. file.WriteLine("{0},{1}", entry.Key, entry.Value);
  581. //马达参数
  582. file.WriteLine("");
  583. file.WriteLine("[{0}]", "马达参数");
  584. foreach (var entry in MotorParam)
  585. file.WriteLine("{0},{1}", entry.Key, entry.Value);
  586. //其它信息
  587. file.WriteLine("");
  588. file.WriteLine("[{0}]", "其它信息");
  589. foreach (var entry in Otherinfo)
  590. file.WriteLine("{0},{1}", entry.Key, entry.Value);
  591. //测试阈值
  592. file.WriteLine("");
  593. file.WriteLine("[{0}]", "测试阈值");
  594. foreach (var entry in TestThData)
  595. file.WriteLine("{0},{1}", entry.Key, entry.Value);
  596. //其它测试备注信息
  597. file.WriteLine("");
  598. file.WriteLine("[{0}]", "其它测试备注信息");
  599. foreach (var entry in MarkInfo)
  600. file.WriteLine("{0},{1}", entry.Key, entry.Value);
  601. }
  602. button_Generate.Text = "转换中";
  603. //保存为Excel文件
  604. string importExcelName = "FOQC成机参数检验标准_Temple.xls";
  605. string exportExcelName = FilePath + Datenow + textBox_Model.Text + "_" + textBox_Client.Text + "_" + ((textBox_Remark.Text == string.Empty) ? "" : textBox_Remark.Text + "_") + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".xls";
  606. try
  607. {
  608. //导入文件
  609. IWorkbook workbook = WorkbookFactory.Create(importExcelName);
  610. //获取第一个工作薄
  611. ISheet sheet = workbook.GetSheetAt(0);
  612. #region 开始按行写入单元格
  613. //第3行,文件信息
  614. IRow row = sheet.GetRow(2);
  615. row.GetCell(0).SetCellValue("文件信息:" + textBox_Model.Text + "_" + textBox_Client.Text + "_" + ((textBox_Remark.Text == string.Empty) ? "" : textBox_Remark.Text + "_") + DateTime.Now.ToString("yyyy-MM-dd-HHmmss"));
  616. //第5行,第2列型号,第10列SPORT加速
  617. row = sheet.GetRow(4);
  618. row.GetCell(1).SetCellValue(textBox_Model.Text);
  619. row.GetCell(9).SetCellValue(textBox_SPORT_Acc.Text);
  620. //第6行,第2列SN,第10列TURBO增益
  621. row = sheet.GetRow(5);
  622. row.GetCell(1).SetCellValue("与打标一致");
  623. row.GetCell(9).SetCellValue(textBox_TURBO_Gain.Text);
  624. //第7行,第2列硬件板号,第10列TURBO加速
  625. row = sheet.GetRow(6);
  626. row.GetCell(1).SetCellValue(textBox_HW_Version.Text);
  627. row.GetCell(9).SetCellValue(textBox_TURBO_Acc.Text);
  628. //第8行,第2列主控软件版本,第10列SMART增益
  629. row = sheet.GetRow(7);
  630. row.GetCell(1).SetCellValue(textBox_FW_Version.Text);
  631. row.GetCell(9).SetCellValue(textBox_SMART_Gain.Text);
  632. //第9行,第2列TE软件版本,第10列SMART加速
  633. row = sheet.GetRow(8);
  634. row.GetCell(1).SetCellValue(textBox_TE_FW_Version.Text);
  635. row.GetCell(9).SetCellValue(textBox_SMART_Acc.Text);
  636. //第10行,第2列BOOT版本,第10列额定功率
  637. row = sheet.GetRow(9);
  638. row.GetCell(1).SetCellValue(comboBox_Baudrate.SelectedIndex == 0 ? "V1.2.2 125K" : "V2.0.0 250K");
  639. row.GetCell(9).SetCellValue(textBox_RatePower.Text + " W");
  640. //第11行,第2列静态电压,第10列额定转速
  641. row = sheet.GetRow(10);
  642. row.GetCell(1).SetCellValue(textBox_Rate_Vol.Text + " ± 1 V");
  643. row.GetCell(9).SetCellValue(textBox_RateSpeed.Text + " rpm");
  644. //第12行,第2列静态电流,第10列额定电压
  645. row = sheet.GetRow(11);
  646. row.GetCell(1).SetCellValue("≤ 0.050 A");
  647. row.GetCell(9).SetCellValue(textBox_Rate_Vol.Text + " V");
  648. //第13行,第2列指拨模式,第10列速度信号个数
  649. row = sheet.GetRow(12);
  650. row.GetCell(1).SetCellValue(comboBox_GasMode.Text);
  651. row.GetCell(9).SetCellValue(textBox_SpeedSensor.Text);
  652. //第14行,第2列启动模式,第10列踏频启动信号个数
  653. row = sheet.GetRow(13);
  654. row.GetCell(1).SetCellValue(comboBox_StartMode.Text);
  655. row.GetCell(9).SetCellValue(textBox_CadenceStart.Text);
  656. //第15行,第2列停机时间,第10列车速信号来源
  657. row = sheet.GetRow(14);
  658. row.GetCell(1).SetCellValue(textBox_StopTime.Text + " ms");
  659. row.GetCell(9).SetCellValue(comboBox_SpeedSensor.Text);
  660. //第16行,第2列限速,第10列轮胎周长微调
  661. row = sheet.GetRow(15);
  662. row.GetCell(1).SetCellValue(textBox_SpeedLimit.Text + " km/h");
  663. row.GetCell(9).SetCellValue(textBox_WheelSizeAdj.Text + " cm");
  664. //第17行,第2列下降速度,第10列推行转速
  665. row = sheet.GetRow(16);
  666. row.GetCell(1).SetCellValue(textBox_Dec.Text + " 级");
  667. row.GetCell(9).SetCellValue(textBox_WalkSpeed.Text + " rpm");
  668. //第18行,第2列前齿,第10列俯仰角零偏
  669. row = sheet.GetRow(17);
  670. row.GetCell(1).SetCellValue(textBox_T_Front.Text + " T");
  671. row.GetCell(9).SetCellValue(textBox_Angle_P.Text + " 度");
  672. //第19行,第2列后齿,第10列横滚角零偏
  673. row = sheet.GetRow(18);
  674. row.GetCell(1).SetCellValue(textBox_T_Tail.Text + " T");
  675. row.GetCell(9).SetCellValue(textBox_Angle_R.Text + " 度");
  676. //第20行,第2列限流,第10列姿态传感器
  677. row = sheet.GetRow(19);
  678. row.GetCell(1).SetCellValue(textBox_MaxCurrent.Text + " A");
  679. row.GetCell(9).SetCellValue(comboBox_AstSensor.Text);
  680. //第21行,第2列温度预警,第10列尾灯模式
  681. row = sheet.GetRow(20);
  682. row.GetCell(1).SetCellValue(textBox_NTC_Alarm.Text + " ℃");
  683. row.GetCell(9).SetCellValue(comboBox_LightMode.Text);
  684. //第22行,第2列温度保护,第10列前灯电压
  685. row = sheet.GetRow(21);
  686. row.GetCell(1).SetCellValue(textBox_NTC_Ptotect.Text + " ℃");
  687. row.GetCell(9).SetCellValue(comboBox_HeadLightVol.Text.Contains("随电池") ? comboBox_HeadLightVol.Text + " " + textBox_Rate_Vol.Text + " V" : comboBox_HeadLightVol.Text);
  688. //第23行,第2列码表,第10列后灯电压
  689. row = sheet.GetRow(22);
  690. row.GetCell(1).SetCellValue(comboBox_NoPBU.Text);
  691. row.GetCell(9).SetCellValue(comboBox_TailLightVol.Text.Contains("随电池") ? comboBox_TailLightVol.Text + " " + textBox_Rate_Vol.Text + " V" : comboBox_TailLightVol.Text);
  692. //第24行,第2列轮胎周长,第10列启动值
  693. row = sheet.GetRow(23);
  694. row.GetCell(1).SetCellValue(textBox_WheelSize.Text + " cm");
  695. row.GetCell(9).SetCellValue(textBox_Start_Min.Text + " - " + textBox_Start_Max.Text);
  696. //第25行,第2列电机系列,第10列校正系数1
  697. row = sheet.GetRow(24);
  698. row.GetCell(1).SetCellValue(textBox_Serial.Text);
  699. row.GetCell(9).SetCellValue(textBox_K_Min.Text + " - " + textBox_K_Max.Text);
  700. //第26行,第2列低压保护,第10列校正系数2
  701. row = sheet.GetRow(25);
  702. row.GetCell(1).SetCellValue(textBox_UV_Protect.Text + " mV");
  703. if ((textBox_Model.Text.Contains("PG")) || (textBox_Model.Text.Contains("PS")) || (textBox_Model.Text.Contains("J01")))
  704. row.GetCell(9).SetCellValue(textBox_K_Min.Text + " - " + textBox_K_Max.Text);
  705. else
  706. row.GetCell(9).SetCellValue("无此项目");
  707. //第27行,第2列推行限速,第10列校正系数3
  708. row = sheet.GetRow(26);
  709. row.GetCell(1).SetCellValue(textBox_Walk_SpeedLimit.Text + " km/h");
  710. if ((textBox_Model.Text.Contains("PG")) || (textBox_Model.Text.Contains("PS")) || (textBox_Model.Text.Contains("J01")))
  711. row.GetCell(9).SetCellValue(textBox_K_Min.Text + " - " + textBox_K_Max.Text);
  712. else
  713. row.GetCell(9).SetCellValue("无此项目");
  714. //第28行,第2列ECO增益,第10列零点值1
  715. row = sheet.GetRow(27);
  716. row.GetCell(1).SetCellValue(textBox_ECO_Gain.Text);
  717. row.GetCell(9).SetCellValue(textBox_Zero_Min.Text + " - " + textBox_Zero_Max.Text);
  718. //第29行,第2列ECO加速,第10列零点值2
  719. row = sheet.GetRow(28);
  720. row.GetCell(1).SetCellValue(textBox_ECO_Acc.Text);
  721. if ((textBox_Model.Text.Contains("PG")) || (textBox_Model.Text.Contains("PS")) || (textBox_Model.Text.Contains("J01")))
  722. row.GetCell(9).SetCellValue(textBox_Zero_Min.Text + " - " + textBox_Zero_Max.Text);
  723. else
  724. row.GetCell(9).SetCellValue("无此项目");
  725. //第30行,第2列NORM增益,第10列零点值3
  726. row = sheet.GetRow(29);
  727. row.GetCell(1).SetCellValue(textBox_NORM_Gain.Text);
  728. if ((textBox_Model.Text.Contains("PG")) || (textBox_Model.Text.Contains("PS")) || (textBox_Model.Text.Contains("J01")))
  729. row.GetCell(9).SetCellValue(textBox_Zero_Min.Text + " - " + textBox_Zero_Max.Text);
  730. else
  731. row.GetCell(9).SetCellValue("无此项目");
  732. //第31行,第2列NORM加速,第10列骑行历史
  733. row = sheet.GetRow(30);
  734. row.GetCell(1).SetCellValue(textBox_NORM_Acc.Text);
  735. row.GetCell(9).SetCellValue("0 km / 0 min");
  736. //第32行,第2列SPORT增益,第10列骑行历史
  737. row = sheet.GetRow(31);
  738. row.GetCell(1).SetCellValue(textBox_SPORT_Gain.Text);
  739. row.GetCell(9).SetCellValue("无故障记录");
  740. #endregion
  741. using (FileStream file = File.OpenWrite(exportExcelName))
  742. {
  743. workbook.Write(file);
  744. workbook.Close();
  745. }
  746. }
  747. catch (Exception ex)
  748. {
  749. throw (ex);
  750. }
  751. //文件转换为pdf格式保存
  752. string exportPdfName = FilePath + Datenow + textBox_Model.Text + "_" + textBox_Client.Text + "_" + ((textBox_Remark.Text == string.Empty) ? "" : textBox_Remark.Text + "_") + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".pdf";
  753. Workbook workbook_1 = new Workbook();//创建Workbook类的实例
  754. workbook_1.LoadFromFile(exportExcelName);//加载Excel工作簿
  755. workbook_1.SaveToFile(exportPdfName, FileFormat.PDF);//将整个工作薄保存为PDF
  756. MessageBox.Show("参数已生成,进入文件管理页面查看!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  757. button_Generate.Text = "上传中";
  758. //发送文件到服务器
  759. if (StartForm.myFtp.IsNetConnected == true)
  760. {
  761. string DateNow = DateTime.Now.ToString("yyyy-MM-dd");
  762. int okCnt = 0;
  763. if (StartForm.myFtp.DirectoryExist(StartForm.myServerCfg.RootPath + "/cfg/", DateNow) == false)
  764. {
  765. StartForm.myFtp.MakeDir(StartForm.myServerCfg.RootPath + "/cfg/" + DateNow);
  766. }
  767. //上传配置文件
  768. bool result = StartForm.myFtp.UploadFile(fileName, StartForm.myServerCfg.RootPath + "/cfg/" + DateNow);
  769. if (result == true)
  770. {
  771. okCnt++;
  772. //MessageBox.Show("配置文件上传服务器成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  773. }
  774. //上传配置清单excel
  775. result = StartForm.myFtp.UploadFile(exportExcelName, StartForm.myServerCfg.RootPath + "/cfg/" + DateNow);
  776. if (result == true)
  777. {
  778. okCnt++;
  779. //MessageBox.Show("配置检验清单上传服务器成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  780. }
  781. //上传配置清单pdf
  782. result = StartForm.myFtp.UploadFile(exportPdfName, StartForm.myServerCfg.RootPath + "/cfg/" + DateNow);
  783. if (result == true)
  784. {
  785. okCnt++;
  786. //MessageBox.Show("配置检验清单上传服务器成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  787. }
  788. if (okCnt >= 3)
  789. {
  790. MessageBox.Show("配置检验文件上传服务器成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  791. }
  792. else
  793. {
  794. MessageBox.Show("配置检验文件上传服务器失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  795. }
  796. }
  797. button_Generate.Text = "生成";
  798. button_Generate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
  799. button_Generate.Enabled = true;
  800. }
  801. private void button_keyboard_Click(object sender, EventArgs e)
  802. {
  803. System.Diagnostics.Process.Start("osk.exe");
  804. }
  805. //输入型号时自动更新关键参数
  806. private void textBox_Model_TextChanged(object sender, EventArgs e)
  807. {
  808. if (textBox_Model.Text.Contains("J01"))
  809. {
  810. textBox_Serial.Text = "1";//系列号
  811. textBox_MaxCurrent.Text = "13";//限流
  812. textBox_RatePower.Text = "250";//额定功率
  813. textBox_RateSpeed.Text = "1200";//额定转速
  814. textBox_Rate_Vol.Text = "36";//额定电压
  815. textBox_NC_Current.Text = "1000";//空载电流
  816. textBox_GasSpeedTh.Text = "1000";//指拨转速
  817. textBox_Zero_Min.Text = "100";//零偏下限
  818. textBox_Zero_Max.Text = "2000";//零偏上限
  819. textBox_K_Min.Text = "0.40";//传感器标定值下限
  820. textBox_K_Max.Text = "1.20";//传感器标定值下限
  821. textBox_Start_Min.Text = "350";//启动值下限
  822. textBox_Start_Max.Text = "750";//启动值上限
  823. }
  824. else if (textBox_Model.Text.Contains("VL"))
  825. {
  826. textBox_Serial.Text = "1";//系列号
  827. textBox_MaxCurrent.Text = "13";//限流
  828. textBox_RatePower.Text = "250";//额定功率
  829. textBox_RateSpeed.Text = "1200";//额定转速
  830. textBox_Rate_Vol.Text = "36";//额定电压
  831. textBox_NC_Current.Text = "1000";//空载电流
  832. textBox_GasSpeedTh.Text = "1000";//指拨转速
  833. textBox_Zero_Min.Text = "200";//零偏下限
  834. textBox_Zero_Max.Text = "1800";//零偏上限
  835. textBox_K_Min.Text = "0.25";//传感器标定值下限
  836. textBox_K_Max.Text = "0.75";//传感器标定值下限
  837. textBox_Start_Min.Text = "350";//启动值下限
  838. textBox_Start_Max.Text = "750";//启动值上限
  839. }
  840. else if (textBox_Model.Text.Contains("VS"))
  841. {
  842. textBox_Serial.Text = "2";//系列号
  843. textBox_MaxCurrent.Text = "15";//限流
  844. textBox_RatePower.Text = "250";//额定功率
  845. textBox_RateSpeed.Text = "1200";//额定转速
  846. textBox_Rate_Vol.Text = "36";//额定电压
  847. textBox_NC_Current.Text = "1000";//空载电流
  848. textBox_GasSpeedTh.Text = "1000";//指拨转速
  849. textBox_Zero_Min.Text = "200";//零偏下限
  850. textBox_Zero_Max.Text = "1800";//零偏上限
  851. textBox_K_Min.Text = "0.25";//传感器标定值下限
  852. textBox_K_Max.Text = "0.75";//传感器标定值下限
  853. textBox_Start_Min.Text = "350";//启动值下限
  854. textBox_Start_Max.Text = "750";//启动值上限
  855. }
  856. else if (textBox_Model.Text.Contains("VR"))
  857. {
  858. textBox_Serial.Text = "2";//系列号
  859. textBox_MaxCurrent.Text = "15";//限流
  860. textBox_RatePower.Text = "250";//额定功率
  861. textBox_RateSpeed.Text = "1200";//额定转速
  862. textBox_Rate_Vol.Text = "36";//额定电压
  863. textBox_NC_Current.Text = "1000";//空载电流
  864. textBox_GasSpeedTh.Text = "1000";//指拨转速
  865. textBox_Zero_Min.Text = "200";//零偏下限
  866. textBox_Zero_Max.Text = "1800";//零偏上限
  867. textBox_K_Min.Text = "0.25";//传感器标定值下限
  868. textBox_K_Max.Text = "0.75";//传感器标定值下限
  869. textBox_Start_Min.Text = "350";//启动值下限
  870. textBox_Start_Max.Text = "750";//启动值上限
  871. }
  872. else if (textBox_Model.Text.Contains("PG"))
  873. {
  874. textBox_Serial.Text = "3";//系列号
  875. textBox_MaxCurrent.Text = "17";//限流
  876. textBox_RatePower.Text = "250";//额定功率
  877. textBox_RateSpeed.Text = "1600";//额定转速
  878. textBox_Rate_Vol.Text = "36";//额定电压
  879. textBox_NC_Current.Text = "1000";//空载电流
  880. textBox_GasSpeedTh.Text = "1000";//指拨转速
  881. textBox_Zero_Min.Text = "100";//零偏下限
  882. textBox_Zero_Max.Text = "2000";//零偏上限
  883. textBox_K_Min.Text = "0.25";//传感器标定值下限
  884. textBox_K_Max.Text = "1.20";//传感器标定值下限
  885. textBox_Start_Min.Text = "350";//启动值下限
  886. textBox_Start_Max.Text = "750";//启动值上限
  887. }
  888. else if (textBox_Model.Text.Contains("PS"))
  889. {
  890. textBox_Serial.Text = "4";//系列号
  891. textBox_MaxCurrent.Text = "17";//限流
  892. textBox_RatePower.Text = "500";//额定功率
  893. textBox_RateSpeed.Text = "1800";//额定转速
  894. textBox_Rate_Vol.Text = "48";//额定电压
  895. textBox_NC_Current.Text = "1000";//空载电流
  896. textBox_GasSpeedTh.Text = "1000";//指拨转速
  897. textBox_Zero_Min.Text = "100";//零偏下限
  898. textBox_Zero_Max.Text = "2000";//零偏上限
  899. textBox_K_Min.Text = "0.25";//传感器标定值下限
  900. textBox_K_Max.Text = "1.20";//传感器标定值下限
  901. textBox_Start_Min.Text = "350";//启动值下限
  902. textBox_Start_Max.Text = "750";//启动值上限
  903. }
  904. else
  905. {
  906. textBox_Serial.Text = "";//系列号
  907. textBox_MaxCurrent.Text = "";//限流
  908. textBox_RatePower.Text = "";//额定功率
  909. textBox_RateSpeed.Text = "";//额定转速
  910. textBox_Rate_Vol.Text = "";//额定电压
  911. textBox_NC_Current.Text = "";//空载电流
  912. textBox_GasSpeedTh.Text = "";//指拨转速
  913. textBox_Zero_Min.Text = "";//零偏下限
  914. textBox_Zero_Max.Text = "";//零偏上限
  915. textBox_K_Min.Text = "";//传感器标定值下限
  916. textBox_K_Max.Text = "";//传感器标定值下限
  917. textBox_Start_Min.Text = "";//启动值下限
  918. textBox_Start_Max.Text = "";//启动值上限
  919. }
  920. }
  921. }
  922. }