Simulation program, simulation method, and simulation device
Patent Information
- Application Number
- JP2023520326
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2024-09-11
- Estimated Expiration
- 2042-10-18
AI Technical Summary
Existing simulation technologies for programmable controllers and FA systems face challenges in synchronizing simulation times, leading to inaccurate simulations when operations are restarted from a stopped state, which affects the cooperative operation verification of programmable controllers and FA systems.
A simulation program and device that synchronizes the simulation times of a programmable controller and FA system by generating a directed acyclic graph to determine the order of element operations, using a simulation unit to stop and restart simulations at predetermined cycles, ensuring accurate synchronization of simulation progress.
Ensures accurate simulation of programmable controllers and FA systems by synchronizing simulation times, allowing for consistent restarts and reducing discrepancies in simulation progress, thereby enhancing verification accuracy.
Abstract
Description
Technical Field
[0001] The present disclosure relates to a simulation program, a simulation method, and a simulation apparatus.
Background Art
[0002] In the field of FA (Factory Automation), various processes are realized by operating an FA system including various FA devices represented by sensors and servo motors according to instructions from a programmable controller. Regarding the operation of this type of FA system, it is desirable to perform simulation in advance to verify the presence or absence of defects, the program to be executed by the programmable controller, or the parameters to be set in the FA devices (for example, refer to Patent Document 1).
[0003] Patent Document 1 describes a virtual plant simulation system having a simulator that simulates a plant controlled by a controller. In the technology of Patent Document 1, when an operator performs a "stop" operation, the operation of the controller and the calculation of the simulator stop and maintain that state, and if there is an operation of "startup" or "execution", the controller and the simulator execute the content of the command corresponding to that operation.
Prior Art Documents
Patent Documents
[0004]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0005] In the technology described in Patent Document 1, the simulator performs a real-time simulation on the actual controller. However, if the operation of the programmable controller is also simulated, it becomes unnecessary to prepare an actual programmable controller, and the collaborative operation of the programmable controller and the FA system connected to it can be verified at an earlier stage.
[0006] Here, rather than simulating the programmable controller and the FA system together, it is preferable to simulate the programmable controller separately from the FA system simulation, from the standpoint of reducing the burden of simulation software development and ensuring future scalability. However, even when running the programmable controller simulation and the FA system simulation in parallel, the simulation times for both may not be the same when a stop operation is performed. In other words, the simulation may stop while operations up to different times have been simulated. Therefore, when restarting the simulation from a stopped state, the progress of the simulation may differ, and there is a risk that an accurate simulation of the programmable controller and the FA system cannot be performed.
[0007] This disclosure is made in view of the above circumstances and aims to enable accurate simulation of programmable controllers and FA systems. [Means for solving the problem]
[0008] To achieve the above objective, the simulation program of this disclosure functions as a computer that simulates the operation of a programmable controller and a system that operates according to the output from the programmable controller, by acquiring an executable program run by the programmable controller to generate output from the programmable controller and system configuration information indicating the configuration of the system, and by operating the virtual system with virtual output obtained by having the executable program run by the virtual controller, while synchronizing the first simulation time of the virtual controller corresponding to the programmable controller and the second simulation time of the virtual system configured based on the system configuration information at predetermined intervals. The virtual system has multiple components, each containing at least two input and output terminals, and each element of the virtual system corresponding to the input or output terminal of each of the multiple components is connected to other elements and performs at least one of receiving signals output from other elements and transmitting signals to other elements, and has a state that changes based on the signal received from other elements, and the system configuration information includes the multiple elements, the connection relationships of the multiple elements, and information about the state of each element, including dependencies indicating that the state of the output terminals depends on the state of the input terminals, and the simulation means generates a directed acyclic graph of the multiple elements based on the system configuration information, determines the order of each element by performing a topological sort of the generated directed acyclic graph, and simulates the change in the state of each element in the determined order, The acquisition means acquires a stop instruction to stop the simulation by the simulation means, and when the simulation means acquires the stop instruction from the acquisition means, it stops the simulation of the operation of the virtual controller and virtual system at a predetermined periodic timing that synchronizes the first simulation time and the second simulation time. [Effects of the Invention]
[0009] According to this disclosure, the simulation means stops simulating the operation at a timing that synchronizes the first simulation time and the second simulation time. This allows the simulation to be restarted with the progress of the programmable controller and system operation simulations equal. Therefore, accurate simulation of the programmable controller and FA system can be performed. [Brief explanation of the drawing]
[0010] [Figure 1] Diagram showing the configuration of the simulation device according to the embodiment. [Figure 2] A diagram showing the hardware configuration of the simulation device according to the embodiment. [Figure 3]A diagram showing an example of information set in the simulation device according to the embodiment. [Figure 4] A diagram showing an example of system configuration information according to the embodiment. [Figure 5] A diagram showing an example of controller configuration information according to the embodiment. [Figure 6] A diagram showing an example of the simulation progress according to the embodiment. [Figure 7] A diagram showing an example of time setting data according to the embodiment. [Figure 8] A diagram illustrating the synchronization of simulation time according to the embodiment. [Figure 9] A diagram showing an example of creating a directed acyclic graph according to the embodiment. [Figure 10] Flowchart showing virtual controller processing and virtual system processing according to the embodiment [Figure 11] This figure shows an example of how commands to execute or stop the simulation of the virtual controller and virtual system according to the embodiment are transmitted. [Modes for carrying out the invention]
[0011] The simulation device for executing the simulation program according to the embodiments of this disclosure will be described in detail below with reference to the drawings.
[0012] Embodiment. The simulation device 10 according to this embodiment, as shown in Figure 1, is a computer that simulates the operation of the programmable controller 21 and the FA system 22 in software, and is, for example, an industrial PC (Personal Computer), a tablet terminal, or a server device on a network.
[0013] The programmable controller 21 is connected to the FA system 22 via a communication line. The communication line may be a wiring for transmitting a current signal or a voltage signal, a signal line for transmitting serial data, or an industrial network. Alternatively, there may be one or a plurality of communication lines. The programmable controller 21 may be connected to the FA system 22 via a plurality of different types of communication lines.
[0014] The programmable controller 21 outputs a signal to the FA system 22 by executing an execution program 21a. The execution program 21a is, for example, a ladder program described in ladder language or a program described in other languages. The execution program 21a may be any program that describes the content and procedure of the signal to be output to the FA system 22.
[0015] The FA system 22 is a system that operates based on the signal output from the programmable controller 21. The FA system 22 has one or more elements. When the FA system 22 has a plurality of elements, these plurality of elements may be connected to each other. Specifically, each element may be connected to other elements to execute at least one of receiving a signal output from the other elements and transmitting a signal to the other elements. Also, each element has a state that changes based on the signal when receiving a signal from other elements.
[0016] As shown in FIG. 1, when the FA system 22 has elements 22a, 22b, 22c, and 22d, for example, element 22a is a lamp or LED (Light Emitting Diode) that lights up when receiving an ON signal from the programmable controller 21 and turns off when receiving an OFF signal. Also, element 22b may be a servo amplifier that drives servo motors which are elements 22c and 22d according to control commands from the programmable controller 21. The elements constituting the FA system 22 are not limited to the above examples, and may be logic operation elements, display devices represented by LEDs and LCDs (Liquid Crystal Displays), gauges, sensors, switches, actuators, servo amplifiers, servo motors, other motors, valves, robots, machine tools, and other FA devices. Also, any one of the elements may be another programmable controller different from the programmable controller 21, or the FA system 22 may not include other programmable controllers. By operating the FA system 22 according to the output from the programmable controller 21, various processes in a factory, such as production processes, processing processes, inspection processes, and monitoring processes, are realized.
[0017] Note that, as shown in FIG. 1, the FA system 22 further has elements 22b, 22c, and 22d that are connected to each other and an element 22a that is not connected to other elements. The FA system 22 may have a plurality of elements that are connected to the programmable controller 21 without being connected to other elements.
[0018] The simulation device 10 executes software to simulate the operation of the programmable controller 21 and FA system 22 based on the execution program 21a, without actually constructing the programmable controller 21 and FA system 22 as described above. To execute such software, the simulation device 10 has the hardware configuration shown in Figure 2. In detail, the simulation device 10 includes a processor 41, a main memory unit 42, an auxiliary memory unit 43, an input unit 44, an output unit 45, and a communication unit 46. The main memory unit 42, auxiliary memory unit 43, input unit 44, output unit 45, and communication unit 46 are all connected to the processor 41 via an internal bus 47.
[0019] The processor 41 includes a CPU (Central Processing Unit) as a processing circuit. The processor 41 executes the program P1 stored in the auxiliary storage unit 43 to realize various functions of the simulation device 10 and perform the processing described later.
[0020] The main memory unit 42 includes RAM (Random Access Memory). Program P1 is loaded into the main memory unit 42 from the auxiliary memory unit 43. The main memory unit 42 is then used as the working area for the processor 41. While Figure 2 shows a typical example of one program P1, there may be multiple programs P1. For example, in addition to program P1 corresponding to the simulation software, there may be execution programs... B There may be a program P1 that corresponds to an engineering tool for editing Gram 21a. Program P1 for simulation corresponds to an example of a simulation program.
[0021] The auxiliary storage unit 43 includes non-volatile memory such as EEPROM (Electrically Erasable Programmable Read-Only Memory) and HDD (Hard Disk Drive). In addition to program P1, the auxiliary storage unit 43 stores various data used in the processing of the processor 41. The auxiliary storage unit 43 supplies data to be used by the processor 41 according to the instructions of the processor 41, and stores the data supplied by the processor 41.
[0022] The input unit 44 includes input devices such as a keyboard and a pointing device. The input unit 44 acquires information input by the user of the simulation device 10 and notifies the processor 41 of the acquired information.
[0023] The output unit 45 includes output devices such as an LCD (Liquid Crystal Display) and a speaker. The output unit 45 presents various information to the user according to instructions from the processor 41.
[0024] The communication unit 46 has a network interface circuit for communicating with external devices. The communication unit 46 receives signals from the outside and outputs the information indicated by these signals to the processor 41. The communication unit 46 also transmits signals indicating the information output from the processor 41 to external devices.
[0025] The input unit 44 and output unit 45 correspond to the UI (User Interface) of the simulation device 10. However, the simulation device 10 may be connected to an external UI device via a communication unit 46, and may acquire and provide information to the user via the communication unit 46. If an external UI device is used as the UI of the simulation device 10 instead of the input unit 44 and output unit 45, the input unit 44 and output unit 45 may be omitted, and the communication unit 46 may perform the function of sending and receiving information for the UI.
[0026] Returning to Figure 1, the simulation device 10 has a functional configuration realized through the cooperation of the hardware configuration described above. In detail, the simulation device 10 includes an acquisition unit 11 that acquires various information, a display unit 12 that displays information related to the simulation to the user, a state data storage unit 13 that stores and saves state data indicating the state at a certain point in the ongoing simulation, and a simulation unit 14 that simulates the operation of the programmable controller 21 and FA system 22 by making the virtually constructed virtual controller 31 and virtual system 32 operate in the same way as the programmable controller 21 and FA system 22.
[0027] The acquisition unit 11 and the display unit 12 are realized by an input unit 44 and an output unit 45 as a UI, and a processor 41 that executes engineering tools. The simulation unit 14 is realized by a processor 41 that executes software for simulation. The simulation device 10 is an example of a simulation device that simulates the operation of a programmable controller and a system that operates according to the output from the programmable controller.
[0028] The acquisition unit 11 acquires the executable program 21a and system configuration information indicating the configuration of the FA system 22. In detail, the acquisition unit 11 may acquire the executable program 21a and system configuration information that are directly input by the user, or it may acquire them by reading the executable program 21a and system configuration information from an address of the auxiliary storage unit 43 specified by the user or from an external storage device. The executable program 21a is executed by the virtual controller 31, and the system configuration information is used to configure the virtual system 32. The acquisition unit 11 is an example of an acquisition means that acquires an executable program executed by the programmable controller to generate output from the programmable controller, and system configuration information indicating the configuration of the system.
[0029] Figure 3 shows an example screen for inputting system configuration information. As shown in the "Virtual System" section on the upper right of Figure 3, the user may input the elements that make up the FA system and the relationships between them by placing objects corresponding to the elements that constitute the FA system 22 and connecting the objects with lines. In this way, the virtual system 32 is configured as having connected elements, similar to the FA system 22.
[0030] In the example shown in Figure 3, signals are output to three lamps from the 2nd to 4th terminals of the "output unit block" corresponding to the output units that make up the virtual controller 31. The signal from the top lamp then passes through a NOT gate and is input to the 1st terminal of the "input unit block" corresponding to the input units that make up the virtual controller 31. In addition, the outputs of two switches are input to the 3rd and 5th terminals of the "input unit block," respectively. Furthermore, a signal is input to the cylinder from the 8th terminal of the "output unit block," and the signal from the cylinder is input to the 7th terminal of the "input unit block."
[0031] Here, the "output unit block" and "input unit block" are essentially components of the virtual controller 31 for sending and receiving signals to and from the outside, and not components of the virtual system 32, but are shown for convenience to clarify the connection between the elements of the virtual controller 31 and the virtual system 32. As can be seen from Figure 3, the FA system 22 is usually controlled by the programmable controller 21. Alternatively, a closed-loop system may be configured by feeding back the signals output from the FA system 22 to the programmable controller 21.
[0032] For details of the operation of the "cylinder" exemplified in Figure 3, the user may input the details using a subwindow that appears when the "cylinder" block is selected, or the user may specify a separate file containing the operation details. The operation details of the elements that constitute the FA system are information that shows how the state of the element changes based on the signals input to the element, and are included in the system configuration information. For example, if an ON signal is input to the cylinder, the cylinder position increases at a rate of 1 mm per second, and when it reaches the MAX position of 100 mm, it outputs an ON signal; this is the operation detail of the cylinder.
[0033] As illustrated in Figure 3, the acquisition unit 11 acquires system configuration information as shown in table format in Figure 4. Alternatively, the user may directly input the table shown in Figure 4 instead of the block diagram, or the simulation device 10 may acquire system configuration information in other formats. The system configuration information only needs to show multiple elements, the connection relationships between those elements, and information about the state of each element.
[0034] Furthermore, if the programmable controller 21 is a building block type PLC (Programmable Logic Controller) composed of multiple units combined, as shown in the virtual controller 31 in Figure 3, the acquisition unit 11 may acquire controller configuration information indicating the configuration of the programmable controller 21. The controller configuration information may be input by the user in the form of a block diagram, as shown in the "Virtual Controller" column on the upper left of Figure 3, or it may be input as controller configuration information in a table format, as shown in Figure 5.
[0035] Here, the controller configuration information in Figure 5 shows each unit mounted on the base unit and the mounting position of each unit on the base unit. The "execution unit" in Figure 5 is the unit that executes the execution program 21a and corresponds to the "CPU (Central Processing Unit)" in Figure 3. The "input unit" in Figure 5 corresponds to "IN" in Figure 3, and the "output unit" in Figure 5 corresponds to "OUT" in Figure 3. In addition, the programmable controller 21 and the virtual controller 31 may have other units as units mounted on the base unit. Other units include, for example, a motion unit connected to a servo amplifier for high-precision control of the servo system, a servo amplifier unit, a network unit for communication via a network, an input / output unit having at least one of the functions of the input unit and output unit described above, and a remote input / output unit. If information regarding the wiring of these units is required when configuring the programmable controller 21, the controller configuration information includes this wiring information.
[0036] The display unit 12 displays the simulation results, for example, as shown in Figure 6. The simulation results include the progress of the simulation, that is, the progress up to a certain point in the ongoing simulation. In the example in Figure 6, the breakpoints of the executable program 21a being executed by the virtual controller 31 are indicated by triangular objects 51, and the memory addresses of the virtual controller 31 and the values stored at those addresses are shown in association with each other. The memory values change as the executable program 21a is executed, and the virtual controller 31 uses these values to generate virtual output to the virtual system 32. By observing these values, the user can confirm whether the processing defined in the executable program 21a is being executed correctly.
[0037] Furthermore, as shown in the upper right of Figure 6, the display unit 12 displays the state of each element constituting the virtual system 32 as the simulation progresses, showing how it changes. For example, the on and off states of lamps and the ON and OFF states of switches are displayed in a way that can be distinguished and visually identified by the user, and a string of characters indicating the cylinder position is also displayed.
[0038] During the simulation, user instructions regarding the simulation's progress are acquired by the acquisition unit 11 via a screen displayed by the display unit 12. Instructions regarding the simulation's progress include, for example, a stop instruction to temporarily halt the simulation, a restart instruction to resume a stopped simulation, operations on the virtual controller 31, and operations on elements of the virtual system 32 that accept user input. A stop instruction is input by the user selecting button B2, as exemplified in Figure 6, and a restart instruction is input by selecting button B1. Operations on the virtual controller 31 may be input by operating on a component included in the object displayed as shown in Figure 3, or by directly overwriting the value shown in Figure 6. Operations on elements of the virtual system 32 may be input by operating on an object displayed as shown in Figure 6.
[0039] Furthermore, the acquisition unit 11 acquires two instructions related to the simulation: a save instruction, which is entered by selecting button B3 as exemplified in Figure 6, to save the current simulation state, and a read instruction, which is entered by selecting button B4, to read the saved simulation state. The save instruction is entered, for example, at the end of the user's workday, before leaving their desk, before the simulation device 10 is powered off, or when it is determined that the current state of an ongoing simulation is necessary for later verification. The read instruction is entered, for example, at the start of the user's workday, after sitting down, after the simulation device 10 is powered on, or when verifying past simulation progress, in order to restore the simulation state. If a start instruction is entered following a read instruction, the simulation will resume from the read state.
[0040] The state data storage unit 13 is primarily implemented by the auxiliary storage unit 43. The state data storage unit 13 stores state data indicating the state of the simulation when a save instruction is input. The state data indicates the state of the execution program 21a, the breakpoints of the execution program 21a, the data stored in the memory of the virtual controller 31, the controller configuration information, the system configuration information, and the state of each element of the virtual system 32. The state data is also read from the state data storage unit 13 when a read instruction is input. The state data is then used to resume the simulation from where it left off. The state data storage unit 13 is an example of a state data storage means that stores state data indicating the state of the virtual controller and virtual system when the simulation of their operation has stopped in accordance with a stop instruction.
[0041] The simulation unit 14 simulates the execution of the execution program 21a by the programmable controller 21 by having the virtual controller 31 execute the execution program 21a. The simulation unit 14 configures the virtual controller 31 based on the execution program 21a and controller configuration information, and configures the virtual system 32 based on system configuration information.
[0042] The simulation unit 14 has a memory that stores data similar to that of the programmable controller 21, and sequentially executes the instructions contained in the execution program 21a. The simulation unit 14 also measures the simulation time that elapses along with the execution of the instructions. This simulation time is a virtual time that elapses when the virtual controller 31 executes the execution program 21a, similar to the real time that elapses when the programmable controller 21 executes the execution program 21a. For example, the simulation unit 14 measures the simulation time based on time setting data as shown in Figure 7. The time setting data shows the correspondence between the instructions contained in the execution program 21a and the time length required for the execution of those instructions. The time setting data may be acquired together with the execution program 21a by the acquisition unit 11.
[0043] Furthermore, the simulation time only needs to be linked to the execution of instructions in the same way as real time, but does not necessarily have to correspond to real time. Also, the timing of the simulation time and the simulation of instruction execution may be performed simultaneously, or one may start from the other. For example, the simulation unit 14 may advance the simulation time and then execute instructions that can be executed within the advanced simulation time, or it may execute an instruction and then advance the simulation time by the length corresponding to that instruction.
[0044] Furthermore, the simulation unit 14 simulates the operation of the virtual system 32. Specifically, the simulation unit 14 simulates the state changes of the elements of the virtual system 32 based on the virtual output from the virtual controller 31, which changes as a result of the execution of the execution program 21a. The simulation unit 14 measures the simulation time of the virtual system 32 separately from the simulation time of the virtual controller 31. In other words, the simulation unit 14 executes the simulation of the virtual controller 31 and the simulation of the virtual system 32 separately. However, the simulation unit 14 synchronizes the simulation time of the virtual controller 31 and the simulation time of the virtual system 32 at predetermined intervals.
[0045] Figure 8 schematically illustrates the synchronization of simulation times. In the example in Figure 8, the simulation times of the virtual controller 31 and the virtual system 32 are synchronized at 6 μsec intervals. Specifically, when a simulation time equal to the period has elapsed since the last synchronization, the virtual controller 31 and the virtual system 32 wait if the other has not also elapsed the same amount of time; otherwise, they start the simulation for the next period.
[0046] Within each cycle, the simulation times of the virtual controller 31 and the virtual system 32 are not necessarily synchronized. However, since the upper limit of the synchronization error between the simulation times of the virtual controller 31 and the virtual system 32 is equal to the length of this cycle, the simulation times will synchronize with a reasonably small error.
[0047] Furthermore, the simulation unit 14 simulates the operation of each element constituting the virtual system 32. However, if the elements are connected to each other, the order in which they are affected by the virtual output from the virtual controller 31 is determined. For this reason, the simulation unit 14 determines the order of the elements based on the system configuration information and simulates the changes in the state of the elements in the determined order. In detail, the simulation unit 14 generates a directed acyclic graph of multiple elements and determines the order of the elements by performing a topological sort on the generated directed acyclic graph. The connection relationships between elements with defined inputs and outputs are essentially equivalent to information in a directed acyclic graph, and such a graph can be generated using generally known methods. Also, since a generally known method can be used for topological sorting of a given directed acyclic graph, the details are omitted.
[0048] In the example shown in Figure 8, the operations of elements H, I, and J constituting the virtual system 32 are simulated in this order. Alternatively, as shown in Figure 8 for periods of 0 to 6 μsec, the operation of element H within that period may be simulated first, followed by the operation of element I within that period, and then the operation of element J within that period. Furthermore, as shown in Figure 8 for periods of 6 to 12 μsec, the simulation of element I's operation and the simulation of element J's operation may be performed in parallel, as long as the order of these elements I and J is maintained. That is, when focusing on a certain simulation time, for example 8 μsec, it is sufficient that the simulation of element I, which is affected first by the output from the virtual controller 31, is performed before the simulation of element J.
[0049] As shown in Figure 9, if at least one of the inputs and outputs of the components constituting the virtual system 32 is two or more, a directed acyclic graph can be created with each terminal of the component as a node, and the order of the terminals to be simulated for input and output signals can be determined. In other words, the order of the terminals of the components corresponding to elements can be determined. Alternatively, each terminal can be treated as an element constituting the virtual system 32.
[0050] Furthermore, in the example in Figure 9, although a loop occurs in the relationships between components, no loop occurs when terminal dependencies are considered, and a directed acyclic graph can be created. However, loops may occur in the connection relationships between elements or in the dependencies between terminals. In this case, a directed acyclic graph can be created by assigning order to each element or terminal starting from the element or terminal connected to the virtual controller 31, and treating the node immediately preceding the connection relationship that causes the loop as the endpoint. For example, if terminal J2 in Figure 9 depends not only on terminal J3 but also on terminal J1, the dependency relationship between terminal J1 and terminal J2 can be omitted when creating the graph.
[0051] The simulation time of the virtual controller 31 corresponds to an example of the first simulation time, and the simulation time of the virtual system 32 corresponds to an example of the second simulation time. The simulation unit 14 corresponds to an example of a simulation means that simulates the operation of a programmable controller and a system by synchronizing the first simulation time of the virtual controller corresponding to the programmable controller and the second simulation time of the virtual system configured based on system configuration information at predetermined intervals, and by operating the virtual system using the virtual output obtained by executing an execution program on the virtual controller.
[0052] Next, the processes performed by the simulation device 10 will be explained using Figures 10 and 11. Figure 10 schematically shows the procedures for the virtual controller processing performed by the virtual controller 31 and the virtual system processing performed by the virtual system 32.
[0053] In the virtual controller processing, the virtual controller 31 simulates the execution of the execution program 21a within the current cycle (step S11). Specifically, the simulation unit 14 refers to the time setting data and sequentially executes instructions that can be executed within a predetermined cycle of length from among the processes defined in the execution program 21a.
[0054] Once the execution of an instruction within a cycle is complete, the virtual controller 31 notifies the virtual system 32 that the simulation of the operation for that cycle is complete (step S12). In Figure 10, this notification is indicated by a dashed arrow.
[0055] Then, the virtual controller 31 determines whether the simulation time of the virtual system 32 is equal to the end time of the current cycle (step S13). Specifically, the virtual controller 31 determines whether it has received notification from the virtual system 32 that the simulation is complete.
[0056] If the determination in step S13 is negative (step S13; No), the determination in step S13 is repeated, and the virtual controller 31 waits without continuing the execution of the executable program 21a until the determination is affirmed. On the other hand, if the determination in step S13 is affirmed (step S13; Yes), the virtual controller 31 moves to the next cycle (step S14) and returns to step S11, thereby continuing the execution of the executable program 21a.
[0057] In virtual system processing, the virtual system 32 simulates the operation of each element within the current period (step S21). Specifically, the simulation unit 14 refers to the system configuration information and, based on the output from the virtual controller 31, simulates the state changes of each element within a predetermined period of length.
[0058] Once the simulation is complete, the virtual system 32 notifies the virtual controller 31 that the simulation of the operation for that period is complete (step S22). In Figure 10, this notification is indicated by a dashed-dotted arrow.
[0059] Then, the virtual system 32 determines whether the simulation time of the virtual controller 31 is equal to the end time of the current cycle (step S23). Specifically, the virtual system 32 determines whether it has received notification from the virtual controller 31 that the simulation is complete.
[0060] If the determination in step S23 is negative (step S23; No), the determination in step S23 is repeated, and the virtual system 32 waits without continuing the simulation until the determination is affirmed. On the other hand, if the determination in step S23 is affirmed (step S23; Yes), the virtual system 32 continues the simulation by moving to the next cycle (step S24) and returning to step S21.
[0061] Figure 11 shows the procedure for processing performed by the virtual controller 31 and the virtual system 32 when an instruction indicating whether or not to run the simulation is input. Specifically, the virtual controller 31 determines whether or not there is an instruction indicating whether or not to run the simulation (step S31). Here, an instruction indicating whether or not to run the simulation means an instruction to start, restart, or stop the simulation.
[0062] If it is determined that there is no instruction (step S31; No), the virtual controller 31 repeats the determination in step S31. On the other hand, if it is determined that there is an instruction (step S31; Yes), the virtual controller 31 determines whether the simulation time is synchronized (step S32). If it is determined that the simulation time is not synchronized (step S32; No), the virtual controller 31 repeats the determination in step S32 and waits until the simulation time is synchronized. On the other hand, if it is determined that the simulation time is synchronized (step S32; Yes), the virtual controller 31 executes or stops the execution program 21a according to the instruction (step S33). As a result, when the virtual controller 31 is running a simulation and there is an instruction to stop it, it will run the simulation until it is synchronized. Note that if the virtual controller 31 has stopped the simulation and there is an instruction to start or restart the simulation in step S31, step S32 may be omitted.
[0063] Next, the virtual controller 31 sends the instruction that was determined to have been input in step S31 to the virtual system 32 (step S34).
[0064] The virtual system 32 receives the transmitted instruction (step S35) and executes or stops the simulation according to this instruction (step S36). If a stop instruction is given, both the virtual controller 31 and the virtual system 32 will stop the simulation at the timing when the simulation times are synchronized. The processes shown in Figures 10 and 11 represent an example of a simulation method executed by the simulation device.
[0065] As explained above, the simulation unit 14 stops simulating the operation at the timing when the simulation time of the virtual controller 31 and the simulation time of the virtual system 32 are synchronized. This allows the simulation to be restarted with the progress of the programmable controller 21 and the FA system 22 being equal. 22 It is possible to perform accurate simulations.
[0066] Furthermore, the simulation unit 14 determines the order of the elements of the virtual system 32 based on the system configuration information and simulates the changes in the state of each element in the determined order. This enables accurate simulation of the virtual system 32. Specifically, the simulation unit 14 generates a directed acyclic graph of multiple elements and determines the order of each element by performing a topological sort of the generated directed acyclic graph. Since efficient algorithms are known for generating directed acyclic graphs and performing topological sorting, the simulation unit 14 can determine the order of each element at high speed.
[0067] Furthermore, the state data storage unit 13 in this embodiment stores state data indicating the state of the virtual controller 31 and the virtual system 32. When a read instruction for state data is received by the acquisition unit 11, the simulation unit 14 restores the state of the virtual controller 31 and the virtual system 32 as indicated by the state data. Here, the state of the virtual controller 31 refers to the value of the simulation time at a specific simulation time, the execution state of the execution program 21a, the controller configuration information, and the state of the virtual units constituting the virtual controller 31. The execution state of the execution program 21a includes the execution program 21a, its breakpoints, and the data to be set in the execution program 21a. The state of the virtual system 32 refers to the system configuration information, the simulation time of the virtual system 32, and the state of each element. This eliminates the need to run the simulation again from the beginning, allowing it to be resumed from where it left off. For example, the simulation can be started from a state where the device startup sequence of the programmable controller 21 and the FA system 22 has been completed, thereby shortening the time required to analyze the simulation results.
[0068] While embodiments of this disclosure have been described above, this disclosure is not limited to the embodiments described above.
[0069] For example, the explanation has focused on an example in which a virtual controller 31 is configured based on controller configuration information that shows the configuration of a building block type programmable controller 21, but it is not limited to this. For example, the virtual controller 31 may be configured by providing the simulation device 10 with information indicating the model number of an integrally configured programmable controller 21 having the functions of the multiple units described above, instead of the controller configuration information.
[0070] Furthermore, while an example has been described in which the virtual controller 31 and virtual system 32 notify the other party that the simulation of operations within a period of simulation time has been completed, the system is not limited to this example. The virtual controller 31 and virtual system 32 may also notify the other party of the simulation time they are timing and determine whether the simulation time notified by the other party is equal to the end time of the period.
[0071] Furthermore, the functions of the simulation device 10 can be realized by dedicated hardware or by a standard computer system.
[0072] For example, a device that performs the above-described processing can be configured by distributing a program P1 executed by the processor 41 on a computer-readable, non-temporary recording medium, and then installing the program P1 on a computer. Examples of such recording media include flexible disks, CD-ROMs (Compact Disc Read-Only Memory), DVDs (Digital Versatile Discs), and MOs (Magneto-Optical Discs).
[0073] Alternatively, program P1 may be stored on a disk drive of a server device on a communication network such as the Internet, and then downloaded to a computer, for example, by superimposing it onto a carrier wave.
[0074] Furthermore, the above process can also be achieved by launching and executing program P1 while transferring it over a communication network.
[0075] Furthermore, the above-described process can also be achieved by having all or part of program P1 run on a server device, while the computer sends and receives information about the process via a communication network during program execution.
[0076] Furthermore, if the above-mentioned functions are implemented by the OS (Operating System) or through collaboration between the OS and the application, only the parts other than the OS may be stored and distributed on a medium, or they may be downloaded to a computer.
[0077] Furthermore, the means for realizing the functions of the simulation device 10 are not limited to software; some or all of them may be realized by dedicated hardware, including circuits.
[0078] This disclosure allows for various embodiments and modifications without departing from the broad spirit and scope of this disclosure. Furthermore, the embodiments described above are for illustrative purposes only and do not limit the scope of this disclosure. In other words, the scope of this disclosure is indicated by the claims, not by the embodiments. Various modifications made within the scope of the claims and the equivalent significance of the disclosure are considered to be within the scope of this disclosure. [Industrial applicability]
[0079] This disclosure is suitable for simulating the operation of programmable controllers and their peripheral devices. [Explanation of Symbols]
[0080] 10 Simulation device, 11 Acquisition unit, 12 Display unit, 13 State data storage unit, 14 Simulation unit, 21 Programmable controller, 21a Execution program, 22 FA system, 22a, 22b, 22c, 22d Elements, 31 Virtual controller, 32 Virtual system, 41 Processor, 42 Main memory unit, 43 Auxiliary memory unit, 44 Input unit, 45 Output unit, 46 Communication unit, 47 Internal bus, 51 Object, B1~B4 Buttons, P1 Program.
Claims
1. A computer that simulates the operation of a programmable controller and a system that operates according to an output from the programmable controller, an acquisition means for acquiring an execution program to be executed by the programmable controller to generate the output from the programmable controller, and system configuration information indicating a configuration of the system; a simulation means for simulating operations of the programmable controller and the system by operating the virtual system using a virtual output obtained by causing the virtual controller to execute the execution program while synchronizing a first simulation time of a virtual controller corresponding to the programmable controller with a second simulation time of a virtual system configured based on the system configuration information at predetermined intervals; Functioning as a the acquiring means acquires a stop instruction for stopping the simulation by the simulation means, when the stop instruction is acquired by the acquisition means, the simulation means stops the simulation of operations by the virtual controller and the virtual system at the timing of the predetermined period that synchronizes the first simulation time and the second simulation time. Simulation program.
2. The virtual system has a plurality of elements, Each of the elements is connected to another element, and performs at least one of receiving a signal output from the other element and transmitting a signal to the other element, and has a state that changes based on a signal received from the other element, the system configuration information indicates the plurality of elements, a connection relationship between the plurality of elements, and information regarding a state of each of the elements; the simulation means determines an order of each of the elements based on the system configuration information, and simulates a change in state of each of the elements in the determined order; The simulation program according to claim 1 .
3. the simulation means generates a directed acyclic graph of the plurality of elements based on the system configuration information, and executes a topological sort of the generated directed acyclic graph to determine an order of the elements; The simulation program according to claim 2.
4. The system is controlled by the programmable controller and does not include other programmable controllers. The simulation program according to any one of claims 1 to 3.
5. The computer, and further functioning as a status data storage means for storing status data indicating a status of the virtual controller and the virtual system in which the simulation of the operation has been stopped in accordance with the stop instruction, the acquiring means acquires a read instruction indicating to read the status data, When the read instruction is acquired by the acquisition means, the simulation means reads the status data from the status data storage means and restores states of the virtual controller and the virtual system indicated by the read status data. The simulation program according to any one of claims 1 to 3.
6. the programmable controller has a base unit, and as a unit mounted on the base unit, an execution unit that executes the execution program, and at least one of a network unit for communicating via a network, a motion unit for controlling a servo system, and an input / output unit for transmitting and receiving signals to and from the outside, the acquiring means acquires controller configuration information indicating the units included in the programmable controller; The simulation means configures the virtual controller based on the controller configuration information, the status data includes the controller configuration information and the system configuration information; The simulation program according to claim 5.
7. The state data indicates, as a state of the virtual controller, an execution state of the execution program and a state of a virtual unit corresponding to a unit indicated by the controller configuration information. The simulation program according to claim 6.
8. A simulation method executed by a simulation device that simulates the operation of a programmable controller and a system that operates according to an output from the programmable controller, comprising: an acquisition means for acquiring an execution program executed by the programmable controller to generate the output from the programmable controller and system configuration information indicating a configuration of the system; a simulation means for simulating operations of the programmable controller and the system by operating the virtual system using a virtual output obtained by causing the virtual controller to execute the execution program while synchronizing a first simulation time of a virtual controller corresponding to the programmable controller with a second simulation time of a virtual system configured based on the system configuration information at predetermined intervals; the acquiring means acquires a stop instruction for stopping the simulation by the simulation means, when the stop instruction is acquired by the acquisition means, the simulation means stops the simulation of the operations by the virtual controller and the virtual system at the timing of the predetermined period that synchronizes the first simulation time and the second simulation time. The simulation method includes:
9. A simulation device that simulates the operation of a programmable controller and a system that operates in accordance with an output from the programmable controller, comprising: an acquisition means for acquiring an execution program to be executed by the programmable controller to generate the output from the programmable controller, and system configuration information indicating a configuration of the system; a simulation means for simulating operations of the programmable controller and the system by operating the virtual system using a virtual output obtained by causing the virtual controller to execute the execution program while synchronizing a first simulation time of a virtual controller corresponding to the programmable controller with a second simulation time of a virtual system configured based on the system configuration information at predetermined intervals; Equipped with the acquiring means acquires a stop instruction for stopping the simulation by the simulation means, when the stop instruction is acquired by the acquisition means, the simulation means stops the simulation of operations by the virtual controller and the virtual system at the timing of the predetermined period that synchronizes the first simulation time and the second simulation time. Simulation device.
