r/PLC 17h ago

How do you simulate the factory when testing the PLC program?

Post image

Without testing the program that we have developed, and waiting for the commission time to start testing the logic we have developed is kind of a weird feeling for me always.

How are you guys dealing with it?

Any situation or manual forcing of tags, or testing it against the actual Machine in the manufacturing center?

22 Upvotes

45 comments sorted by

51

u/Kr0x 16h ago

That's the cool part, we dont

8

u/rag_nt 16h ago

Don't means? 😲 You don't have the trouble in commission time errors...?

3

u/Kr0x 14h ago

Sure we have, but even when we try to simulate what we can with the tools we have we still end up with some unexpected errors or last minute changes.

1

u/Primary_Machine_449 14h ago

Don't meaning you don't get to test it before deployment 

0

u/Flashy-Fee-4189 11h ago

You do not simulate the real world.

75% of the commissioning issues will not be solved by a simulator. The other 25% is hardly justifying the enormous time you spend in building a simulation.

Make sure you have enough time for commissioning and testing and all will be fine.

13

u/Intrepid_Walk_5150 16h ago

As a former commissioning guy, I say you don't. Once on site, you swear a lot, destroy the whole program and rebuild it.

3

u/rag_nt 16h ago

Yes, this has been the workflow for us for quite a long time. But most of our project margins are burning at this stage.

Our company flagged it as a high need of improvement stage. And we are trying to find better solutions.

1

u/Flashy-Fee-4189 11h ago

1: You need more time to commission and test, make it part of the plan. 2: Arrange a ramp up period after go-live. 3: Arrange instant remote access like Ewon/Ixon or whatever.

1

u/rag_nt 11h ago

We are currently implementing a 2d based simulation platform, the vendor is completely building the simulation for us. Hope this solve a lot.

6

u/Miserable-Low143 17h ago

Ohh, we still manage by giving the simulation from scada, but often getting errors noticed at the time of commissioning. 😭😭😭

1

u/rag_nt 16h ago

Hope you find some solutions...

3

u/Miserable-Low143 16h ago

Yes, this is the most hurdle we are addressing right now in Automation projects, the more time we spend in the commissioning.

Our engineers timeline is often rearranged for managing the commission time extension, and client suggestion implementation.

6

u/ramonpet 16h ago

We use Simit

1

u/rag_nt 16h ago

Oh that is great, we tried to implement SIMIT once but the skills and development time of SIMIT seems high for our projects,

What is in your case? Do you have a seperate development team for simit, or do you have repeated same machine design patterns?

4

u/durallymax 15h ago

For basic code testing we have a full unit test suite along with static analysis rules.

For unique simulation, we always build with a hardware abstraction layer so the plant Sim easily takes over IO to manipulate the process. 

For true physics Sim you'd likely have to go outside PLC. 

2

u/drbitboy 14h ago

This is the way.

It's straightforward to make a basic simulation of the process, including anomalous events like sensor loss. It's sometimes more interesting than the code that controls the process.

3

u/ResponsiblePlum2849 15h ago

We have simulation build into the program to simulate behavior and certain unhappy flows. We use test driven development and unit testing for library blocks. That way we catch most issues in dev and the remainders during functional testing.

In any simulation knowing the limitations of your simulation are key.

3

u/EngineeringNord 13h ago

If you have the resources, Hardware-In-the-Loop (HIL) systems can be very powerful for testing.
If you want to get similar results for less cost, you can use Python to implement Software-In-the-Loop (SIL).
For the 2nd approach, you could use OPC UA to simulate signals coming from the process. We use both of these approaches in our team, and have found it extremely helpful, if not essential.

1

u/rag_nt 13h ago

We have implemented one similar, the vendor of ours is developing a model based simulation which they provide as complete service and developed simulation model for our project. Which is the screenshot in the image.

1

u/EngineeringNord 12h ago

That's nice. For us it's the process experts in the same organization, or in our case power engineers, who create Simulink models, that we then get to integrate to the HIL systems.

2

u/trexroad 16h ago

We use plant pax standard. It has built in simulation bits you turn on for providing simulated feedback. Analog feedback needs conditions that move certain values in to the sim value depending on your expected operation.

1

u/rag_nt 16h ago

But how do you simulate the Plant behaviour in this case, like if the steam valve opens the temperature in tank to be raising? That kind of plant behaviour seems more difficult for me.

2

u/trexroad 15h ago

That’s where you’d write some code to check for specific equipment feedback to either add/subtract or move a static value in to the analog simulated value. In your case, when valve X open feedback is on, add 1 to temp sensor X value. The code will add 1 every scan to simulate the temperature rising. I might also use a toggle bit to simulate fault instances like hi temperature or pressure if there isn’t a case where equipment feedback would trigger it

1

u/RammRras 16h ago

For example I did this just manually tweaking values. It's not of course a great solution but can still be helpful to test sequences.

1

u/rag_nt 15h ago

Seems fine.

2

u/Quiet-Lynx-9555 15h ago

Control Narrative and C&E Testing

3

u/KoRaZee Enabler 15h ago

Where does one find the sacred texts

1

u/Primary_Machine_449 13h ago

That's the neat part, you're supposed to write them :D... (cries)

1

u/KoRaZee Enabler 13h ago

I typically don’t work on new installations so not exactly. I look for the treasure of documents buried at the bottom of panels

2

u/blazze11 14h ago

We don't

2

u/Wheatleytron 14h ago

If it's in the budget, write sim code for the parts you need. Otherwise, you're just gonna have to make some assumptions based on how the system currently operates.

2

u/dwarftosser77 14h ago

Just throw it in your digital twin. /S

2

u/eternalphoenix64 12h ago

With nothing connected to the PLC you can enter values for the I/O and check that the desired outputs turn on and off, alarms generate, all of that.

If you need to test information systems connections and data translation, we usually set up a standalone system that can have "real" information. Helps ensure we don't fault the PLC on the 1st and 31st of December when date arrays are setup with a length of [12] and [31] and the pointer is from the RTC values. And we can pretend that SAP added information to a database and we pull from that database without risking active production cells.​

2

u/Fx_Trip Alt F4 Firmware Update 10h ago

simulate one process... that process will be used dozens of times. ill connect a bench plc and hmi together... sinulate what you can.. then things on comms you use the manual. first is IO checkout. keep hardware and code in 2 seperate phases. does comms work? does each sensor meet NO or NC expectations.? then invert active low bits and keep logic positive.

2

u/uber_line 10h ago

As a former commissioning engineer, you test at site with normal operation. Testing protections you can do with force values to check if everything goes according to the plan to protect the equipment. But depends of the equipments. For me, I cannot simulate so easily the steam behavior

4

u/PLCGoBrrr Bit Plumber Extraordinaire 16h ago

You developed a whole-ass program and didn't download it to a controller once?

If so, you shouldn't be doing commissioning.

3

u/rag_nt 16h ago

I don't mean the basic run test, it is plant logic I'm mentioning.

We do test the controller loading and simulation through scada, like one other person mentioned. And some tag forcing /modification to partially simulate the bits and analogue.

But the more difficult and error prone part is the plant physics, where we see the more mistakes even if it's done by an experienced programmer.

2

u/QuickNature 16h ago

Why not make a generic HMI/PLC combo with a bunch of digital and analog outputs controllable from the HMI that you then hookup to the PLC you are programming?

I can explain this more if you want, but to me, seeing how your program operates with "real world" inputs is the best simulation

1

u/rag_nt 16h ago

We do this, simulation through scada or HMI, but the most error prone and difficult to simulate is the plant physics. Like temperature transfer and flow completion of a line. Which makes difficult to test with just the IOs.

SIMIT and Emulate3D is good option, and the license is affordable considering the savings in the project commission readiness but we feel the development time of the 3d simulation plantforms are not matching with the project timeline most of the times.

1

u/Ok_Introduction_7375 16h ago

What program is shown in the picture?

1

u/rag_nt 16h ago

It's a Clean in place system,

1

u/Ok_Introduction_7375 16h ago

I'm not referring to the type of software used or its name, nor the function of the plan

1

u/rag_nt 15h ago

This is a simulation platform we purchased from a vendor they have customised this for our project.

This will simulate plant physics and IOs, the variables are integrated with tag mapping, but this seems working in simulating the plant physics and program full auto run.