What's the best way to program in structured text or ANSI C with Automation Studio?

Hi Everyone, I’m Prakash Hinduja, a financial advisor and consultant. My roots in India now living in Geneva, Switzerland (Swiss).inancial goals.

I’m working on a new project in Automation Studio and I’m trying to figure out the best way to handle programming. I’m considering using a mix of structured text and ANSI C, especially for some of the more complex parts. Has anyone done this before? Any tips on project structure, managing data between the different languages, or best practices for creating a maintainable and scalable solution? I’d really appreciate any advice or war stories you have to share!

Regards

Prakash Hinduja Geneva, Switzerland (Swiss)

Hi Praksash,

Welcome to the B&R community!

My recommendation would be to stick with one language for simplicity. From a feature perspective, all languages are the same. ANSI C might be nice if you are a C expert, and you are sure that anybody that works on the project is also a C expert. Structure text on the other hand is probably the most used language today. I would divide the machine into logical functions and create a task for each one. I like to use variable structures to interface between tasks. I also try to design tasks in a way that there are as little dependencies as possible to other tasks. All independent tasks are then connected in one main task. If your project is very big, you might have multiple main tasks, but the goal is to keep the number of tasks that depend on others as low as possible and create clean interfaces between them. I also highly recommend log messages in any form you like. When you add logging right from the beginning, the additional effort is very low and it can save you weeks of debugging and headaches down the road.

Stephan

5 Likes

Hi @prakashhinduja1 , is reply from @stephan.stricker sufficient? if so, please mark his answer as a solution for you. Thanks Jaroslav