If I understand your question, you are trying to keep your battery at a level lower than 100% (let's say 40%). I wanted the same thing in the past because I used my laptop mainly as a desktop, and keeping the battery at 100% all the time was not necessary and not healthy for it. What I found is that even though in theory it is possible to find software controlling the level of the battery while the OS is running, when the computer is powered off/put to sleep, it will start charging because there is no hardware support for such feature - keeping the battery at lower level.
So in conclusion, if you have laptop different from Lenovo/ThinkPad, I think there is no way to achieve this.