Jump to content

Recommended Posts

Posted

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. 

Posted

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
Posted

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. 

Posted

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. :)

  • 6 years later...
Posted
On 2/15/2017 at 1:14 AM, Cara Bereck Levy said:

Regarding the Help file--you are correct regarding the array functions. I hope to have this corrected by the next release.

Its now 2023...just sayin'

  • 2 weeks later...

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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.