Jump to content

Adventures In UniStream conversion - Vect. Linear


Joe Tauser

Recommended Posts

  • MVP 2023

I have found the Vect. Linearization block most useful in Visilogic for dealing with applications involving temperature.  For example, how do you get rid of that pesky decimal point on a whole thermocouple module in one fell swoop?  Here's how-

image.png.4854bcfaa437159f8e6501b903160869.pngimage.png.fdbf50c8acceb9797393796e8e091956.png  

 

So when I'm translating this application to UniStream I discover this block is missing.  The Help on the UniLogic describes how an array can be passed as a parameter, but it doesn't mention that only one element of the array can be passed.  I spent a fair amount of time trying to specify my thermocouple structure as the input argument to the Linearize block to no avail and eventually contacted support.  No, you can't pass a whole array.

So having learned my lesson from the PWM block I went looking in the examples.  Sure enough, one of the Creators had wisely made an example app containing the "Linearize  Array" UDFB, which is set up to handle a 16 element array.  Make sure all your variable structures and data types match when you're using any UDFB.

On top of removing the decimal, my customer made the totally unreasonable request of being able to convert all the temperatures from F to C from a button on the screen.  Fahrenheit rules the world!  No, wait a minute, it doesn't.  

Anyway, here's what I came up with using the UDFB-

Remove the decimal.  Notice that the convert F to C block does it automatically-

image.png.e9291a907f4108edec838be09760eede.png                         image.png.06f7064e16c6f336c0d2985f27336a87.png    

Now the first time I did this, I realized that all the user setpoints were still in the units entered.  So we have to convert all those, too.

image.png.6d8465b9f1b56695be3c54a6cd8f667e.png

 

I do like how the input parameters are easily recognizable and editable using the UDFB.

And good times where had by all.

Joe T. 

 

Linearize Array.ulle

  • Like 1
Link to comment
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...