CN103513602B - The PLC waveform data of a kind of accurate timer shaft produces and storage method - Google Patents
The PLC waveform data of a kind of accurate timer shaft produces and storage method Download PDFInfo
- Publication number
- CN103513602B CN103513602B CN201210222161.6A CN201210222161A CN103513602B CN 103513602 B CN103513602 B CN 103513602B CN 201210222161 A CN201210222161 A CN 201210222161A CN 103513602 B CN103513602 B CN 103513602B
- Authority
- CN
- China
- Prior art keywords
- data
- waveform data
- plc
- time
- waveform
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 230000003993 interaction Effects 0.000 claims abstract description 14
- 238000000926 separation method Methods 0.000 claims abstract description 4
- 238000004891 communication Methods 0.000 claims description 7
- 238000005259 measurement Methods 0.000 claims description 3
- 238000013500 data storage Methods 0.000 abstract description 5
- 238000002474 experimental method Methods 0.000 abstract description 5
- 230000005540 biological transmission Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000012806 monitoring device Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Recording Measured Values (AREA)
- Measurement Of Unknown Time Intervals (AREA)
Abstract
本发明公开了一种精确时间轴的PLC波形数据产生及存储方法,可用于PLC采集波形数据存储,该方法采用产生与存储过程分置的波形数据获取方式,构造一种精确时间轴的PLC波形数据产生及存储方法。所述的产生与存储过程分置是指PLC中产生数据、上位机中存储数据的过程;所述精准时间轴是指时间与幅值对应准确。该方法实施方案包括:PLC控制器1、波形数据生成梯形图程序2、上位机3、基于虚拟仪器的人机交互软件4、OPC C/S 5。本发明使波形时间轴与纵轴数据对应准确,时间偏差在1ms以内,对时间与幅值对应要求高的实验是一种理想的数据存储方法。
The invention discloses a precise time axis PLC waveform data generation and storage method, which can be used for PLC acquisition waveform data storage. The method adopts a waveform data acquisition method in which the generation and storage processes are separated to construct a precise time axis PLC waveform data. Data generation and storage methods. The separation of the generation and storage process refers to the process of generating data in the PLC and storing data in the host computer; the precise time axis refers to the accurate correspondence between time and amplitude. The implementation of the method includes: PLC controller 1, waveform data generation ladder diagram program 2, upper computer 3, human-computer interaction software 4 based on virtual instruments, and OPC C/S 5. The invention makes the correspondence between the waveform time axis and the vertical axis data accurate, the time deviation is within 1 ms, and is an ideal data storage method for experiments that require high correspondence between time and amplitude.
Description
技术领域 technical field
本发明涉及一种精确时间轴的PLC波形数据产生及存储方法。The invention relates to a method for generating and storing PLC waveform data with precise time axis.
背景技术 Background technique
PLC具备控制与采集的功能,可以作为实验用监控装置使用,针对其存储卡容量小的缺陷,通常采用配以上位机的方法对采集数据进行存储。但该方案依然存在不足:用上位机读取PLC采集数据并建立波形时,因数据通信延时,使波形曲线的时间轴与纵轴数据对应不准,这种时间偏差随传送数据量增大而增大,因此,往往只能得到波形曲线,无法知道波形是否存在延迟及延迟多少,尤其在需要对控制信号与采集信号作时差比对时,更不能采用该方案。以传输速度较快的以太网通信为例,一根1.5米长的网线连接上位机与PLC以太网模块,经测试,因传输造成的数据延迟时间如下表所示PLC has the functions of control and acquisition, and can be used as an experimental monitoring device. For the defect of its small memory card capacity, it usually stores the collected data by means of a host computer. However, there are still deficiencies in this solution: when the upper computer is used to read the data collected by the PLC and create the waveform, due to the delay in data communication, the time axis of the waveform curve does not correspond to the data on the vertical axis. This time deviation increases with the amount of transmitted data. Therefore, only the waveform curve can be obtained, and it is impossible to know whether there is delay in the waveform and how much delay, especially when it is necessary to compare the time difference between the control signal and the acquisition signal, this solution cannot be used. Taking the Ethernet communication with a faster transmission speed as an example, a 1.5-meter-long network cable connects the upper computer and the PLC Ethernet module. After testing, the data delay time caused by transmission is shown in the table below
在数据量很小的情况下,PLC与上位机之间的传输延迟达到100ms以上。显然,对于一些时间与幅值对应准确性要求高的实验而言,已有的数据存储方式难以满足要求。In the case of a small amount of data, the transmission delay between the PLC and the host computer can reach more than 100ms. Obviously, for some experiments that require high accuracy in the correspondence between time and amplitude, the existing data storage methods are difficult to meet the requirements.
发明内容 Contents of the invention
本发明为了解决上述问题,提供一种精确时间轴的PLC波形数据产生及存储方法,使波形数据的时间与幅值对应准确度显著提高,时间偏差在1ms以内。In order to solve the above problems, the present invention provides a method for generating and storing PLC waveform data with a precise time axis, so that the corresponding accuracy of time and amplitude of waveform data is significantly improved, and the time deviation is within 1 ms.
本发明采用的技术方案为:利用产生与存储过程分置的波形数据获取方式,构造一种精确时间轴的PLC波形数据产生及存储方法,用于PLC波形数据记录,方案包括PLC控制器、波形数据生成梯形图程序、上位机、基于虚拟仪器的人机交互软件、OPCC/S。The technical scheme adopted by the present invention is: using the waveform data acquisition method with separate generation and storage processes, constructing a PLC waveform data generation and storage method with a precise time axis for PLC waveform data recording, the scheme includes PLC controller, waveform Data generation ladder diagram program, upper computer, human-computer interaction software based on virtual instrument, OPCC/S.
所述的产生与存储过程分置是指在PLC程序主循环的每个周期中获取系统时间相对于零时刻的时间差,并读取各输入通道的采集数据,将所有数据存入预设的波形数据块中;在人机交互软件中,以固定周期读取波形数据快的所有数据,存入文件。The separation of the generation and storage process refers to obtaining the time difference between the system time and the zero moment in each cycle of the main cycle of the PLC program, reading the collected data of each input channel, and storing all the data into the preset waveform In the data block; in the human-computer interaction software, read all the data of the waveform data block in a fixed cycle and store it in the file.
所述精准时间轴是指时间与幅值对应准确;所述预设的波形数据块为共享数据块,包含时间和各通道数据;所述固定周期根据OPCC/S所设数据刷新周期而定;所述零时刻为数据记录开始时刻。The precise time axis refers to the accurate correspondence between time and amplitude; the preset waveform data block is a shared data block, including time and data of each channel; the fixed cycle is determined according to the data refresh cycle set by OPCC/S; The zero time is the start time of data recording.
所述波形数据生成梯形图程序存储在PLC控制器的MMC卡内;所述PLC控制器设置有以太网通信接口模块;所述基于虚拟仪器的人机交互软件和OPCC/S运行在上位机上。The ladder diagram program generated by the waveform data is stored in the MMC card of the PLC controller; the PLC controller is provided with an Ethernet communication interface module; the human-computer interaction software and OPCC/S based on virtual instruments run on the host computer.
方法流程为:PLC开始运行,当中断时间未到时,执行下一次判断,当中断时间到时,进入中断,获取时间及各通道幅值,将数据送至数据块并进行数据块的数据更新,然后将数据块内容送至OPCServer;将更新后的数据块内容通过以太网送入OPCServer,并由I/OClient读取;运行人机交互软件,当数据读取周期未到时,执行下一次判断,当数据读取周期到时,从I/OClient读取OPCServer中的数据,形成波形数据,存入测量文件,然后判断是否进行下一次数据读取。The method flow is: PLC starts running, when the interrupt time is not up, execute the next judgment, when the interrupt time is up, enter the interrupt, obtain the time and the amplitude of each channel, send the data to the data block and update the data of the data block , and then send the content of the data block to the OPCServer; send the updated content of the data block to the OPCServer via Ethernet, and be read by the I/OClient; run the human-computer interaction software, and execute the next time when the data reading period is not up Judgment, when the data reading cycle is up, read the data in the OPCServer from the I/OClient to form waveform data, store it in the measurement file, and then judge whether to read the data next time.
本发明的优点是,使波形时间轴与纵轴数据对应准确,时间偏差在1ms以内,对时间与幅值对应要求高的实验是一种理想的数据存储方法。The invention has the advantages that the waveform time axis and the vertical axis data correspond accurately, the time deviation is within 1 ms, and it is an ideal data storage method for experiments requiring high correspondence between time and amplitude.
附图说明:Description of drawings:
图1为一种精确时间轴的PLC波形数据产生及存储方法的方案实施框图。Fig. 1 is a scheme implementation block diagram of a precise time axis PLC waveform data generation and storage method.
图2为一种精确时间轴的PLC波形数据产生及存储方法的流程图。Fig. 2 is a flow chart of a method for generating and storing PLC waveform data with a precise time axis.
图3为本方法与上位机产生波形的方法的实验曲线对比图。Figure 3 is a comparison diagram of experimental curves between this method and the method of generating waveforms by the host computer.
图4为实验记录下多通道波形曲线。Figure 4 is the multi-channel waveform curve recorded by the experiment.
具体实施方式 detailed description
以下通过实施例并参考附图对本发明进行详细说明。The present invention will be described in detail below through embodiments and with reference to the accompanying drawings.
图1示出的是一种精确时间轴的PLC波形数据产生及存储方法的方案实施框图,如图所示,一种精确时间轴的PLC波形数据产生及存储方法包括:PLC控制器1、波形数据生成梯形图程序2、上位机3(工业控制电脑)、基于虚拟仪器的人机交互软件4、OPCC/S5;所述的产生与存储过程分置是指在PLC程序主循环的每个周期中获取系统时间相对于零时刻的时间差,并读取各输入通道的采集数据,将所有数据存入波形数据块中;在人机交互软件中,以固定周期读取波形数据快的所有数据,存入文件;所述波形数据生成梯形图程序存储在PLC控制器的MMC卡内,所述PLC控制器设置有以太网通信接口模块,所述基于虚拟仪器的人机交互软件和OPCC/S运行在上位机上;所述波形数据块为共享数据块,包含时间和各通道数据;所述固定周期根据OPCC/S所设数据刷新速度而定;所述零时刻为数据记录开始时刻。What Fig. 1 shows is a scheme implementation block diagram of the PLC waveform data generation and storage method of a kind of precise time axis, as shown in the figure, a kind of PLC waveform data generation and storage method of precise time axis comprise: PLC controller 1, waveform Data generation ladder diagram program 2, upper computer 3 (industrial control computer), human-computer interaction software based on virtual instruments 4, OPCC/S5; Obtain the time difference between the system time and the zero time, and read the collected data of each input channel, and store all the data in the waveform data block; in the human-computer interaction software, read all the data of the waveform data in a fixed cycle, Deposit in file; Described waveform data generation ladder diagram program is stored in the MMC card of PLC controller, and described PLC controller is provided with Ethernet communication interface module, and described human-computer interaction software and OPCC/S operation based on virtual instrument On the host computer; the waveform data block is a shared data block, including time and each channel data; the fixed cycle is determined according to the data refresh rate set by OPCC/S; the zero moment is the data recording start time.
PLC控制器与上位机之间使用网线(如RJ-45网线)传输数据。A network cable (such as an RJ-45 network cable) is used to transmit data between the PLC controller and the host computer.
图2示出的是一种精确时间轴的PLC波形数据产生及存储方法流程图,如图所示。FIG. 2 shows a flowchart of a method for generating and storing PLC waveform data with a precise time axis, as shown in the figure.
步骤1:PLC上电,PLC内部程序开始运行,当中断时间未到时,执行下一次判断,当中断时间到时,进入中断,获取时间及各通道幅值,将数据送至数据块并进行数据块的数据更新,然后将数据块内容送至OPCServer。如在压力数据采集过程中,在中断内执行时间获取、压力数据获取,将其用于更新数据块中时间点和各通道压力数据,时间获取是计算当前系统时间与记录开始时刻的系统时间的差,数据块内容包括时间和多通道的幅值,便于数据整体向NI公司LabVIEW的I/OClient传输。Step 1: The PLC is powered on, and the internal program of the PLC starts to run. When the interrupt time is not up, execute the next judgment. When the interrupt time is up, enter the interrupt, obtain the time and the amplitude of each channel, send the data to the data block and perform The data of the data block is updated, and then the content of the data block is sent to OPCServer. For example, in the process of pressure data acquisition, time acquisition and pressure data acquisition are executed within the interrupt, and they are used to update the time point in the data block and the pressure data of each channel. Time acquisition is the calculation of the current system time and the system time at the start of recording. The content of the data block includes the time and the amplitude of multiple channels, which is convenient for the data to be transmitted to the I/OClient of NI LabVIEW as a whole.
步骤2:将更新后的数据块内容通过以太网送入OPCServer,并由I/OClient读取。如将8个通道的压力波形数据传输至上位机,首先建立PLC以太网通信模块与上位机的通信连接,即在上位机中的西门子公司的STEP7软件上配置PC站点,并在OPCScout软件中创建1个时间变量和1个8元素的REAL型数组;其次,需要建立OPCServer与I/OClient之间的数据连接,即在工业控制电脑的人机交互软件中建立与OPC监测其中数据类型相同的共享变量,并与OPCServer的变量绑定。Step 2: Send the updated data block content to OPCServer via Ethernet, and read it by I/OClient. For example, to transmit the pressure waveform data of 8 channels to the host computer, first establish the communication connection between the PLC Ethernet communication module and the host computer, that is, configure the PC site on the STEP7 software of Siemens in the host computer, and create it in the OPCScout software 1 time variable and 1 REAL array of 8 elements; secondly, it is necessary to establish a data connection between OPCServer and I/OClient, that is, to establish a shared data type in the human-computer interaction software of the industrial control computer that is the same as that of OPC monitoring. variable, and bind it to the variable of OPCServer.
步骤3:运行人机交互软件,当数据读取周期未到时,执行下一次判断,当数据读取周期到时,从I/OClient读取OPCServer中的数据,形成波形数据,存入测量文件,然后判断是否进行下一次数据读取。周期判断波形数据存储,存储周期需要依据OPCC/S所设数据刷新周期而定,而该刷新速度取决于上位机与PLC各自的CPU配置。例如,如果OPC所设数据刷新周期为100ms,则存储周期设为100ms为宜。Step 3: Run the human-computer interaction software. When the data reading period is not up, execute the next judgment. When the data reading period is up, read the data in the OPCServer from the I/OClient to form waveform data and save it into the measurement file , and then judge whether to read data next time. Cycle judgment waveform data storage, the storage cycle needs to be determined according to the data refresh cycle set by OPCC/S, and the refresh rate depends on the respective CPU configurations of the host computer and PLC. For example, if the data refresh period set by OPC is 100ms, it is better to set the storage period as 100ms.
以阀门调节为实验,利用本发明所提方法记录了波形曲线,并同时记录下在上位机建立时间轴所得到的波形曲线,两者的对比如图3所示,时差接近100ms。根据本发明所提方法,记录下多通道波形曲线如图4所示。Taking valve adjustment as an experiment, the waveform curve was recorded by the method proposed in the present invention, and the waveform curve obtained by establishing the time axis in the host computer was recorded at the same time. The comparison between the two is shown in Figure 3, and the time difference is close to 100ms. According to the method proposed in the present invention, the multi-channel waveform curve is recorded as shown in FIG. 4 .
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210222161.6A CN103513602B (en) | 2012-06-29 | 2012-06-29 | The PLC waveform data of a kind of accurate timer shaft produces and storage method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210222161.6A CN103513602B (en) | 2012-06-29 | 2012-06-29 | The PLC waveform data of a kind of accurate timer shaft produces and storage method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103513602A CN103513602A (en) | 2014-01-15 |
CN103513602B true CN103513602B (en) | 2016-06-22 |
Family
ID=49896518
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210222161.6A Expired - Fee Related CN103513602B (en) | 2012-06-29 | 2012-06-29 | The PLC waveform data of a kind of accurate timer shaft produces and storage method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103513602B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109075797B (en) * | 2016-04-22 | 2020-05-01 | 三菱电机株式会社 | Digital-analog converter, controller, and control system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1180740A1 (en) * | 2000-08-14 | 2002-02-20 | Alcatel | Method of storing data in a multimedia file using relative time bases |
CN1570943A (en) * | 2003-07-24 | 2005-01-26 | 上海宝信软件股份有限公司 | Method for acquiring, storing and analyzing high-speed process data |
CN101866175A (en) * | 2010-06-21 | 2010-10-20 | 北京机电院高技术股份有限公司 | Multi-remote floor scale acquisition and recording method and system |
CN102215164A (en) * | 2011-05-25 | 2011-10-12 | 浙江中控软件技术有限公司 | Data transmission method |
CN102508465A (en) * | 2011-10-08 | 2012-06-20 | 中南大学 | Data communication method between programmable controller and upper computer |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7203553B2 (en) * | 2002-12-23 | 2007-04-10 | Siemens Energy & Automation, Inc. | Methods and structures for utilizing a memory device for a PLC |
-
2012
- 2012-06-29 CN CN201210222161.6A patent/CN103513602B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1180740A1 (en) * | 2000-08-14 | 2002-02-20 | Alcatel | Method of storing data in a multimedia file using relative time bases |
CN1570943A (en) * | 2003-07-24 | 2005-01-26 | 上海宝信软件股份有限公司 | Method for acquiring, storing and analyzing high-speed process data |
CN101866175A (en) * | 2010-06-21 | 2010-10-20 | 北京机电院高技术股份有限公司 | Multi-remote floor scale acquisition and recording method and system |
CN102215164A (en) * | 2011-05-25 | 2011-10-12 | 浙江中控软件技术有限公司 | Data transmission method |
CN102508465A (en) * | 2011-10-08 | 2012-06-20 | 中南大学 | Data communication method between programmable controller and upper computer |
Also Published As
Publication number | Publication date |
---|---|
CN103513602A (en) | 2014-01-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104753406A (en) | Multi-motor cooperative control method | |
TW202006574A (en) | Production system with product quality measurement function and mechanism diagnosis function and driver and method thereof | |
CN113359512A (en) | Component content digital twinning characteristic analysis method in rare earth extraction separation process | |
CN104057637B (en) | A kind of brake cruve self-learning method of the numerical control press based on SVMs | |
CN103513602B (en) | The PLC waveform data of a kind of accurate timer shaft produces and storage method | |
CN108763788B (en) | A simulation method and device for information-physical system | |
CN105337805B (en) | Portable smart substation remote signaling and telemetry verification device and system | |
CN213277033U (en) | Multiprocessor industrial Internet of things gateway for educational training | |
CN102843380B (en) | A kind of method solved based on the serial port communication bottleneck of MODBUS | |
CN206179346U (en) | Process control tests platform based on matlab and winCC | |
CN201662724U (en) | A fuzzy control device for liquid level of fractionation tower in oil refinery | |
CN205809253U (en) | A kind of motor measurement apparatus | |
CN202748161U (en) | Environmental factor acquisition system and measuring apparatus for production process of semiconductor integrated circuit | |
CN115022918B (en) | 5G data transmission test system and method based on industrial closed-loop control process | |
CN202159099U (en) | Multichannel resistivity measurement equipment and system | |
CN203104121U (en) | A device for primary frequency regulation of generator sets using PMU frequency information | |
CN102855303A (en) | Method and device for data transmission between SCADA (supervisory control and data acquisition) system and database platform | |
CN201830280U (en) | Tester for simulating PROFIBUS-DP master station communication | |
CN206627797U (en) | A kind of multi-path data acquiring system based on Modbus | |
CN105259442A (en) | UPFC control protection system testing device and method with isochronous transmission function on the basis of multiple protocols | |
CN204492809U (en) | To the system of downhole tool transfer instruction | |
CN202756153U (en) | Oil atomizer testing device based on micro-electromechanical system (MEMS) technology | |
CN105443213A (en) | Diesel oxidation catalyst (DOC) hardware-in-loop simulation system based on analog circuit | |
CN118092324B (en) | Chemical production control system based on Internet of things | |
CN202110457U (en) | A coke tower preheating temperature trigger control device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160622 |
|
CF01 | Termination of patent right due to non-payment of annual fee |