====== MP STUDIO 2 Phase 8 · Simulation ====== [[products:mp_studio:simulation|한국어]] | **English** Simulation runs the ladder on a virtual device on your PC, without real hardware. You can turn inputs on and off yourself and watch the outputs, timers and counters, which makes it a good way to check a program before downloading it to the device. {{ :en-us_products:mp_studio:sim-running-marked.svg?1200 |Figure 1. The screen during simulation }} **① The simulation bar**, **② a purple dashed frame** and **③ the current values in the Inspector** are shown. The device pill shows **Monitoring · SIM**. ===== Starting and Stopping ===== - Click **Simulate** in the top band or select **Run → Simulation**. - **The simulation bar** appears above the canvas, and a purple dashed frame is shown around the canvas. - To stop, click **Stop simulation** at the right end of the bar, or click **Simulate** again. Simulation and device monitoring cannot run at the same time. Turning on simulation while monitoring turns monitoring off. ===== Simulation Bar ===== {{ :en-us_products:mp_studio:sim-bar-marked.svg?1200 |Figure 2. The simulation bar }} * **① State:** shows **Running**, **Paused** or **Halted**, and the reason it stopped. * **② Pause and Resume:** pauses or resumes scanning. * **③ Step one scan:** runs a single scan while paused. * **④ Restart from scan 0:** clears the memory and starts again from the beginning. * **⑤ SCAN:** the number of scans run, the virtual elapsed time and the scans per second. * **⑥ Inputs:** input point chips. Click a chip to turn that input on or off. Inputs not used in the ladder are dimmed. * **⑦ Stop simulation** If the program has such cells, a **virtual sensor cell(s)** button and a **cell(s) not simulated** button, each with the number of cells, appear at the right end of the bar. Click one to go to those cells in turn. ===== Changing Inputs ===== * Click an input chip on the bar. * Or click a ''P'' input contact cell in the ladder, or put the cursor on it and press ''Space''. {{ :en-us_products:mp_studio:sim-input-toggle-marked.svg?1100 |Figure 3. Input P0 turned on, switching output P32 on }} In Figure 3, **① the P0 chip** was turned on, so **② the P0 contact** carries power, and output ''P32'' turned on, so **③ the P32 self-holding contact** has also changed to the power-flow color. Output coils and wires are shown in the same power-flow color as in monitoring, and the **Current value** in the Inspector shows the value. Input chips that are forced also show a force mark. ===== Virtual Sensors ===== Function cells that read signals from outside the device, such as ''ADC'' and ''NTEMP'', work as **virtual sensors** and are shown with a dotted pattern. Click the **virtual sensor cell(s)** button on the bar to go to those cells in turn. Click a virtual sensor cell, or put the cursor on it in the canvas and press ''Enter'', to open the **Write Value to Memory** window for the OUT address of that function. The value you enter is reflected in the ladder from the next scan. {{ :en-us_products:mp_studio:sim-virtual-sensor.png?930 |Figure 4. Virtual sensor cells (ADC and NTEMP) with a dotted pattern, and the virtual sensor button at the right end of the bar }} The value write window works as described in [[:en-us_products:mp_studio:monitoring#write_value_to_memory|Phase 7 · Write Value to Memory]]. ===== What Simulation Cannot Check ===== The simulator calculates the behavior of the device on your PC. Check the following on the real device: * The actual responses of serial communication (Modbus, CNET, IBUS and so on) and external devices (I2C, LCD, RTC and so on) * The actual I/O wiring and scan time * Cells the simulator cannot run (shown with diagonal hatching). Those rows are skipped and the rest is run. {{ :en-us_products:mp_studio:sim-unsupported.png?930 |Figure 5. A cell marked as not simulated (FDPWM), and the not-simulated button at the right end of the bar }} If JMP repeats endlessly and a scan never finishes, the simulation halts and the reason is shown. ===== Related Pages ===== * [[:en-us_products:mp_studio:monitoring|Phase 7 · Monitoring and the Data Table]] * [[:en-us_products:mp_studio:functions|Phase 4 · Functions]] [[:en-us_products:mp_studio|← Back to the MP STUDIO 2 User Manual]]