WagoSocketSimulator.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. using Aitex.Common.Util;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.Device.Festo;
  6. using MECF.Framework.Common.Device.Wago;
  7. using MECF.Framework.Common.Net;
  8. using MECF.Framework.Common.Simulator;
  9. using MECF.Framework.Simulator.Core.Driver;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.IO;
  13. namespace CyberX8_Simulator.Devices
  14. {
  15. public class WagoSocketSimulator : SocketDeviceSimulator
  16. {
  17. private const short WRITE_DO_STARTADDRESS = 0x0200;
  18. private const short WRITE_AO_STARTADDRESS = 0x0200;
  19. //键是名字,值是对应数据所在的位置 注意:要和WagoControlCfg里面的地址顺序对上
  20. public Dictionary<string, int> DONameIndexDic;
  21. public Dictionary<string, int> DINameIndexDic;
  22. public Dictionary<string, int> AINameIndexDic;
  23. public Dictionary<string, int> AONameIndexDic;
  24. private IByteTransform byteTransform = new BigEndianByteTransformBase();
  25. //存储模拟器数据的数组
  26. public byte[] DOBytes = new byte[100];
  27. public short[] AOShorts = new short[100];
  28. public byte[] DIBytes = new byte[100];
  29. public short[] AIShorts = new short[100];
  30. /// <summary>
  31. /// 写DO锁
  32. /// </summary>
  33. private object _writeDOLocker = new object();
  34. /// <summary>
  35. /// 写AO锁
  36. /// </summary>
  37. private object _writeAOLocker = new object();
  38. /// <summary>
  39. /// Festo Data Buffer
  40. /// </summary>
  41. private Dictionary<string, bool> _festoDataBuffer = new Dictionary<string, bool>();
  42. /// <summary>
  43. /// 定时器
  44. /// </summary>
  45. private PeriodicJob _periodicJob;
  46. //delegate
  47. #region Delegate
  48. public delegate void VariableValueChanged(object obj);
  49. #endregion
  50. #region 事件
  51. /// <summary>
  52. /// 变量变更事件
  53. /// </summary>
  54. public event VariableValueChanged OnDIVariableValueChanged;
  55. public event VariableValueChanged OnAIVariableValueChanged;
  56. public event VariableValueChanged OnDOVariableValueChanged;
  57. public event VariableValueChanged OnAOVariableValueChanged;
  58. #endregion
  59. public WagoSocketSimulator(int port):base(port)
  60. {
  61. SimulatorCommManager.Instance.OnUpdateVariableValueChanged += UpdataDataCausedByOtherModule;
  62. MotorSimulator.Instance.OnUpdateWagoDatasChanged += UpdataDataCausedByOtherModule;
  63. InitializeData(port);
  64. }
  65. private void UpdataDataCausedByOtherModule(string name, bool value, bool invert)
  66. {
  67. value = invert ? !value : value;
  68. //AI Data
  69. if (AINameIndexDic.ContainsKey(name))
  70. {
  71. switch (name)
  72. {
  73. case "r_LoaderA_LS_Vacuum_anlg":
  74. case "r_LoaderB_LS_Vacuum_anlg":
  75. AIShorts[AINameIndexDic[name]] = value ? (short)0x32C8 : (short)0x2AF8;
  76. break;
  77. case "r_DPUF_A_CHUCK_A_VAC":
  78. case "r_DPUF_A_CHUCK_B_VAC":
  79. AIShorts[AINameIndexDic[name]] = value ? (short)0x0C80 : (short)0x32C8;
  80. break;
  81. case "r_LOADERA_BERNOULLI_PRESSURE":
  82. case "r_LOADERB_BERNOULLI_PRESSURE":
  83. case "r_LOADERA_CHUCK_BLADDER":
  84. case "r_LOADERB_CHUCK_BLADDER":
  85. case "r_LOADERA_WS_BLADDER_PRESSURE":
  86. case "r_LOADERB_WS_BLADDER_PRESSURE":
  87. AIShorts[AINameIndexDic[name]] = value ? (short)0x2AF8 : (short)0x00;
  88. break;
  89. default:
  90. break;
  91. }
  92. }
  93. //DI Data
  94. UpdataDIBytes(name, value ? 1 : 0);
  95. //Festo Data
  96. if (name == "FlowTestClamp") _festoDataBuffer[name] = value;
  97. }
  98. /// <summary>
  99. /// 触发Wago对应数据更新
  100. /// </summary>
  101. /// <param name="position"></param>
  102. /// <param name="value"></param>
  103. private void UpdateDataCausedByWago(int position, bool value)
  104. {
  105. if (DONameIndexDic.ContainsKey("c_PUF_CHUCK") && position == DONameIndexDic["c_PUF_CHUCK"])
  106. {
  107. UpdataDIBytes("r_PUF_A_CHUCK_OUT", value ? 1 : 0);
  108. UpdataDIBytes("r_PUF_B_CHUCK_OUT", value ? 1 : 0);
  109. UpdataDIBytes("r_PUF_A_CHUCK_IN", !value ? 1 : 0);
  110. UpdataDIBytes("r_PUF_B_CHUCK_IN", !value ? 1 : 0);
  111. }
  112. if (DONameIndexDic.ContainsKey("c_HVD_1_HIGH") && position == DONameIndexDic["c_HVD_1_HIGH"])
  113. {
  114. UpdataAIShorts("r_HVD_1_ANALOG", value ? 4500 : 0);
  115. }
  116. if (DONameIndexDic.ContainsKey("c_HVD_2_HIGH") && position == DONameIndexDic["c_HVD_2_HIGH"])
  117. {
  118. UpdataAIShorts("r_HVD_2_ANALOG", value ? 4500 : 0);
  119. }
  120. }
  121. /// <summary>
  122. /// 初始化字典
  123. /// </summary>
  124. private void InitializeData(int port) //端口用于初始化不同Wago设备的字典
  125. {
  126. //加载对应配置文件 WagoControllerCfg-Simulator.xml
  127. try
  128. {
  129. string oldXmlPath = PathManager.GetCfgDir();
  130. string newXmlPath = oldXmlPath.Replace("CyberX8_Simulator", "CyberX8_RT") + "Devices\\WagoControllerCfg-Simulator.xml";
  131. WagoControllerCfg cfg = CustomXmlSerializer.Deserialize<WagoControllerCfg>(new FileInfo(newXmlPath));
  132. if (cfg != null)
  133. {
  134. foreach (WagoDeviceConfig config in cfg.WagoDeviceConfigs)
  135. {
  136. if (port == config.Port)
  137. {
  138. if(config.Module == "Loader" && _periodicJob == null)
  139. {
  140. _periodicJob = new PeriodicJob(100, OnTimer, $"Wago {config.Module} timer",true);
  141. }
  142. //加载DO
  143. int i = 0;
  144. DONameIndexDic = new Dictionary<string, int>();
  145. foreach (var group in config.WagoDigOut.WagoDOGroups)
  146. {
  147. foreach (var item in group.WagoDOs)
  148. {
  149. DONameIndexDic[item.Name] = i;
  150. i++;
  151. }
  152. }
  153. //加载DI
  154. i = 0;
  155. DINameIndexDic = new Dictionary<string, int>();
  156. foreach (var group in config.WagoDigIn.WagoDIGroups)
  157. {
  158. foreach(var item in group.WagoDIs)
  159. {
  160. DINameIndexDic[item.Name] = i;
  161. i++;
  162. }
  163. }
  164. //加载AO
  165. i = 0;
  166. AONameIndexDic = new Dictionary<string, int>();
  167. foreach (var group in config.WagoAnoOut.WagoAOGroups)
  168. {
  169. foreach (var item in group.WagoAOs)
  170. {
  171. AONameIndexDic[item.Name] = i;
  172. i++;
  173. }
  174. }
  175. //加载AI
  176. i = 0;
  177. AINameIndexDic = new Dictionary<string, int>();
  178. foreach (var group in config.WagoAnoIn.WagoAIGroups)
  179. {
  180. foreach (var item in group.WagoAIs)
  181. {
  182. AINameIndexDic[item.Name] = i;
  183. i++;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. }
  190. catch
  191. {
  192. LOG.WriteLog(eEvent.ERR_WAGO, "Wago", "Load wago WagoControllerCfg-Simulator.xml failed");
  193. }
  194. //设置IO变量默认值
  195. if (AINameIndexDic.ContainsKey("r_LoaderA_LS_Vacuum_anlg")) AIShorts[AINameIndexDic["r_LoaderA_LS_Vacuum_anlg"]] = 0x32C8;
  196. if (AINameIndexDic.ContainsKey("r_LoaderB_LS_Vacuum_anlg")) AIShorts[AINameIndexDic["r_LoaderB_LS_Vacuum_anlg"]] = 0x32C8;
  197. if (AINameIndexDic.ContainsKey("r_DPUF_A_CHUCK_A_VAC")) AIShorts[AINameIndexDic["r_DPUF_A_CHUCK_A_VAC"]] = 0x32C8;
  198. if (AINameIndexDic.ContainsKey("r_DPUF_A_CHUCK_B_VAC")) AIShorts[AINameIndexDic["r_DPUF_A_CHUCK_B_VAC"]] = 0x32C8;
  199. if (AINameIndexDic.ContainsKey("r_SYSTEM_EXHAUST")) AIShorts[AINameIndexDic["r_SYSTEM_EXHAUST"]] = 0x3A98;
  200. if (DONameIndexDic.ContainsKey("c_HVD_1_ENABLE")) DOBytes[DONameIndexDic["c_HVD_1_ENABLE"]] = 1;
  201. if (DONameIndexDic.ContainsKey("c_HVD_2_ENABLE")) DOBytes[DONameIndexDic["c_HVD_2_ENABLE"]] = 1;
  202. }
  203. #region 公共方法
  204. public void UpdataDOBytes(string name,int value)
  205. {
  206. if (OnDOVariableValueChanged != null)
  207. {
  208. OnDOVariableValueChanged(name);
  209. }
  210. if (DONameIndexDic.ContainsKey(name))
  211. {
  212. if (DONameIndexDic[name] < DOBytes.Length)
  213. {
  214. DOBytes[DONameIndexDic[name]] = value == 0 ? (byte)0 : (byte)1;
  215. }
  216. }
  217. }
  218. public void UpdataDIBytes(string name, int value)
  219. {
  220. if (OnDIVariableValueChanged != null)
  221. {
  222. OnDIVariableValueChanged(name);
  223. }
  224. if (DINameIndexDic.ContainsKey(name))
  225. {
  226. if (DINameIndexDic[name] < DIBytes.Length)
  227. {
  228. DIBytes[DINameIndexDic[name]] = value == 0 ? (byte)0 : (byte)1;
  229. }
  230. }
  231. }
  232. public void UpdataAOShorts(string name, int value)
  233. {
  234. if (OnAOVariableValueChanged != null)
  235. {
  236. OnAOVariableValueChanged(name);
  237. }
  238. if (AONameIndexDic.ContainsKey(name))
  239. {
  240. string hexValue = value.ToString("X2");
  241. try
  242. {
  243. short result = Convert.ToInt16(hexValue, 16);
  244. if (AONameIndexDic[name] < AOShorts.Length)
  245. {
  246. AOShorts[AONameIndexDic[name]] = result;
  247. }
  248. }
  249. catch (FormatException)
  250. {
  251. }
  252. }
  253. }
  254. public void UpdataAIShorts(string name, int value)
  255. {
  256. if (OnAIVariableValueChanged != null)
  257. {
  258. OnAIVariableValueChanged(name);
  259. }
  260. if (AINameIndexDic.ContainsKey(name))
  261. {
  262. string hexValue = value.ToString("X2");
  263. try
  264. {
  265. short result = Convert.ToInt16(hexValue, 16);
  266. if(AINameIndexDic[name] < AIShorts.Length)
  267. {
  268. AIShorts[AINameIndexDic[name]] = result;
  269. }
  270. }
  271. catch (FormatException)
  272. {
  273. }
  274. }
  275. }
  276. #endregion
  277. #region 功能方法
  278. /// <summary>
  279. /// 将长度为8的二进制byte数组转成对应十六进制byte值(大端模式)
  280. /// </summary>
  281. /// <param name="byteArray"></param>
  282. /// <returns></returns>
  283. public byte ConvertByteArrayToHex(byte[] byteArray)
  284. {
  285. byte result = 0;
  286. // 先将 byte 数组转换为二进制数
  287. int binaryValue = 0;
  288. for (int i = 0; i < 8; i++)
  289. {
  290. binaryValue |= (byteArray[i] << (7 - i));
  291. }
  292. // 逆转二进制数
  293. int reversedValue = 0;
  294. for (int i = 0; i < 8; i++)
  295. {
  296. reversedValue |= ((binaryValue >> i) & 1) << (7 - i);
  297. }
  298. // 转换为十六进制byte
  299. if (byte.TryParse(reversedValue.ToString("X2"), System.Globalization.NumberStyles.HexNumber, null, out result))
  300. {
  301. return result;
  302. }
  303. return 0;
  304. }
  305. /// <summary>
  306. /// 将short数组转成长度两倍的byte数组
  307. /// </summary>
  308. /// <param name="shortArray"></param>
  309. /// <returns></returns>
  310. private byte[] ConvertShortArrayToByteArray(short[] shortArray)
  311. {
  312. byte[] byteArray = new byte[shortArray.Length * 2];
  313. for (int i = 0; i < shortArray.Length; i++)
  314. {
  315. byte[] tempBytes = BitConverter.GetBytes(shortArray[i]);
  316. Array.Reverse(tempBytes);
  317. Array.Copy(tempBytes, 0, byteArray, i * 2, 2);
  318. }
  319. return byteArray;
  320. }
  321. #endregion
  322. protected override void ProcessUnsplitMessage(byte[] data)
  323. {
  324. byte command = data[7];
  325. if (command == 0x01) //读DO
  326. {
  327. short flag = byteTransform.TransInt16(data, 0);
  328. byte channel = data[6];
  329. short startAddress = byteTransform.TransInt16(data, 8);
  330. short bitCount = byteTransform.TransInt16(data, 10);
  331. byte byteCount = (byte)(bitCount / 8 + 1);
  332. byte[] bytes = new byte[byteCount];
  333. for(int i = 0; i < byteCount;i++)
  334. {
  335. byte[] tempbytes = new byte[8];
  336. Array.Copy(DOBytes,8 * i, tempbytes, 0, 8);
  337. bytes[i] = ConvertByteArrayToHex(tempbytes);
  338. }
  339. OnWriteMessage(CreateReadDigitalResponse(flag, channel, command, byteCount, bytes));
  340. return;
  341. }
  342. else if(command == 0x03)//读AO
  343. {
  344. short flag = byteTransform.TransInt16(data, 0);
  345. byte channel = data[6];
  346. short startAddress = byteTransform.TransInt16(data, 8);
  347. short registerCount = byteTransform.TransInt16(data, 10);
  348. short[] shorts = new short[registerCount];//获取指定寄存器里的内容
  349. Array.Copy(AOShorts, 0, shorts, 0, registerCount);
  350. byte[] bytes = new byte[registerCount * 2];
  351. bytes = ConvertShortArrayToByteArray(shorts); //转入长度为shorts数组长度两倍的bytes数组中
  352. OnWriteMessage(CreateReadAnalogyResponse(flag, channel, command, (byte)registerCount, bytes));
  353. return;
  354. }
  355. else if (command == 0x02)//读DI
  356. {
  357. short flag = byteTransform.TransInt16(data, 0);
  358. byte channel = data[6];
  359. short startAddress = byteTransform.TransInt16(data, 8);
  360. short bitCount = byteTransform.TransInt16(data, 10);
  361. byte byteCount = (byte)(bitCount / 8 + 1);
  362. byte[] bytes = new byte[byteCount];
  363. for (int i = 0; i < byteCount; i++)
  364. {
  365. byte[] tempbytes = new byte[8];
  366. Array.Copy(DIBytes, 8 * i, tempbytes, 0, 8);
  367. bytes[i] = ConvertByteArrayToHex(tempbytes);
  368. }
  369. OnWriteMessage(CreateReadDigitalResponse(flag, channel, command, byteCount, bytes));
  370. return;
  371. }
  372. else if (command == 0x04)//读AI
  373. {
  374. short flag = byteTransform.TransInt16(data, 0);
  375. byte channel = data[6];
  376. short startAddress = byteTransform.TransInt16(data, 8);
  377. short registerCount = byteTransform.TransInt16(data, 10);
  378. short[] shorts = new short[registerCount];//获取指定寄存器里的内容
  379. Array.Copy(AIShorts, 0, shorts, 0, registerCount);
  380. byte[] bytes = new byte[registerCount * 2];
  381. bytes = ConvertShortArrayToByteArray(shorts); //转入长度为shorts数组两倍的bytes数组中
  382. OnWriteMessage(CreateReadAnalogyResponse(flag, channel, command, (byte)registerCount, bytes));
  383. return;
  384. }
  385. else if (command == 0x05)//写DO
  386. {
  387. short startAddress = byteTransform.TransInt16(data, 8);
  388. if (startAddress > 0x03FF || startAddress < WRITE_DO_STARTADDRESS)
  389. {
  390. short flag = byteTransform.TransInt16(data, 0);
  391. byte channel = data[6];
  392. OnWriteMessage(CreateError(flag, channel, command, 0x02)); //地址错误
  393. return;
  394. }
  395. int position = startAddress - WRITE_DO_STARTADDRESS;
  396. bool status = data[10] == 0xFF ? true : false;
  397. lock (_writeDOLocker)
  398. {
  399. DOBytes[position] = status ? (byte)1 : (byte)0;
  400. }
  401. OnWriteMessage(data); //原消息返回
  402. //触发Wago对应数据更新
  403. UpdateDataCausedByWago(position, status);
  404. return;
  405. }
  406. else if (command == 0x06)//写AO
  407. {
  408. short startAddress = byteTransform.TransInt16(data, 8);
  409. if(startAddress > 0x02FF || startAddress < WRITE_AO_STARTADDRESS)
  410. {
  411. short flag = byteTransform.TransInt16(data, 0);
  412. byte channel = data[6];
  413. OnWriteMessage(CreateError(flag, channel, command, 0x02)); //地址错误
  414. return;
  415. }
  416. int position = startAddress - WRITE_AO_STARTADDRESS;
  417. short value = byteTransform.TransInt16(data, 10);
  418. lock (_writeAOLocker)
  419. {
  420. AOShorts[position] = value;
  421. }
  422. OnWriteMessage(data); //原消息返回
  423. return;
  424. }
  425. else
  426. {
  427. short flag = byteTransform.TransInt16(data, 0);
  428. byte channel = data[6];
  429. OnWriteMessage(CreateError(flag, channel, command, 0x01)); //指令错误
  430. return;
  431. }
  432. }
  433. /// <summary>
  434. /// 回复读数字量
  435. /// </summary>
  436. /// <param name="flag"></param>
  437. /// <param name="channel"></param>
  438. /// <param name="command"></param>
  439. /// <param name="byteCount"></param>
  440. /// <param name="values"></param>
  441. /// <returns></returns>
  442. private byte[] CreateReadDigitalResponse(short flag, byte channel, byte command, byte byteCount, byte[] values)
  443. {
  444. byte[] bytes = new byte[7 + 2 + values.Length]; //回复字节长度,前面7个字节固定长度 + functionCode一个字节 + byteCount一个字节+values.length个字节
  445. Array.Copy(byteTransform.GetBytes(flag), 0, bytes, 0, 2);
  446. bytes[2] = 0x00;
  447. bytes[3] = 0x00;
  448. short dataLength = (short)(3 + values.Length);
  449. Array.Copy(byteTransform.GetBytes(dataLength), 0, bytes, 4, 2);
  450. bytes[6] = channel;
  451. bytes[7] = command;
  452. bytes[8] = byteCount;
  453. Array.Copy(values, 0, bytes, 9, values.Length);
  454. return bytes;
  455. }
  456. /// <summary>
  457. /// 回复读模拟量
  458. /// </summary>
  459. /// <param name="flag"></param>
  460. /// <param name="channel"></param>
  461. /// <param name="command"></param>
  462. /// <param name="registerCount"></param>
  463. /// <param name="values"></param>
  464. /// <returns></returns>
  465. private byte[] CreateReadAnalogyResponse(short flag, byte channel, byte command, byte registerCount, byte[] values)
  466. {
  467. byte[] bytes = new byte[7 + 2 + 2 * registerCount]; //回复字节长度,前面7个字节固定长度 + functionCode一个字节 + byteCount一个字节+registerCount*2个字节(一个寄存器占两个字节)
  468. Array.Copy(byteTransform.GetBytes(flag), 0, bytes, 0, 2);
  469. bytes[2] = 0x00;
  470. bytes[3] = 0x00;
  471. short dataLength = (short)(3 + 2 * registerCount);
  472. Array.Copy(byteTransform.GetBytes(dataLength), 0, bytes, 4, 2);
  473. bytes[6] = channel;
  474. bytes[7] = command;
  475. bytes[8] = (byte)(2 * registerCount);
  476. Array.Copy(values, 0, bytes, 9, values.Length);
  477. return bytes;
  478. }
  479. /// <summary>
  480. /// 错误回复
  481. /// </summary>
  482. /// <param name="flag"></param>
  483. /// <param name="channel"></param>
  484. /// <param name="command"></param>
  485. /// <param name="error"></param>
  486. /// <returns></returns>
  487. private byte[] CreateError(short flag, byte channel, byte command, byte error)
  488. {
  489. byte[] bytes = new byte[9];
  490. Array.Copy(byteTransform.GetBytes(flag), 0, bytes, 0, 2);
  491. bytes[2] = 0x00;
  492. bytes[3] = 0x00;
  493. bytes[4] = 0x00;
  494. bytes[5] = 0x03;
  495. bytes[6] = channel;
  496. bytes[7] = (byte)(command | 0x80);
  497. bytes[8] = error;
  498. return bytes;
  499. }
  500. /// <summary>
  501. /// 定时器
  502. /// </summary>
  503. /// <returns></returns>
  504. private bool OnTimer()
  505. {
  506. LeakTestSimulator();
  507. return true;
  508. }
  509. #region 模拟方法
  510. /// <summary>
  511. /// Loader LeakTest模拟
  512. /// </summary>
  513. private void LeakTestSimulator()
  514. {
  515. if (DOBytes[DONameIndexDic["c_VACUUM_TEST"]] == 1 && _festoDataBuffer["FlowTestClamp"] && AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] == 0)
  516. {
  517. AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] = 15000;
  518. }
  519. else if (DOBytes[DONameIndexDic["c_VACUUM_TEST"]] == 0 && !_festoDataBuffer["FlowTestClamp"])
  520. {
  521. AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] = 0;
  522. }
  523. if (DOBytes[DONameIndexDic["c_VACUUM_TEST"]] == 1 && _festoDataBuffer["FlowTestClamp"] && AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] > 3500)
  524. {
  525. AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] -= 40;
  526. if (AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] < 14000)
  527. {
  528. AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] -= 140;
  529. }
  530. }
  531. }
  532. #endregion
  533. }
  534. }