PAC SIM file storage

Nick wrote the following tip as a blog entry a while back, but Mary and I felt that would be more logical to have it as a forum entry.
That way, if you have any PAC Sim tips and tricks you can add them on here and we can build up a nice ‘goto’ source of simulator tips in the once place (along with all your other Opto 22 tips and tricks).

Take it away Nick…

[B] 		PAC SIM file storage 		 		 		[[IMG]http://www.opto22.com/community/images/cms/edit_small.png[/IMG]](http://www.opto22.com/community/blog_post.php?do=editblog&b=21) 		 		 	[/B]


[[B]nick stephens[/B]](http://www.opto22.com/community/member.php?722-nick-stephens) 	 

on February 9th, 2011 at 01:16 PM (1128 Views)

	 		 			 				[INDENT] 					Hi,

Here is something that i only recently discovered. It may be documented somewhere, but i haven’t tried to find it. I sometimes use pac sim to ‘rough out’ a program to ensure that it works ok. I had a program that was logging data from a remote port. anyway the program needed to store data in a file so i just wrote it as if it was on the controller. Later i thought about if it actually wrote the file somewhere and after a search I found the file located in c:\windows\system32\optocom. i tried reading in files and it worked too.
So if you are doing any PAC SIM work that requires reading and writing of files, put them in the optocom directory and you’ll be sweet!! [/INDENT]

Hi Nick,

I’m glad you’re enjoying our comm handles, even while running on PAC Sim. (Especially since at least a little bit of that file comm handle control engine code was written by me.) I’ve even used that “feature” to build binary data files using a PAC Control strategy written just for that purpose, even when I had full C++ and Visual Basic compilers at my fingertips: writing a quick strategy was simpler and faster!

You’ll also find one other comm handle type (tcp) that works in PAC Sim too. If you open a comm handle type or try some other command that’s NOT built-in to PAC Sim, you’ll get a -36 returned (indicating “feature not implemented”).

Those of you who use persistent variables will find those “persist” in PAC Sim too.

-OptoMary

If a PAC Datalogger object is used in a Qlarity Foundry project and run in the simulation mode, will it write to a file on the development PC? Are there any examples for use of Datalogger?

JackRabbit
Interesting. Have you tried to do a search on yr PC for any files that may have been edited or altered during the time the simulation has been running? My thought process would run like this… If you could simulate the Qlarity project and log some data and view it, then stop the simulation and run it again, if that data is still there to view then it must either write it to a file or keep it in memory. If you simulate, shut down Qlarity and start it up again, simulate and can still view the data then I reckon its a near definite that it writes a file. You should just be able to search for edited files and find the file. What the file has inside is another story… but at least you got your answer!
Mary, i too have used PAC SIM to do a task that I could have done by compiling a program in Visual Basic. I thought about it and decided it’s was just as easy to program PAC Control and use PAC SIM to do the same thing (don’t you just love communication handles?)!!

I hope this helps
Nick

BTW: i found the file that document details what PAC SIM can do. look under C:\WINDOWS\system32\OptoCom and open readme_Sim.pdf. this gives all the goods on PAC SIM.

Portable Document Format (PDF) is a good file format used to present documents and it is able to include the text, fonts, graphics, and other information.