|
OptoMMP3
|
Linear scaling object. This is the "good ole" y = m * x + b equation. More...
Public Member Functions | |
| Boolean | SetEquation (Double dInput1, Double dOutput1, Double dInput2, Double dOutput2) |
| Set the parameters of this object. More... | |
| Double | Compute (Double dInput) |
| Compute the output More... | |
Linear scaling object. This is the "good ole" y = m * x + b equation.
(C#)
Linear linear = new Linear();
// set linear to convert temperature F to C
Boolean bResult = linear.SetEquation(32.0, 0.0, 212.0, 100.0);
Double dDegreesF;
Double dDegreesC;
// freezing point
dDegreesF = 32.0;
dDegreesC = linear.Compute(dDegreesF);
Console.WriteLine("Freezing temperature {0} F is {1} in C", dDegreesF, dDegreesC.ToString("F1"));
// a typical Temecula summer day
dDegreesF = 102.0;
dDegreesC = linear.Compute(dDegreesF);
Console.WriteLine("Temecula temperature {0} F is {1} in C", dDegreesF, dDegreesC.ToString("F1"));
// boiling point of water at sea level
dDegreesF = 212.0;
dDegreesC = linear.Compute(dDegreesF);
Console.WriteLine("Boiling temperature {0} F is {1} in C", dDegreesF, dDegreesC.ToString("F1"));
// where the two temperatures intersect
dDegreesF = -40.0;
dDegreesC = linear.Compute(dDegreesF);
Console.WriteLine("Cross temperature {0} F is {1} in C", dDegreesF, dDegreesC.ToString("F1"));
| Double Opto22.Linearization.Linear.Compute | ( | Double | dInput | ) |
Compute the output
| dInput | Input to compute. |
| Boolean Opto22.Linearization.Linear.SetEquation | ( | Double | dInput1, |
| Double | dOutput1, | ||
| Double | dInput2, | ||
| Double | dOutput2 | ||
| ) |
Set the parameters of this object.
Two points of a linear line are required to set the equation parameters. We call these points P1 and P2; with input and output values of dInput1, dInput2, dOutput1 and dOutput2.
| dInput1 | The input for point P1. |
| dOutput1 | The output for point P1. |
| dInput2 | The input for point P2. |
| dOutput2 | The output for point P2. |