A control system applies a force to an actuator proportional to the voltage of a signal coming into the control system. It is desired not to allow actuator to quiver back and forth in the presence of small corrections near zero-force point. More force is required for the actuator to move to the left (negative direction of motion) then is required for the motion to the right (positive direction of motion). Assume that the transfer function (the relationship between the voltage and the movement) of the actuator is:
? Voltage less the -0.2 volt: actuator moves 1 cm/volt in the negative direction
? Absolute value of voltage less the or equal to 0.2 volts, no motion
? Voltage greater than 0.2 volts, actuator moves 2 cm/volt in the positive direction
Write the function to compute total motion for any single signal input. Write the main function that repeatedly calls the motion calculation function using an input signal stream such as this:-10.v, -8.0v,-0.21v,-0.20v,-0.05v,1.5v,0.00v,4.5v. The main function should also take as user input an initial position of the actuator and should output a final position resulting from applying the signals of the given control system. For one test simulate the effect of the given voltages for an initial position of 1.5 cm to find the final position of the actuator.
This problem is broken down into a C++ function that calculates the
appropriate force based on the supplied voltage and a main ...
This solution shows how to use nested "if" statements in C++. The example program is a voltage transfer function.