The present invention relates to a program creation support device, a program creation support method, and a program that support creation of a program to be executed in a programmable logic controller (hereinafter referred to as PLC).
In the factory automation (FA) field, an automatic control device using a PLC has been conventionally used. The PLC generally includes a central processing unit (CPU) unit and a network unit for communication that operates in cooperation with the CPU unit. In the PLC, a communication network is constructed using the network unit, and communication between the CPU unit and a sensor at a remote location or the like is realized using the communication network.
In addition, it is also possible to construct a system including a plurality of networks for one CPU unit by attaching a plurality of network units on a base unit on which the CPU unit is attached.
One network is constructed with a network unit (hereinafter, referred to as a remote station) installed at a remote location to collect a value of a sensor at the remote location and a network unit (hereinafter, referred to as a master station) attached on the base unit to communicate with the remote station. The remote station and the master station each include a memory (hereinafter, referred to as a network-side memory). A device such as a sensor can be connected to the remote station, and the remote station collects measurement values such as sensor values from the connected device and stores the measurement values in its own network-side memory. The master station receives the measurement value collected by each of the remote stations at a determined timing and stores the measurement value in its own network-side memory, thereby aggregating the measurement values collected by the remote stations. The CPU unit can read measurement values outputted from devices connected to the remote stations by acquiring the measurement values stored in the network-side memory of the master station.
Here, a time required for a CPU constituting the CPU unit to acquire data stored in the network-side memory of the master station is longer than a time required for the CPU constituting the CPU unit to acquire data stored in a memory (hereinafter, referred to as a CPU-side memory) in the CPU unit. This is because inter-unit communication via the base unit occurs when the CPU of the CPU unit acquires a value in the network-side memory. Even if a configuration employed here is not a configuration in which the CPU unit and the network unit (master station) are attached on the base unit and communicate with each other via the base unit, but a configuration in which the CPU unit and the master station can directly communicate with each other, the time required for the CPU constituting the CPU unit to acquire the data stored in the network-side memory of the master station is longer.
Therefore, in general, the PLC has a function of synchronizing the data stored in a designated region of the CPU-side memory with the data stored in a designated region of the network-side memory. This function is also referred to as a refresh function. In the refresh function, a process of duplicating the data stored in the designated region of the CPU-side memory and transferring the resultant data to the designated region of the network-side memory is repeatedly executed with a predetermined period. As a result, the data stored in the designated region of the network-side memory is updated to the same data as the data stored in the designated region of the network-side memory with the predetermined period (see, for example, Patent Literature 1).
In the invention described in Patent Literature 1, speed-up of the processing is realized with the number of times of data transfer occurring at the time of execution of the refresh function being reduced.
Patent Literature 1: Japanese Patent Application Laid-open No. 2003-29809
In order to use the refresh function, it is necessary to perform memory allocation work, that is, a work by which association is made about a value of which region of the CPU-side memory should be synchronized with a value of which region of the network-side memory. In addition, a worker who creates a program to be executed by the PLC needs to perform programming with a state of the memory allocation in mind. That is, the worker needs to perform her or his programming with taking into account the following points: a point that a value outputted from which device connected to the remote station should be stored in which region of the network-side memory; and another point that a value in which region of the network-side memory should be synchronized with a value in which region of the CPU-side memory. Therefore, there has been a problem that a work load of a program creator increases.
The present invention has been made in view of the above circumstances, and an object thereof is to provide a program creation support device capable of reducing a work load of a worker who creates a program to be executed by a PLC.
In order to solve the above-mentioned problems and achieve the object, the present invention provides a program creation support device that supports creation of a sequence program to be executed by a programmable logic controller including a control unit and a network unit, the control unit having a first memory thin inside thereof and controlling an operation of the programmable logic controller as a whole, the network unit having a second memory in inside thereof and acquiring data from a device to be controlled by the programmable logic controller to store the data in the second memory, the programmable logic controller having a refresh function of synchronizing a value of a specific region of the first memory with a value of a specific region of the second memory, the program creation support device comprising: a program extraction unit to extract a description indicating access to the second memory from a pre-conversion sequence program that is a sequence program before being converted into a format understandable by the programmable logic controller; a storage unit to store memory allocation setting information indicating a correspondence relationship between the specific region of the first memory and the specific region of the second memory; and a program replacement unit to replace a description indicating access to the second memory in the pre-conversion sequence program with a description indicating access to the first memory on the basis of the memory allocation setting information stored in the storage unit.
A program creation support device according to the present invention achieves an advantageous effect that it is possible to reduce a work load of a worker who creates a program to be executed by a PLC.
Hereinafter, a program creation support device, a program creation support method, and a program according to embodiments of the present invention will be described in detail with reference to the drawings. The present invention is not necessarily limited by these embodiments.
First, a PLC using a program created by a program creation support device according to the present invention will be described with reference to
A PLC 1000 illustrated in
The CPU unit 1100 stores a CPU program 1101 that is a sequence program described in a ladder language or the like, and operates in accordance with program codes described in the CPU program 1101 to realize a control operation of the PLC 1000 as a whole. Furthermore, the CPU unit 1100 includes a CPU parameter 1102 for setting an operation of a CPU (not illustrated), and a CPU-side memory 1103 in which a result of an arithmetic operation performed in accordance with the CPU program 1101, and the like are stored. The CPU parameter 1102 includes memory allocation setting information 1121 that is information used in the refresh function, and network configuration setting information 1122 that indicates devices on the communication network managed by the network unit 1200 attached on the base unit 1300 and a region of the network-side memory 1201 that can be referred to by the CPU unit 1100. The memory allocation setting information 1121 indicates to which region of a memory (network-side memory 1201, described later) in the network unit 1200 each of regions where data is updated by the refresh function, among the regions of the CPU-side memory 1103 is allocated. The CPU-side memory 1103 is a first memory of the PLC 1000.
The network unit 1200 serves as a master station and includes the network-side memory 1201. Information acquired from a device such as a sensor in the communication network by a remote station that is the other network unit described above is aggregated in the network-side memory 1201. The network-side memory 1201 is a second memory of the PLC 1000.
Hereinafter, embodiments of a program creation support device according to the present invention will be described on the assumption that the CPU program 1101 to be executed by the CPU unit 1100 of the PLC 1000 illustrated in
The program creation support device 1 receives an operation from a worker who performs programming, and creates the CPU parameter 11 and the CPU program 12 in accordance with the content of the operation. The program creation support device 1 automatically creates memory allocation setting information 111 of the CPU parameter 11. The CPU program 12 illustrated in
In the following description, it is assumed that the program creation support device 1 stores the CPU program 12 that has been completely created. It is also assumed that the CPU program 12 includes an instruction to access the network-side memory 1201.
The CPU parameter 11 corresponds to the CPU parameter 1102 stored in the CPU unit 1100 of the PLC 1000 illustrated in
The change processing unit 20 includes a program extraction unit 21, a memory allocation unit 22, and a program replacement unit 23.
The program extraction unit 21 analyzes the CPU program 12 and extracts a part where a content representing access to the network-side memory 1201 is described, from the CPU program 12.
The memory allocation unit 22 updates the memory allocation setting information 111 on the basis of the content of the description in the part extracted by the program extraction unit 21. The update operation of the memory allocation setting information 111 also includes a process of newly creating the memory allocation setting information 111 when the memory allocation setting information 111 to be updated does not exist.
The program replacement unit 23 replaces the CPU program 12 on the basis of the memory allocation setting information 111 updated by the memory allocation unit 22. Specifically, the program replacement unit 23 rewrites a description that is included in the CPU program 12 and indicates access to the network-side memory 1201, as a description indicating access to the CPU-side memory 1103. For example, a case is assumed where the memory allocation setting information 111 includes information indicating that a region of address Al of the CPU-side memory 1103 is associated with a region of address B1 of the network-side memory 1201. In that case, the program replacement unit 23 rewrites a description that is included in the CPU program 12 and indicates access to the region of address B1 of the network-side memory 1201, as a description indicating access to the region of address A1 of the CPU-side memory 1103.
Here, hardware for implementing the program creation support device 1 having the configuration illustrated in
The storage unit 10 of the program creation support device 1 is realized by the memory 92. The change processing unit 20 of the program creation support device 1 is realized by the processor 91 and the memory 92. That is, the program extraction unit 21, the memory allocation unit 22, and the program replacement unit 23 of the change processing unit 20 are implemented by the memory 92 storing therein programs for realizing the functions of these units and the processor 91 reading the programs from the memory 92 and executing the programs.
The programs for realizing the units of the change processing unit 20 may be provided to a user in a state of being stored in the memory 92 in advance, or may be provided to the user in a state of being written in a computer-readable recording medium such as a CD-ROM (compact disc ROM) or a DVD-ROM (digital versatile disc ROM) to be installed in the memory 92 by the user. Furthermore, the programs may be provided to the user via a communication line such as the internet.
When starting the operation, the change processing unit 20 extracts a part where access to the network-side memory 1201 is described from the CPU program 12 (step S11). Specifically, the program extraction unit 21 reads the CPU program 12 from the storage unit 10 and analyzes the CPU program 12, and extracts a description indicating access to the network-side memory 1201. For example, it is assumed that a program block 121 illustrated in
Next, the change processing unit 20 allocates the CPU-side memory 1103 to the network-side memory 1201 corresponding to the part extracted in step S11 (step S12). Specifically, the memory allocation unit 22 allocates regions of the CPU-side memory 1103 to respective regions of the network-side memory 1201 indicated by descriptions extracted by the program extraction unit 21. Hereinafter, this process is referred to as a “memory allocation process”. In the memory allocation process, the memory allocation unit 22 allocates a region of the CPU-side memory 1103 while memorizing information about which region of the CPU-side memory 1103 has been allocated to the network-side memory 1201 so as not to redundantly allocate the same region of the CPU-side memory 1103 to different regions of the network-side memory 1201. It is assumed that a region (range) of the CPU-side memory 1103 that can be allocated to the network-side memory 1201 is designated in advance by the user or designated in advance by a manufacturer. In step S12, the memory allocation unit 22 selects a region that has not been subjected to allocation yet, from the designated range of the CPU-side memory 1103 and performs allocation of the selected one.
Next, the change processing unit 20 updates the memory allocation setting information 111 (step S13). Specifically, the memory allocation unit 22 reflects a result of the memory allocation process of step S12 in the memory allocation setting information 111. Here, in a case where a plurality of communication networks are constructed for one CPU unit 1100, there are pieces of the memory allocation setting information 111 the number of which is as many as the number of networks to be constructed. Therefore, the memory allocation unit 22 updates the memory allocation setting information 111 of a communication network corresponding to the description indicating access to the network-side memory 1201. In a case where the memory allocation setting information 111 of the communication network corresponding to the description indicating access to the network-side memory 1201 does not exist in the storage unit 10, the memory allocation unit 22 newly creates the memory allocation setting information 111. The memory allocation setting information 111 can be, for example, information having a formation illustrated in
Next, the change processing unit 20 replaces the description indicating access to the network-side memory 1201 in the CPU program 12 with a description indicating access to the CPU-side memory 1103 (step S14). Specifically, the program replacement unit 23 changes the description indicating access to the network-side memory 1201 in the CPU program 12 to the description indicating access to a region of the CPU-side memory 1103 associated with the region indicated by the above description on the basis of the memory allocation setting information 111 updated by the memory allocation unit 22. When the program replacement unit 23 performs a replacement process on the basis of the memory allocation setting information 111-1 illustrated in
As described above, the program creation support device 1 according to the present embodiment extracts a description indicating access to the network-side memory 1201 from the CPU program 12, allocates an unused region of the CPU-side memory 1103 to a region indicated by the extracted description to generate or update the memory allocation setting information 111 indicating to which region of the network-side memory 1201 each of regions where data is updated by the refresh function is allocated. Furthermore, the program creation support device 1 replaces the description indicating access to the network-side memory 1201 in the CPU program 12 with the description indicating access to the CPU-side memory 1103 on the basis of the memory allocation setting information 111. As a result, the user who is the worker who creates the CPU program 12 does not need to perform the work of creating and updating the memory allocation setting information 111, and thus her or his work load of creating the program is reduced. In addition, the user no longer needs to perform programming with the content of the memory allocation setting information 111 in mind.
The change processing unit 30 of the program creation support device 1a includes a network configuration extraction unit 31, a memory allocation unit 32, a program extraction unit 33, and a program replacement unit 34. The program extraction unit 33 and the program replacement unit 34 perform processes similar to those performed by the program extraction unit 21 and the program replacement unit 23 of the program creation support device 1 according to the first embodiment, respectively. Similarly to the program creation support device 1 according to the first embodiment, the program creation support device 1a can be implemented by the hardware illustrated in
The network configuration extraction unit 31 is an information acquisition unit. The network configuration extraction unit 31 extracts information on a designated region of the network-side memory 1201 that can be referred to by the CPU unit 1100 from the network configuration setting information 112. The said designated region is a region in which a duplicate of stored data can be transferred to the network-side memory 1201 by the refresh function. The information on the designated region of the network-side memory 1201 that can be referred to by the CPU unit 1100 is set as information having a configuration that indicates which region of the network-side memory 1201 can be used as a storage region with which device name.
The memory allocation unit 32 updates the memory allocation setting information 111 similarly to the memory allocation unit 22 of the program creation support device 1 according to the first embodiment, but the content of a process to be executed in the update operation is partially different therebetween. The memory allocation unit 32 updates the memory allocation setting information 111 on the basis of the information extracted by the network configuration extraction unit 31.
When starting the operation, the change processing unit 30 extracts information on a region of the network-side memory 1201 that can be referred to by the CPU unit 1100 from the network configuration setting information 112 (step S21). The process of step S21 is performed by the network configuration extraction unit 31. The region of the network-side memory 1201 that can be referred to by the CPU unit 1100 corresponds to the above-described designated region. The region of the network-side memory 1201 that can be referred to by the CPU unit 1100 is a region ensured as a region for storing data such as a measurement value required by the CPU unit 1100 when the network unit 1200 acquires the data. The region of the network-side memory 1201 that can be referred to by the CPU unit 1100 is set by the user before starting programming of the CPU program 12, or during the programming.
Next, the change processing unit 30 allocates the CPU-side memory 1103 to the network-side memory 1201 corresponding to the information extracted in step S21 (step S22). Specifically, the memory allocation unit 32 performs a memory allocation process of allocating a region of the CPU-side memory 1103 to a region of the network-side memory 1201 indicated by the information extracted by the network configuration extraction unit 31. It is assumed that the region of the CPU-side memory 1103 that can be allocated to the network-side memory 1201 is designated in advance by the user or designated in advance by a manufacturer. In step S22, the memory allocation unit 32 selects an unallocated region from the designated range of the CPU-side memory 1103 and performs allocation accordingly.
Next, the change processing unit 30 updates the memory allocation setting information 111 (step S23). Specifically, the memory allocation unit 32 reflects a result of the memory allocation process of step S22 in the memory allocation setting information 111.
Next, the change processing unit 30 extracts a part where access to the network-side memory 1201 is described from the CPU program 12 (step S24). The process of step S24 is similar to the process of step S11 described in the first embodiment, which is performed by the program extraction unit 33.
Next, the change processing unit 30 replaces a description indicating access to the network-side memory 1201 in the CPU program 12 with a description indicating access to the CPU-side memory 1103 (step S25). The process of step S25 is similar to the process of step S14 described in the first embodiment, which is performed by the program replacement unit 34. When the program replacement unit 34 performs a replacement process on the basis of the memory allocation setting information 111-2 illustrated in
As described above, the program creation support device 1a according to the present embodiment generates or updates the memory allocation setting information 111 on the basis of the information on a region of the network-side memory 1201 that can be referred to by the CPU unit 1100, the information being included in the network configuration setting information 112 of the CPU parameter 11. Furthermore, the program creation support device 1a replaces the description indicating access to the network-side memory 1201 in the CPU program 12 with the description indicating access to the CPU-side memory 1103 on the basis of the memory allocation setting information 111. The program creation support device 1a according to the present embodiment can achieve advantageous effects similar to those of the program creation support device 1 according to the first embodiment.
The configurations described in the embodiments above are merely examples of the content of the present invention, and can each be combined with other publicly known techniques and partially omitted and/or modified without departing from the scope of the present invention.
The description has been given in each embodiment based on the assumption that the PLC 1000 has the configuration illustrated in
1, 1a program creation support device; 10 storage unit; 11, 1102 CPU parameter; 12, 1101 CPU program; 20, 30 change processing unit; 21, 33 program extraction unit; 22, 32 memory allocation unit; 23, 34 program replacement unit; 31 network configuration extraction unit; 111, 111-1, 111-2, 1121 memory allocation setting information; 112, 1122 network configuration setting information; 121, 122, 123 program block; 1000 PLC; 1100 CPU unit; 1103 CPU-side memory; 1200 network unit; 1201 network-side memory; 1300 base unit.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/JP2019/016329 | 4/16/2019 | WO | 00 |