TIA Portal Analog output

Nan

Member
Join Date
Jul 2015
Location
louisville
Posts
126
Hi,

I am using Siemens cpu315-2 and AO 4X12BIT. Now, I am trying to send the analog output to a heating unit to do the remote set point( degree C). The Heating unit only accept 4-20ma. I am wondering how can I write this in STL.
The output address start at q288, an example will be appreciated!

Thank you all!
 
Is there a reason why you would want to do it in STL?
I find it a lot easier to do in ladder.
Are you using TIA or just step7 ?
 
No edit button:/
I think you need to import the library FC106 to scale it. If you search the manual or the siemens site for FC106 you will find some examples.

In TIA you may be able to use the norm_x and scale_x, I know you can for the 1200 series, not sure if it will also work for the 300 series.
 
In TIA you may be able to use the norm_x and scale_x, I know you can for the 1200 series, not sure if it will also work for the 300 series.

Norm_X & Scale_X are just for the newer 1200/1500. Even in Portal, the 300/400 need to use Scale & Unscale, one of which should be the FC106 you mention.

Agree though, that trying to do it in STL would just complicate things.
 
Sorry, only just noticed the topic said Tia portal. Got more time to write a full reply now. Make sure your hardware AO is set to 4-20mA.

Insert the unscale block in your cyclic interrupt (probably OB32, OB33, OB34 or OB35).

Input the values as needed then convert to STL. Here is a picture that may help:
EBukUZA

http://imgur.com/EBukUZA

FC106.jpg
 
Last edited:
If you want to use STL you will have to scale your value. Assuming you have 0..100% (ControllerOutput) as a float.

L ControllerOutput
L 276.48
*R
RND
T Output
 
You could use pure STL and add and multiply yourself. I wouldn't recommend it due to it being difficult for others to maintain in the future.

I doubt the speed increase will be noticeable. Anyway here are a few other things you should look at in case you want to do it that way.


First off, you are looking for the function of a straight line when 5529.6 (4ma) is for example 20 degrees and 27648 (20mA) is you max temp for example 300 degrees.

Use basic math or the mathisfun website to find the a and b.

Then use the code boneless posted where 276.48 is "a". To add b, load it into the accumulator using L and then add it by using +R.

RND is to round(convert) from a real to an integer and the T is to transfer the result to the ouput.
 
The above is only true if your output is set to 0..20 mA in your hardware, there int=0 will be 0 mA and int=27648/5 4 mA.

In my code I assume it is set to 4..20 mA, where int=0 is 4 mA.
 
I am currently attempting to transfer the analogue output to a heating unit to do the remote set point using a Siemens cpu315-2 and AO 4X12BIT ( degree C). Only 4-20ma are accepted by the heating unit. I'm trying to figure out how to write this in STL.
It would be helpful to see an example as the output address starts at q288.
 
In English I believe it is QWxxx or PQW if direct access is required (not wait for Update of image to real I/O
for example:
Take the setpoint i.e. 80.0 Deg C
Up Scale it to what ever is the 12 or 14 bit analogue raw value for example 12450 (lets call this tag Raw_A_Out
L Raw_A_Out
T QW128
 
Code:
L     #setpoint                         //Setpoint  0 - 100% [DINT]
L     L#16384                             //Resolution of AO card
*D                                         //Multiply AR1 with AR2
L      L#100                                // Load 100
/D                                           //Divide
T     PQW228                          //Transfer to Output tag

Note, you will have to ensure that the setpoint is kept between the limits 0 - 100

Edit PQW could be represented as QW if you don't need the process image updating right away.
 
Last edited:

Similar Topics

Dear all Iam using three load cells connected in parallel to calibrate the weight of a product but in don't have a weighting module in my...
Replies
4
Views
3,487
Hi Guys, I just want to scale an analog input (current ) from 4-20mA to an Integer value (0-100) in the PLC (S7-1500) also (300) using tia Portal...
Replies
18
Views
18,328
Hi Guys, I just want to scale an analog output to 0-10V from an Integer value in the PLC (S7-1500) using Portal version 13. I assume it hinges...
Replies
6
Views
8,693
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
247
Hi guys , I'm new with Allen Bradley, but I have experience with Tia portal (s7 1200 ,s7 1500) I want to convert my project from Tia portal to...
Replies
2
Views
203
Back
Top Bottom