Sign in to follow this  
Followers 0
Colin Carpenter

IEC Scale with Parameters Function Block

10 posts in this topic

In the Allen Bradley world there's a very useful function called SCP (Scale with parameters.) This means that you can chuck a value into it, tell the command the start and end points of the two straight lines and the command will convert the value into the new value. This is very useful when scaling analogue input bits into engineering units for use in the calculations in the programme. For example, using a Q68ADI analogue input set at high resolution and at 0-20 ma range, a 0-100C temperature probe would scale 2,400 - 12,000 bits. Without the function, it's a case of solving two simultaneous equations to calculate the m and c values of the straight line equation y = mx+c. In my case, I tend to cheat and use the analogue scaling box in E-designer to give me the m and c values (called the gain and offset ), but it's a bit of a fiddle and often I have to guess the ranges of the instruments that the customer is supplying then go through the process again when commissioning. It would be really handy if this function existed in the Mitsubishi world, but I've never seen it or heard of it. Has anyone else? Cheers

Share this post


Link to post
Share on other sites
Colin, In the IEC language such function is absent. The built-in functions SCL & SCL2 are supported in FX3U / G and QnU series. For QnU it's so starting with a specific version. However, I absolutely do not see the slightest difficulty to write a simple function yourself. Once I did that and then used in all programs for the Q series.

Share this post


Link to post
Share on other sites
Check out this. I've used these Functions for many years.... http://www.beijer.no/web/web_aut_no.nsf/docsbycodename/filearchive?OpenDocument&mylink=/web/BExFilePileAUT.nsf/fm.be.searchframe?Openform&Lang=NO&DocID=737481A1FD1419ADC12576240030C1F3

Share this post


Link to post
Share on other sites
It is an interesting function. I have used it as an inspiration source for my Scale function, that I have written yesterday. It is written in ST because I wanted to play a little, but it is a very undocumented programming language and I have struggled to write it for couple hours (just 3 lines)!! It ocupies less memory then the beijer function from the link above I have attached the function. Probably it could be optimized, if you have any observation... SCALE.zip Edited by WKla

Share this post


Link to post
Share on other sites
Dear WKla, Sorry, but your function block is not a full analogue for ScaleINT from Beijer, because in your FB the scaling points are presented in DINT format, and the output value is not limited. Here the FB for Q/QnU series only. Steps: 27 steps, System variables: 4 word. FB_SCL_Q.rar Edited by Inntele

Share this post


Link to post
Share on other sites
Hello, Thank you for observation, Inntele. I didn't intend to implement the same functionality as the Beijer function has. I usually call the function using constant for scaling point (that is why I used DINT) and I didn't found the reason to limit the output. Why the output is limited anyway? Thanks.

Share this post


Link to post
Share on other sites
Hi Wkla, This is because you have already set the input and output signal range (the bounded line). If you want to scale the output value would be outside the specified limit, then, respectively, and the boundaries of line should be expanded. This feature is a stripped-down analog of SCL function, which is usually applied for scaling of digitized analog signals. Also I would like to add that in practice to work with scale function in which the boundaries rigid and were set as constants is very uncomfortable. Much better when these limits set as variables then their values can always be reconfigured from the operator panel or the SCADA level. For example, you need to replace the sensor and new sensor, which is available, has greater range, and if the boundaries are set as constants, you should change and then reload program.

Share this post


Link to post
Share on other sites
I created one for GX Works2. I can post this weekend.

Share this post


Link to post
Share on other sites
Thanks for all the replies. I figured I'd dust off my old function block skills and see if I could come up with a FB that worked, and it seems fine, so have attached it with a screenshot showing four instances running on a Q02 PLC. All the inputs on the left are integers (should be self explanatory from the screenshot) and there are two outputs - one an integer and one real number for proper calculations. The FB uses real numbers to solve the two simultaneous equations, calculates m and c and uses them to scale the output depending on the input. Hope you like it. Cheers FB_SCP_INT.zip Edited by Colin Carpenter

Share this post


Link to post
Share on other sites
Pretty much identical to what I wrote, from the looks. I didn't look at the actual code yet.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0