RSLogix 5000, can i MOV a word?

Join Date
Jul 2021
Location
perth
Posts
185
Hi, I would like to move a word to display wind direction. For example: NW, or SE, or ESE in RSLogix 5000, not panelview.

I have a wind speed meter, (anemometer) which sends wind direction to my PLC using a 4-20mA signal which is translated in RSLogix as a number between -32767 and +32767.

I will attach an image of the logic i plan am attempting to write.

An example, if wind direction value is LES than 6000 and GRT than 1450, than move the word ENE into a bit, so i can see that the wind direction is currently ENE.

Any ideas? Thank you

word test.png
 
So, your description and your example are showing two different things. You describe moving a value into a bit but show a REAL moving into DINT. Bits are 1 and 0 only.

If you want a bit, then create a BOOL named ENE.

If you want Letters (ENE) then create a string tag for each wind direction and COP that into your display String.

If you're using Studio 5000 version 32 or higher you can MOV a constant 'ESE' into your display string. Just put ' around your letters.
 
Thank you for the response. I attempted to use string, but generated errors. Suggestions? Which instruction block should i use to apply string?

word test.png
 
I would rescale the analog input to 0 to 15, either in the PLC code, or in the analog input module itself.

Then I could turn on the bit corresponding to the wind direction directly in a word like so :-

OTE Direction.[AnalogInputValue]


With Direction being an INT data-type.

Be sure to CLR Direction before the OTE, or you'll get multiple bits on at the same time.

EDIT : And make sure that the value can only be in the range 0 - 15 (Use LIM to test this)
 
Last edited:
Thank you again. I am almost there.

I followed advice RE COP and i was able to "move" a string from one tag into the value of my "display" tag, (ref image). I only know this because i have opened the Tag Monitor and confirmed the value was moved.

I would like to see the string that was moved. Is there any way of seeing it?

In this example, i have moved the string 'NW'. I would like to see 'NW' on the ladder. is there a block i can use to achieve this?

word test.png
 
I think your length would be 1. you're only moving 1 string value.

But if you want to see it in the ladder, just use an EQU to compare.

You can use [NOP] at the end of the rung. No operation. For viewing only.
 
(1)NWN should be NNW (North by NorthWest).

(2) May I suggest a another approach with a lot less code? Caveat: do not use this if you do not find it simple to understand.

Say 4mA (-32767) and 20mA (+32768) are both around compass angle 123° = -237°, and the raw counts increase clockwise with the compass ange. So North (0°) is 14.533mA (= 20mA - 123*15/360, or 10376 on the raw scale of [-32767:+32767]).

The conversion from raw to angle is (raw - 10376) * 360 / 65534, which yields a range of [-237:+123].

Each wind of the 16-wind compass rose comprises 22.5° (360° ÷ 16), with North = [-11.25°:+11.25°], NNE = [+11.25°:33.75°], etc.

-237° (123°) is in the ESE wind, between -258.75 (101.25) and -236.25° (123.75°), the E-ESE and ESE-SE boundaries, respectively. The middle of the ENE wind is -247.5° (112.5°), which equivalent to -34479 below (off to the left of) the raw [+32767:+32767] raw scale. So if we subtract -34479 (add +34479) from a measured raw value, and scale the result to degrees (× 360 ÷ 65534), and divide by 22.5, The result will be the number of 16-winds (22.5° periods) clockwise from the middle of the ESE wind. If we round that number to the nearest integer, it should be one of 17 values in the range [0:16]. E.g.

  • lowest possible raw value is -32767: (-32767 - -34479) × 16 ÷ 65534 ~ 0.42, which rounds to 0
  • highest possible raw value is +32767: (+32767 - -34479) × 16 ÷ 65534 ~ 16.42, which rounds to 16
  • North raw value is 10576: (10576 - -34479) × 16 ÷ 65534 ~ 11.00, which rounds to 11, and the N wind is 11 winds clockwise from ESE:
    • ESE(0)=>SE(1)=>SSE(2)=>S(3)=>SSW(4)=>SW(5)=>WSW(6)=>W(7)=>WNW(8)=>NW(9)=>NNW(10)=>N(11)
  • So if there was an array, winds16[17], of 17 strings:
    • winds16[0] = "ESE"
    • winds16[1] = "SE"
    • ...
    • winds16[11] = "N"
    • ...
    • winds16[15] = "E"
    • winds16[16] = "ESE" <== N.B.. repeat of winds16[0]
  • Then the following rung would take a raw value and put the correct 16-wind string into scalar string V_WIND_DIRECTION:

--[SUB ]--[DIV ]---[COP ]--
[SrcA raw] [SrcA a_DINT] [Source winds16[a_DINT]]
[SrcB -34479] [SrcB 4096] [Dest V_WIND_DIRECTION]
[Dest a_DINT] [Dest a_DINT] [Length 1]


Caveat: I am cheating a bit with SrcB in DIV, and the actual scaling from raw to degress and the raw value representing North may be different, but that is an implementation detail: the general approach should work.
 
For sanity's sake it might be worth putting a
LIM 0 a_DINT 16


just before the COP, to ensure some unforeseen raw value or mistake in the calculation parameters does not cause an indirect reference out of bounds error, which in turn would cause a processor halt.
 
Hi drbitboy. thank you for your advice.
If only my system were that straight forward.
I was able to apply the array of strings, which helped neaten up my tag library.
breaking up the wind direction into segments of a circle, like a pie, not so straight forward.

In order to understand why, you will need some background.

Are you familiar with CBS "The Late Show with Stephen Colbert"? Stephen has a segment called "meanwhile". If you are familiar, well, my anemometer is the "meanwhile" of automation systems.

I found a 30 year old wealther station on gumtree, (Australian Craig's List). It was priced at 50 AUD, but located 3 hours from where i live. Fortunately a surfing buddy of mine was travelling in that direction for a surf weekend and he offered to pick up for me.

The weather station was arrived with a hand held digital monitor. The manufacturers of the device offered little in the way of assistance when i requested wiring information, so i ended up reverse engineering the wiring layout using a 10 AUD multimeter.

Once i identified what each wire did, (brute force), i then used the relevant wires to generate a combination of analog inputs, (temp, humidity, wind direction), and digital inputs, (wind speed, rainfall) then fed them into my allen bradley compactlogix, (bought from ebay).

The entire system required some major calibration, not least of which the wind direction. I have attached the raw measured values in image one. The y axis is the analog value, the x axis is wind direction, (numbered 1 to 16). Not linear, and missing a large swath of the pie. But still usable.

I am also setting this up without a HMI (for now), so i am presenting the values in a way that will pass as presentable using ladder logic. (more images).

Thanks again all :). You guys are the best.

Wind Direction Cal.png word test.png Wind Displaypng.png
 

Similar Topics

Hello All, New kid on block with AB 5000 platform. Using the MOV ( move ) command. I can't get the logic to shift the value of source to...
Replies
11
Views
7,879
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
157
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
583
First off, I'm a hobbyist-level programmer, and this program isn't controlling anything anything that could even remotely be considered "life...
Replies
18
Views
519
Back
Top Bottom