News:

SMF - Just Installed!

Main Menu

Machines Simulator driven by an external app?

Started by maiorfi, October 31, 2012, 07:06:29 AM

Previous topic - Next topic

maiorfi

Hi.

I'd like to drive Machines Simulator by an external application. Looking at (amazing) Derrick "bridged" solutions, it seems that the only "easy" way is to actually use an OPC Server between driving app and EasyPLC, while this one runs Easy PLC CPU unit connected to 2 I/O modules, one connected to Machines Simulator driver and the other one connected to OPC Server.

Despite it could work for an arbitrary external app, we'd like to use a solution targeting directly Machines Simulator.

We saw that Machine Simulator I/O driver works by mean of memory mapped files, an easy while powerful inter-process communication mean that could be easily used by external apps, too.

Is Machines Simulator memory mapped protocol public or shareable in any way?

Should I, on the contrary, try to use Machines Simulator I/O driver .NET assembly instead of low-level (memory mapped files) channel?

Thanks!

EasyPLC_Master

Hello Maiorfi;

I'm sorry to tell you that Machines Simulator must be managed only by EasyPLC.
By company strategy we decided that user's special needs can be programmed with EasyPLC (you can create your owns drivers).
These are managed by VirtualPLC CPU program (a very light software with a high performance) that is the only one that can manage the Machines Simulator communication protocol.
Take note that in the Simatic S7 EasyPLC program (or in the RSLogix) EasyPLC uses a very simple script programs that interface these two programs with Machines Simulator in a very easy way:


//   Main Sequence: Main_Sequence_1

for(int f=0; f<16; f++)
{
   //Write Step7 (or RSLogix) Inputs with Machines Simulator Input states:
   WriteOutput(0, f, ReadInput(1, f));
   
   //Write Machines Simulator Outputs with Step7 Outpus (or RSLogix Outputs)
   WriteOutput(1, f, ReadInput(0, f));
   
}



Regards.

Derrick

maiorfi,
you are correct in the 2 best ways to link an app to EasyPLC.

If you want to use an external program to connect to EasyPLC, the easiest way might be to just follow the guide on how to create a driver and use the .net file for access.  I thought about updating an old visual basic simulation I wrote to link to EasyPLC this way.  But it would just be a coding experiment.  The 3D machines EasyPLC uses are much more interactive then my little simulation.

The other way is to just use OPC in your application and use the OPC driver with EasyPLC.  This has the added benefit of not making your application an EasyPLC only app.

Of course, you still need to create a small EasyPLC script to link the I/O between the 2 apps, like EasyPLC_Master mentions.  If you use OPC, I would set the Virtual PLC CPU to a speed of 1ms.  Setting it to fastest is overkill, when OPC can't go faster then 1ms.

It does seem tempting to try to use the Machines Simulator I/O driver .NET, but I'm guessing it won't work in that fashion due to copy protection.  I never tried.

I could provide you with my C# OPC driver code if needed, to help with both EasyPLC .net and OPC usage.

take care,
Derrick

Derrick

BTW, you only need to run EasyPLC to setup the I/O linking script and set the Virtual PLC CPU properties.  Once your script has been compiled and sent to the Virtual PLC CPU, you no longer need to run EasyPLC.

You just need to run your app, Machines Simulator and Virtual PLC CPU.  Set the Virtual PLC CPU to Run and you have connected your app to Machines Simulator.