# Math function to analog output

## Recommended Posts

Hello!

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!

##### Share on other sites

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.

##### Share on other sites

Ok, i undersatand , but don't find a buffer MI.

Could you tell me what is a buffer MI?

##### Share on other sites

Just use any unused MI to hold the value that will change depending on the state of MB 31.

##### Share on other sites

Ok, I did not understand what the store function was used for.

Thank you!

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×

×