Jump to content
hotwires

"Array functions" help files

Recommended Posts

Dear Community,

I couldn't find anything in the UniLogic  help files about array functions. Is it just me or is the help section grossly incomplete in  UniLogic ?! Visilogic seems to be very comprehensive in help topics with examples for every FB in the software. Feel some uncertainty without help topics on select functions, especially with the differences in terminology from Visilogic. Example being: a vector copy of 30 MI's in Visilogic is equivocal to "copy array part to array"?? Failed to find help topic with example. 

 I tried to build a UDFB last night to function like Visilogic's vector linearization function and gave up. Just stacked individual linearization functions instead. I get the feeling the authors of UniLogic were not the same people who composed Visilogic. Old dog learning new tricks, I'll get there. 

Share this post


Link to post
Share on other sites

Yes, vector copy and copy array part to array does do the same thing: Copy from one array to another (In visilogic everything was arrays), with the limitation in UniLogic, that both arrays should have the same data type.

 

For building linearization  UDFB, I would pass the Array as Function-In, along with the X1, X2, Y1, Y2,and Length tags, and the ourput array.

I would then iterate on the first array, linearize the value and put it on the second array.

Iteration can be done with Jump to start of region, and using Load from array from the first array, and Store to array on the second array.

 

For example:

Local tag: Index, LinValue

Region1

LinValue = Load from Array1 at Index

LinValue = LinValue * (Y2 - Y1) / (X2 - X1)

Store LinValue to Array 2 at Index.

Index++   (INC Index)

If Index < Length then Jump Region "Region1"

 

 

  • Upvote 1

Share this post


Link to post
Share on other sites

Thanks Saragani. I used the copy array part to array in my unilogic program and live tested; it works just like vector copy, just different terminology. 

The array linearization UDFB is more involved than I though. I was trying to link input INT, constants, and result INT as arrays  of INT16's (built around the single linearization FB). Looks like it doesn't work that way. 

I won't lie: I'm not impressed with the "just build a UDFB" responce to features that were drag and drop, load em up and you're done in Visilogic. Unilogic is a whole new ballgame.

I'll study program examples and youtube videos on UDFB's and slowly wrap my head around it. I got spoiled on the drag em, drop em, and load em up method.

I don't even know what "iteration" is. So is your example C+ code? Or textual guidance for ladder/FB construction? 

Again thank you for the help. I want to learn how to use unilogic to it's fullest potential. I have a lot of future opportunities to use Unitronics products. The product line and pricing are outstanding. 

Share this post


Link to post
Share on other sites

sounds like a "FOR...NEXT " loop. I'll check out the example. PBASIC is the only programming language I ever learned. Can make a Basic stamp do some awesome stuff, lol. Not sure that I could learn C+ at my age. Maybe my kids can master it and help me out. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...