Jump to content

Math function to analog output

Recommended Posts


I make a program for a battery charger. For charge the battery i need two voltage level (Floating at 270V and Boost at 276V) :

The piece of programm is in the attached file.


I use two set point ( I can increment or decrement the two set point on the screen) :

- MI20 : Floating voltage set point

- MI22 : Boost voltage set point

Then, i use a SUB function to obtain MI4 :  the difference  between MI22 and MI20

Next , i use a ADD function to obtain MI23 : The sum of MI20 and MI4

The MI23 is linearized and send to the analog output MI21


This doesnt work because the out of the math function not include the state of the bit MB 31 at the input.


In fact, i would send 270V (MI22) to the analog output when the MB31 is off, and send 276V (MI20) to the analog output when the MB31 is ON.

Would anyone have a solution?

And sorry for my english! :)





Set up voltage.jpg

Link to comment
Share on other sites

  • MVP 2023

Perhaps I don't understand what you're doing because it seems simple and obvious what to do. Use a buffer MI to store the value you want to go to the analog output. Use two rungs, one with a direct contact of MB 31 to store MI 20 to your buffer MI and a second rung with an inverted contact of MB 31 to store MI 22 to the buffer MI. Use the buffer MI in the Linearization function block.

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.

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