lamboom

NJ Programming - Best Practices -a question. RESOLVED

10 posts in this topic

HI

I have 4 small ladder programs ... In 4 different .smc2 files.  Each program uses similar FB' & ST's and FUN's .    I would like to combine all four, each with their own page on the NA HMI.  My attempts haven't been working well .. The HMI is doing everything I wanted.. no problems there.    But, even tho I use different variables in the 4 programs, there are "warning's" that I'm using identical instances .. which is true .. :-)  .. and, programs don't run ..  'tho, they each run quite well, when there is only one of them.   The problem is, I haven't been able to figure out how to isolate, and prevent conflicts between the four programs.  They all control one linear motor, and have it do different things. There never is more than one of the four running at any time

I know I can create (list in the multiview explorer) many programs (ladder & ST); also, each can have many sections.   

Please suggest the best way to manage four programs, within a single file.. in general.       I've done a lot of reading of the NJ manuals, and can't take the Omron programming class; however, have learned a lot on YouTube .. and on this Forum, ... so I'm not totally dim.

If you think it would take too much time to answer this question, please point me to a good reference ... I'm familiar with W502-E1-18 NJ Reference, W508-E1-14 MC Reference, W501-E1-16 NJ Software, W507-E1-14 Motion Control ... so if you are going to suggest using those.. please suggest the page number.. :-)    

Thanks much, Regards, Michael

PS:    It's like having (4) MC_SyncMoveAbsolute fb's in the same ladder prog (not on the same rung)  they all control the same axis, but only one at a time....   OR, perhaps there's only one MC_SyncMoveAbsolute .. and it gets different position information, from 4 different sources ... one at a time? 

..................................................... 

RESOLVED: It was the last point I thought of above... that approach kinda worked .. an' for now "kinda" is good enough.

Edited by lamboom
Resolved problem

Share this post


Link to post
Share on other sites

Why are you using the same instance names?  That's how you identify the function blocks, they should NEVER be duplicated.

1 person likes this

Share this post


Link to post
Share on other sites

Hi Crossbow... Thanks for the reply.   Cause I'm an idiot .. :-)     I figured it out .. and posted a last sentence above in an edit...  It must be frustrating trying to help people who are not well experienced in this science.   I am truly sorry I am quite limited in understanding Omron programming, and Sysmac ... The manuals are very confusing as tutorials .. they seem to be mostly "references" ..  I do appreciate "all" of your comments...  REALLY! ... :-)   

Check this out:

https://www.youtube.com/embed/gGzp7HURBJE?rel=0&controls=0&showinfo=0

Share this post


Link to post
Share on other sites

We are here to help.  I understand your background wasn't PLC programming.  Glad to see you are making progress!

Share this post


Link to post
Share on other sites
23 hours ago, lamboom said:

Got no ideas on that.  Most motion controllers are designed for trapezoidal or S curve accel/decel profiles.  You almost have to write your own logic and use the synchronous control functions for that.

Share this post


Link to post
Share on other sites

YUP... an' that's the problem.. will have to learn how to do that .. I know enough to keep trying... :-)   Thanks

Share this post


Link to post
Share on other sites

Consider writing logic that does the control you want, but on a number in a variable, nothing to do with an axis.  Then you can use that value as the target location for MC_SyncMoveAbsolute to move an actual axis to that particular position every single program cycle.  So as the value changes, the function block causes a move each and every PLC scan.  You need to account for accel and decel in the logic, because that function block just says each scan 'ok go here now'.

Share this post


Link to post
Share on other sites

 

4 hours ago, Crossbow said:

Consider writing logic that does the control you want, but on a number in a variable, nothing to do with an axis.  Then you can use that value as the target location for MC_SyncMoveAbsolute to move an actual axis to that particular position every single program cycle.  So as the value changes, the function block causes a move each and every PLC scan.  You need to account for accel and decel in the logic, because that function block just says each scan 'ok go here now'.

Thanks... I'll give it some thoughts ... What you are saying, is exactly what is happening now with the running of the Random Sea, which is one heck of a lot more complicated than a single simple "S" curve.  I might be wrong but MC_SyncMoveAbsolute doesn't care about velocity or acceleration as an input.  It's just going to a new position every 1.0 ms, an' it's going to do what ever it takes to get there in 1.0 ms ..    So, it's really all about position as a function of time.  A position is determined mathematically every 1.0 ms (CPU  Cycle) .. The resulting curve will be a Cosine .. some of the points will be closer together, others will be farther apart.   If the curve lasts 0.5 seconds, there will be 500 points defining that curve.  

I've written the code to make sine waves (cosine waves.. same thing just 90 degrees out of phase with sines)  .. Now to make the code that creates just a part of a sin/cos wave .. the part that goes from -1 to +1  ... How hard could it be?  :-)         ....well... it's very hard for me.... sigh!

Pay no attention to the glitch (arrow):

Tsunami_bmp.png.ea061a46a9d6ce76a190c3df The perfect sequence (without the glich)

Edited by lamboom

Share this post


Link to post
Share on other sites

Good luck, that math is way above my skill set ;)

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