Musicman44

Capture snapshot of I/O data for simulation

20 posts in this topic

Is there a way to capture a snapshot of ALL inputs in cx-programmer to then be saved and used on a simulation to recreate a real life scenario?

Share this post


Link to post
Share on other sites

Double click on 'memory' -> double click 'cio' -> Click on Binary and then monitor

This way you can see all your physical inputs and outputs

Annotation 2020-05-06 150752.png

Annotation 2020-05-19 100159.png

Annotation binary and monitor.png

Annotation memory.png

Share this post


Link to post
Share on other sites

Ok thanks for that. That answers a part of my question but still doesn’t answer how to save this information and then simulate this using cx- simulator.

Share this post


Link to post
Share on other sites

You can also save the information. In memory tab, Go to File----> select save to file--> click OK---> select the location to save--> click save. The file will be automatically saved as (.mem) file. To open the same file Go to Memory---> File--->select Open File in drop down menu, select the saved file & click Open

1 person likes this

Share this post


Link to post
Share on other sites

This is not what he is asking for.  He is asking if there is a way to save I/O patterns so that his program can be tested in simulation mode with somewhat realistic interaction with the I/O.  

I think what you are looking for is I/O Conditions (and the replay menu).  You may have to manually create a file, but it looks like it does what you want.  Look in the CX-Simulator manual that is installed with CX-Simulator in the start menu.  Check out section 3-9-5.  

Share this post


Link to post
Share on other sites

Yeah I’ve been trying to figure that out but I’m just not getting it yet. I wish there was a video walkthrough about it showing the file used for the replay.

Share this post


Link to post
Share on other sites

I am able to save the memory file like you said but when I try to click transfer to PLC, it is grayed out.

Share this post


Link to post
Share on other sites
16 hours ago, Musicman44 said:

I am able to save the memory file like you said but when I try to click transfer to PLC, it is grayed out.

Of course you need to be online with the controller and depending upon the memory area, you may need to be in program mode. 

Share this post


Link to post
Share on other sites

Okay the problem was that I was in monitor mode. I changed to program mode and am able to transfer the memory. Everything looks great!... until I go back to monitor mode. Then all of the inputs go back to the way they were. Why is this happening?

Share this post


Link to post
Share on other sites

If you are in the CIO area, it is not retentive, so when you go into run / monitor, it is all reset to zeros.  The memory tool will not do what you want.  I/O Conditions and replay is the only possibility.

Share this post


Link to post
Share on other sites

Ok so how do I save my CIO data from a running PLC, save that to a I/O Conditions file, and use the replay on a simulation?

Edited by Musicman44

Share this post


Link to post
Share on other sites

Add code to running PLC using the XFER instruction to copy the CIO areas you wish to keep to unused DM location.

Save the D memory to file.

In simulation mode add a oneshot instruction to XFER the saved D memory back to CIO.

Share this post


Link to post
Share on other sites

Yes, that would work, but the conditions would not change as he I believe he is asking. This would only create a static configuration of the IO. Personally, I would just turn them on manually as I need them.  I don't know how to create the file for the playback mode.  

Share this post


Link to post
Share on other sites

Yes I agree. IMHO turning on/off I/O manually is BEST approach. Just trying offer a possible solution.

Share this post


Link to post
Share on other sites

I only need it to be a static configuration that can be manipulated manually. How do I write the XFER instruction to load the .mem file into cio like you suggested?

Edited by Musicman44

Share this post


Link to post
Share on other sites

You can not Transfer to PLC... while Monitoring. Temporarily disable Monitoring.

Share this post


Link to post
Share on other sites

I understand that but 2 things:

The video appears to show that you can transfer while in monitor mode and

When I go to monitor mode and transfer the data, it is reset back to original when I go back into monitor mode.

Share this post


Link to post
Share on other sites

You need to do what Bits N Bytes suggested.  Store the values that you want to write in DM words that you are not using in your code.  Then on the first scan, use the XFER function. 

So, lets say you want to set up the CIO channels 0-3.  Lets say you are not using D500 - D503.  Load up D500 - D503 using the memory tool.  They will not reset to 0 when you go from program to monitor.  Or, you could set your code up to load up D500 - D503 on the first scan of the program.  When you are simulating and you want to change the I/O to the test values, just turn on the TransferNow bit (manually or with some part of your code) in the image below:

xferexample.png.1c67ed02410f721d4a95a81b

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now