best practices
Ali Ibrahim
Automation and digitalization engineer at Siemens/// DCS,PLCs, HMI , classic control
this is my favorite programming structure in programming small applications ( it would increase the flexibility and the readability of the code )
note : since we all in quarantine lets share our best programming structures and best practices
lets start :
- first i usually create a function called i/o to acquire all i/os
if i have many i/os i would make another function for analog i/os ( i assign each hardware of input address to a memory space and each memory space to an output hardware address )
i created a datablock containing all output and input memory spaces
- i would divide my program into Functions blocks based on the functionality if its complex enough or sections
and then if i needed an fc inside that FB i would call it
i never assign FCs to parts that would not be called again
so i make sure always to make my FCs reusable and generic
( so i could use it in other applications and programs utilizing libraries in tia protal , also before editing any fc i usually make versions of it using types in tia portal )
- i never use any global memories i always make use of the variable table above
-- i never make the time of the timers Fixed even if its fixed on the application
i prefer to make it changeable even in the programming environment so i would put the timer datablock and time as inputs of the functions
-- i never use global memory bits in FCs or addresses of the hardware i/o ( see the first point ) in the my programs i only use the assigned memory space to each
#automation #siemens #smartindustry #automationsolutions #programming #industrialcontrol
#controlpanel #controlsystem #industrialautomation #plc #plcprogramming