How to use SIN in RSLogix

Hello everybody,
i have a Little Problem with programming a sine. I am using Studio 5000 and i want to make a sine with a period of for example 8 seconds. Is it possible to see the value of the sine after every second? If i have a Task with one second, is it showing me the actual value of the sine every second? And how can I do such a sine?
Thank you for your help
 
not really sure what you're asking for - but maybe this will help you along the way ...

the yellow trace in the trend below shows a SINE WAVE being generated in the Continuous Task ...

the green trace shows a SINE wave being generated in a Periodic Task with a period of 1000 milliseconds ...

(continued in the next post) ...
.

SINE_WAVES.jpg
 
and here are some files which might be helpful - including the little Add-On Instruction that I wrote some years ago to make this happen ...

good luck - and I hope this helps ...
.
 
Glitch in Sine Wave Examples

Both Sine Wave examples seem to glitch @ Zero Crossover of the clock...

I swapped the Clock Second Timer for a millisecond counter that resets @ 59
and the glitch went away. I am not sure why???

short on time ... see if this helps ...

this pretty much duplicates the earlier examples - but in FBD programming ...
 
What an interesting thread!

[OP requirements and further clarification]
RSLogix 5000
Function Block Diagram
SIN(1/60 * time), where time is in seconds
Not clarified by OP: did he want his sine in degrees or radians?

[Some facts]
1/60 = 0.0166666666667
In Logix5000, SIN requires radians
RAD function converts degrees to radians (or MUL 0.01745329)
If you wanted to do it all in one, 1/60 * 0.01745329 = 0.0002908882087

[Glitches and rollovers]
With any free running timer it is going to rollover at some value.
To avoid glitches, you have to make sure that the sin(value that has been rolled over) = sin(value that it would have been if it didn't roll over but carried on to infinity).
So because Ron used w=0.10649 for a sin function that uses radians,
Sin(.10649*0) = 0, sin(.10649 * 60) = 0.10601509418
So that is why we see a glitch.

So to implement a sin wave, only rollover on multiples of your period.
 
the Seconds reading from the clock only goes up to a maximum value of 59 (it never reaches 60) ... so try dividing (2*pi) by 59 ...

and welcome to the forum ...

It should still be PI/30 (2*PI/60 = 0.10471975), because seconds runs from 0 to 59 (sixty values), otherwise it will hold at 1 for 2s (59s and 0s).

I'm a bithead, so I'm just sayin'
 
Last edited:
Both Sine Wave examples seem to glitch @ Zero Crossover of the clock...

I swapped the Clock Second Timer for a millisecond counter that resets @ 59
and the glitch went away. I am not sure why???

The correct factor for a 60-second timer (e.g. whatevertag.SEC) that runs from 0 to 59 is 0.10471975; see my other post.
 
I cannot eliminate zero crossover glitch

Peter

You see Glitches in both of Ron's Examples above.
I have spend a few hours on it, modified Ron's code and wrote some from scratch on my own.

I cannot get the glitch out of the zero crossover
I have minimized it a bit but cannot get a completely clean sine wave on a 60 second cycle.

See attached Screen shot.

I will try a few more things

Dave

The sine function argument is in radians. There are 2*PI radians per 360 degrees or cycles.

There should be no glitches at the crossover point.


Our customers use sinusoidal testing all the time.

Glitch.JPG
 
Hello everyone,
New to the forum-Thought it was about time I joined one...
In any case I have a question I’m sure you guys would be able to give me an answer to fairly quickly.

I started using PLCs about 2 years ago started on the KOYO clicks, they’re pretty simple to use. Working on a filling machine right now with a Micrologix1000. I’m wondering if there’s a way to tie in an external timing relay to an output. The output it’s just for a solenoid valve and I need to extend the cycle time.

On a second note-Can someone please help me understand why AB outputs power when they’re off, and 0v on the output when it is turned on? It doesn’t really make much sense always wondered this...

Thank you, look forward to a reply.
Best Regards,
Levon
 
Hello everyone,
New to the forum-Thought it was about time I joined one...
In any case I have a question I’m sure you guys would be able to give me an answer to fairly quickly.

I started using PLCs about 2 years ago started on the KOYO clicks, they’re pretty simple to use. Working on a filling machine right now with a Micrologix1000. I’m wondering if there’s a way to tie in an external timing relay to an output. The output it’s just for a solenoid valve and I need to extend the cycle time.

On a second note-Can someone please help me understand why AB outputs power when they’re off, and 0v on the output when it is turned on? It doesn’t really make much sense always wondered this...

Thank you, look forward to a reply.
Best Regards,
Levon


You probably want to ask that again in its own thread, you'll likely get more responses.
 
Peter

You see Glitches in both of Ron's Examples above.
I have spend a few hours on it, modified Ron's code and wrote some from scratch on my own.

I cannot get the glitch out of the zero crossover
I have minimized it a bit but cannot get a completely clean sine wave on a 60 second cycle.

See attached Screen shot.

I will try a few more things

Dave

To eliminate that glitch, the time scaling constant must be 0.10471975; I predicted the character of the glitch seen in your plot in this post.

The way you all know LD, ST, etc., is the way I know this stuff.
 
Last edited:

Similar Topics

Good morning everyone, I'm having difficulty using the "sin" and "cos" functions in sysmac, in particular the results of the functions are not...
Replies
15
Views
1,058
Hi, How to force analog I/O values in Proworx 32 Software (Modicon). Thanks.
Replies
2
Views
1,618
Is it even possible to conevert NB HMI program TO NC HMI programm or how to get .csv file from cx programmer for some reason program named tag...
Replies
3
Views
1,351
Twice in less than a week! Another former customer of mine has run into a problem. Their machine had a Red Lion Kadet HMI that went belly-up and...
Replies
3
Views
1,555
In Rslogix 5000, how to convert the angle of sin54 to degree? if i use SIN instruction,it converts as radian. Please help some one
Replies
3
Views
1,972
Back
Top Bottom