|
OptoMMP2
|
Linear scaling object. This is the "good ole" y = m * x + b equation. More...
Public Member Functions | |
| Linear () | |
| Constructor More... | |
| bool | 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 bool 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 sealevel dDegreesF = 212.0; dDegreesC = linear.Compute(dDegreesF); Console.WriteLine("Boiling temperature {0} F is {1} in C", dDegreesF, dDegreesC.ToString("F1"));
// where the two lines cross each other dDegreesF = -40.0; dDegreesC = linear.Compute(dDegreesF); Console.WriteLine("Cross temperature {0} F is {1} in C", dDegreesF, dDegreesC.ToString("F1"));
| Opto22.Linearization.Linear.Linear | ( | ) |
Constructor
| double Opto22.Linearization.Linear.Compute | ( | double | dInput | ) |
Compute the output
| dInput | Input to compute. |
| bool 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 Input1, Input2, Output1 and Output2.
| dInput1 | The input for point P1. |
| dOutput1 | The output for point P1. |
| dInput2 | The input for point P2. |
| dOutput2 | The output for point P2. |