Beginner starting out need advices on creating library

AivisNewBie

Member
Join Date
Mar 2018
Location
None
Posts
9
Hello all,

The company that I worked for had their own libraries for process automation. I'd like to create my own library for automation (to get better understanding) so my question is what should I consider when creating function blocks for motors, valves, hydrochloride, PID controllers, Frequency converters and so on (what kind of function blocks I did not mention that are used frequently?).

For example FB_Motor:
what inputs/outputs are necessary like Statuses, command bytes, modes and so on,
should I make small delays before alarm is activated?
how to create good simulation mode?.
(these are some questions that bothers me).

Or maybe there is some kind of standard that I could use to create them?

I want to make universal Function blocks so all advices I can get would help me a lot.

Thanks you all in advance :)
 
There is no generic answer to what is necessary. It depends on your requirements. Write down your requirements for one or more function blocks and make it. If it does not work as intended, if you need more or less functionality, then add/update.

You will not get it right first time. Don't worry about that. After a while the dust will settle down on one or more of your function blocks. If that means things are stable and robust, they do what you need them to do, all aspects tested and proved to work as intended, then you can move things into a library for re-use.

Speaking for myself: if a block gets too big, that is a sign that I am cramming too much into one box. So I tend to separate things as I go along. I have separate logic for buttons, then some for control, and yet again different blocks for display/presentation.

E.g. suppose I have a bunch of conveyor belts working together, one feeding onto another. The belts can be run both manually and automatically. I want a color lamp in the HMI for the motor, which is grey when off, blinking green/grey when starting/stopping, green when running, red on thermal failure (see what I'm doing here? I'm writing specs as I go).

Then I have one block for the manual button. One block for automatic operation (typically depending on other conveyors hence separate bool inputs for upstream and downstream). And a third block that takes things like status bits in and spits out a color variable for the lamp in the HMI.

Logic for both manual and automatic operation dictates that a you don't want one conveyor to drop product onto another that is not moving. So a conveyor keeps running as long as the upstream conveyor is running. A conveyor can only start once it's downstream conveyor is running. Only in case of things like thermal errors do you stop a conveyor right away. In that case all upstream items should also stop there and then, in order to avoid a mess. All downstream conveyors can shut down one after the other with a programmed shutdown time so they run empty. And so on. Write things down like this until they make good sense to you, sound logical and will also not fail under unusual circumstances. Think thermal error, E-stops. The latter should not be handled by your PLC code but your PLC code should recover from this in an orderly and graceful way.

Start writing down how you'd like things to operate. From there you move on to writing down all inputs and outputs. Note that this goes for your PLC as a whole as well as for anything you'd want to encapsulate into a function block. Specify the logic in detail. Then write code and test.

Remember: you will not get it right first time. Don't worry, repeat the above and improve until you are satisfied.

This can be useful to keep in mind:
http://accautomation.ca/five-steps-to-plc-program-development/
 
Hello all,

The company that I worked for had their own libraries for process automation. I'd like to create my own library for automation (to get better understanding) so my question is what should I consider when creating function blocks for motors, valves, hydrochloride, PID controllers, Frequency converters and so on (what kind of function blocks I did not mention that are used frequently?).

For example FB_Motor:
what inputs/outputs are necessary like Statuses, command bytes, modes and so on,
should I make small delays before alarm is activated?
how to create good simulation mode?.
(these are some questions that bothers me).

Or maybe there is some kind of standard that I could use to create them?

I want to make universal Function blocks so all advices I can get would help me a lot.

Thanks you all in advance :)

Which software? Depending on the software you're referring to there may be plenty of libraries that you can take ideas from and modify to suite your needs.

Siemens had so much that can give very good ideas and a lot of it is SCL that you may be able to migrate to other software.
Some of the links are for documentation but if you web search the document title you will get to the example projects or library.

Toolbox for HMI

Library of General Functions LGF

Example blocks for WinCC (These have lots of code for Motors,Valves,Analog,PID etc.

DMC- Siemens Open Library
 

Similar Topics

Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
1
Views
51
So to start off: I have no experience with PLC's, but I'm good at figuring stuff out, but I need some help to know if my PLC is just dead in the...
Replies
2
Views
99
Dear all, First of all thanks for letting me join this forum. I just need some help in one of my programming exercises. Being a beginner...
Replies
6
Views
548
I am trying to connect to SLC5/03 using an FTDI usb to rs232 with female to female converter at 1 end... however I can not connect to it ... the...
Replies
8
Views
1,182
First time poster here so long story short i built my own trainer at work so i could toy around with various things and test things and learn...
Replies
25
Views
2,057
Back
Top Bottom