Analog Subtraction
##### by HB_Stratos
8
points
SPH
stock+DLC ship
#Math   # Analog Subtraction!

.
Yes, it is possible to subtract two Numbers from each other in KSP! How you may ask?
.

### KAL computing

The KAL Controller allows us two computational Methods:
- Two KALs playing at the same time, targetting a third KAL (or any other part), will average their results, so if one KAL wants 5, the other 1, the final output will be 3.
- A KAL allows us to remap an input signal to an output signal. We can e.g. invert a signal by simply having a linear descending line as the output, or even map it to wild curves.
.
None of these Methods are a subtraction though. But we can make the following Observations:
- We can do addition. We only have an average, but average is just adding the two input numbers, and dividing by two. So we can take the average and then multiply by two to get addition.
- Subtraction is just addition with a negative number. And we learned that with a remap we can make a positive number into a negative one. So we take our two inputs, invert one, then add them together and we have subtraction.
.
Trying to apply this Knowledge, we notice:
- This all works well, but KALs can not have a negative play time (they can have negative speed, but that’s for a different time). So we cannot represent negative numbers at all. But not to worry, we can just shift our entire number space to be centered around the middle of the slider instead.
Like that we can have positive and negative numbers, we just need to pay attention that whatever output we hook up to it is at zero when the slider is in the middle.
- To save on parts we can leave out the KAL that would do the multiplication by two out, and for driving the actual output we just use the middle half of the movement space of the KAL, as the slider will never exceed that due to the multiplication missing.
.
So yeah, this is how we subtract two numbers in KSP.
Note that the craft as is will only subtract one positive number from another positive number, but we can easily apply the number space shifting to the input as well, just for readability of the numbers I have not done that here.
Note also that this system only needs three KALs, but two of these KALs need to be playing continuously at 0% speed for the averaging trick to work. And one cannot move the play position of playing KALs manually. Hence there are two Human Input KALs at the top that do nothing but proxy the movement of the play position as a KAL that is not playing can set the the play position of a KAL that is moving, only a human directly can’t do that.
Finally, you may have already realized this, but making this an addition machine instead of subtraction is also trivially easy, just by flipping the one negative pitch KAL line to be positive too.
.
Happy Computing!
.
.
A stock aircraft called Analog Subtraction. Built with 17 of the finest parts, its root part is structuralPanel2.
.
Built in the SPH in KSP version 1.12.3.

### Details

• Type: SPH
• Class: ship
• Part Count: 17
• Pure Stock
• KSP: 1.12.3 swipe to switch images, tap to close
• click on the left/right sides to switch between images or use the arrow keys
• press esc, click
or click anywhere around the center of the image to close
• click
to open image in a new tab
K
S
P