RSLogix5000 Controlling Data Types

Schnider

Member
Join Date
Aug 2016
Location
Perth
Posts
15
Hello,

It my first post here!

I have been programming on Schneider PLC for the last few years and am now doing some work with RSLogix. RSLogix is testing my patience because it seems to think it knows how to do things better than I do.

I am trying to write some equations in ST that use variables of different data types. I understand that RSLogix handles the casting of these variables behind the scenes, but I want to ensure the casting is done in a specific order. How do most people handle this?

EXAMPLE:
iScn - INT
iTmK - REAL
e - REAL
K - REAL

K := e**(iScn / iTmK);

How do I ensure iScn is cast as a REAL? Alternatively, the PLC could cast iTmK as an INT and then cast the solution as a REAL before computing the exponent?


Cheers
 
Schnider,

When you create a tag in RsLogix5000 you assign its datatype during the creation of it. If I recall correctly it default to a DINT data type. All you have to do is select REAL from the "..." button or type in "REAL".

Or maybe I am misunderstanding what you are having difficulties with.

Regards,
Nathan
 
Giving this equation:

A := B oper C;

In my experience, the datatype of A decides how are casted B and C. If B and C are DINT, and B = 10 and C = 3, then

A := B / C;

You'll get 3.33333 in A. In your equation, you could try using an intermediate variable like:

AuxVar := iScn / iTmK;
K := e**AuxVar

where AuxVar is REAL.
 

Similar Topics

Hello everyone, Wondering if anybody can help me with this: I have a CompactLogix processor running a little robot cell. Every 200 cycles...
Replies
8
Views
175
Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
179
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
487
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,152
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
908
Back
Top Bottom