Special Topic 3 - Graph Theory

Assignment 6

Due 6/9/00

This assignment contributes 12.5% of the mark for Special Topic 3.

The following circuit diagram shows a control circuit for a solar pump:

The aim of the circuit is to protect the pump from attempting to run when the voltage supplied by the solar panel is insufficient (A DC pump is likely to burn out in these circumstances). But for the purpose of this assignment, you can ignore the right hand side of the diagram - we are only concerned with the switch controlling circuit.

The circuit has two 50 ohm potentiometers (or variables resistors), R1 and R2, together with a switching relay whose nominal switching voltage Vs is 7.5 volts. For the purpose of this exercise, assume that the relay has a resistance of 100 ohms.

The aim of the assignment is to use CLP(R) to choose settings for the potentiometers which will ensure that the pump is protected. For the purpose of this assignment, we will assume that the "setting" of a potentiometer is the ratio of the output to total resistances (ie the setting of pot R1 is R1b / R). Note that it is necessarily between zero and one.

The relay switching voltage has some degree of error associated with it; we can be sure it is off at 6.5V, and on at 8.5V; we need to be sure that the pump is off if the input voltage drops below 13V, and on above 17V (otherwise we will waste too much sunlight). So our aim for the circuit is that the relationship between V and Vs is as close as possible to:

V

Vs

low

13

6.5

mid

15

7.5

high

17

8.5

 

  1. Write a rule switching_ratio(Level,V,Vs) which records the above table.
  2. Write a rule pot(Setting,Ra,Rb), which defines the relationship between the setting of a potentiometer and the two resistances involved (note that the resistances must sum to 50)
  3. Write a rule div_circuit(Vin,Iin,Setting,Vout,Iout) which relates the input and output voltage divider voltages and currents, given a particular potentiometer setting (adapt the rule on page 138 suitably, using the predicate pot)
  4. Write a rule double_divider(Vin,Iin,Setting1,Setting2,Vout,Iout) which relates the input and output voltage divider currents for our circuit above, given a particular potentiometer settings at R1 and R2 (use your modified div_circuit; don't assume that the output current is zero, for the moment).
  5. Write a rule level_error(Level,Setting1,Setting2,Error) which relates the potentiometer settings to the error from our desired values for a given line in the table.
  6. Finally, write a rule overall_error(Setting1,Setting2,Error) which returns the maximum of the errors over all rows in the table for a given choice of pot settings.

At this point, it ought to be easy to finally solve the problem by using a built-in minimise procedure; unfortunately, CLP(R) doesn't have one, and programming one is beyond our current experience, so we will have to do the search by hand: try different values of the two settings to find a minimum value.

Submission