Hi Peter, well simulating a real PLC generally would totally be out of scope of PLC4X. I was more referring to the code to extract the program from a PLC and to deploy it somewhere (like in a simulator or in case of Codesys you could run the runtime on a test-server). But there are simulators out there. Usually, the PLC vendors have them. Unfortunately, they usually are not for free. But I know Siemens has various simulators to which you could deploy your program and then interact with PLC4X.
Well, I guess you would need to find out how to make a software like TIA portal believe your application is a S7 PLC and then need to implement the parts of the protocol, that we haven't implemented yet. As S7 doesn't have a public spec, you'll have to reverse engineer most of it. And another problem will be that newer S7 devices use S7comm ... to convince TIA that you're a real device, you would probably need to implement the S7comm protocol, which opens a whole new box of worms. All in all, I think the industry would need such a solution, but I also think they haven't realized it yet and therefore are not willing to pay the money for it. Perhaps I'll try this concept out as part of my job, but that will probably only have an effect on the types of PLCs that we use, and I have no idea, if I'll get the time needed to do it. Chris -----Original Message----- From: Peter Saxton <pe...@petersaxton.uk> Sent: Dienstag, 3. Mai 2022 13:30 To: dev@plc4x.apache.org Subject: RE: RE: Scope of using PLC4x as simulated driver for PLC projects Hi Chris, Thanks for the clarification. So potentially PLC4X could drive the tests but would leave the problem of simulating a PLC as outstanding. One other approach I have head about is putting the PLC in a completely virtual environment and then manipulating it by setting values on the Virtual Machine. I don't have much information on this approach just this blog post https://www.plcnext-community.net/makersblog/painful-memories-of-plc-simulations/ You mentioned that you had though about working on something like this. What would be the rough shape of your solution? Apart from industry resistance what would be the hardest thing to get through in this project. In my area there is a desire to embrace testing and CI probably not CD that seems bold. At least the right noises are being made. We can see how it plays out. Peter On 2022/05/03 08:17:49 Christofer Dutz wrote: > Hi Peter, > > Well, if you want to use PLC4X to communicate with the real or the simulated > PLC in order to execute various test-scenarios: then probably PLC4X is what > you're looking for. > > If you want to extract the PLC program from one PLC and write that to a > simulator, then unfortunately PLC4X doesn't have that focus and therefore > doesn't support this. > > The programming part of automation engineering is what every PLC vendor > implements separately. Sometimes even one vendor has multiple ways of doing > that for their different products. > > However, PLC4X does have the parts that you probably need to implement such a > feature, however it will certainly require reverse engineering for almost > every type of PLC. > > I had been thinking about starting to work on something like what you > describe. However, my idea would have been to simulate just enough of a PLC > for the engineering tool to accept it and to have the Engineering tool deploy > the new program to that instead of a real PLC. This component would then pass > the program to a CI/CD pipeline, just as you describe it. However, I knew > this would be a lot of work and considering how well the industry accepted my > offers in the past, I decided that I won't do this, as it's not worth it. > They haven't even started thinking of concepts like continuous-integration or > continuous-delivery or even testing. > > Chris > > > > -----Original Message----- > From: Peter Saxton <pe...@petersaxton.uk> > Sent: Dienstag, 3. Mai 2022 09:35 > To: dev@plc4x.apache.org > Subject: Scope of using PLC4x as simulated driver for PLC projects > > Hi everyone. > > First post here so apologies if my terminology is a bit off, I'm from a web > software background. > > If I want to write behavior tests for a PLC project that already exists, is > PLC4x the right tool for that job or would there be something better? > > Ideally I would be able to export a whole PLC project from a machine. Start > that exported project in a soft/simulated PLC environment and run a suite of > tests against the PLC logic. Ideally at no point would I be reliant on having > the correct hardware. > > Reading through the PLC4x pages I found the section on "Testing (or using > PLC4X without a PLC)". As I understand this this is for testing software > outside the PLC but simulating a PLC. I would like to go the other way round > and test a PLC project by simulating the outside world. I also looked at the > section on the simulated protocol, but again I think this is for simulating > values for a plc4x client. > > Essentially we'd like to write a test saying "when input 1 & 2 are on the > output A is live", and check that the PLC code was going to do this. > > I'm interested in testing against Siemens PLC projects, however for getting > started I would happily run a proof of concept on something like OpenPLC if > that was easier without hardware. > > Cheers, Peter >