home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / bit / listserv / csgl / 1382 < prev    next >
Encoding:
Text File  |  1992-11-04  |  14.0 KB  |  447 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!europa.asd.contel.com!paladin.american.edu!auvm!DRETOR.DCIEM.DND.CA!JEFF
  3. X-Mailer: ELM [version 2.2 PL9]
  4. Message-ID: <9211042344.AA05885@client1.dciem.dnd.ca>
  5. Newsgroups: bit.listserv.csg-l
  6. Date:         Wed, 4 Nov 1992 18:44:19 EDT
  7. Sender:       "Control Systems Group Network (CSGnet)" <CSG-L@UIUCVMD.BITNET>
  8. From:         jeff@DRETOR.DCIEM.DND.CA
  9. Subject:      Re: Squirrels, airconditioners
  10. In-Reply-To:  <9210290220.AA07077@ben.dciem.dnd.ca>; from "William T. Powers"
  11.               at Oct 28, 92 9:49 am
  12. Lines: 433
  13.  
  14. [From Jeff Hunter (921104)]
  15. > Re Bill Powers (921028.0630)
  16.  
  17.         Thanks for your comments on my squirrel posting. I think I'll
  18. try my point again with exposition first, and examples to follow.
  19.  
  20.         Your contention is that "proper" control systems have loop
  21. gains of at least -5 (preferably -10 to -100). I believe that this
  22. rule-of-thumb of yours may be a result of the specs of the systems
  23. you designed. I also believe that this is too constrained a definition
  24. to describe the majority of control systems in living organisms.
  25.  
  26.         A "good" control system keeps its error within a specified
  27. distance of zero for a specified percentage of the time for a
  28. given class of disturbances.
  29.  
  30.         The control systems you describe generally have a small
  31. tolerence for error, quick response time, and make few assumptions
  32. about the pattern of disturbances (although they implicitly assume
  33. an upper limiton their magnitude).
  34.         For example the machine you described to etch diffraction
  35. gratings (am I remebering this correctly?) must be accurate to
  36. within .1 microns, must react in fractions of a second, and
  37. probably assumed that earthquakes were rare.
  38.     Thus:
  39. > >>A control system that can cancel only 10 percent of a disturbance
  40. > >>isn't much of a control system.
  41.  
  42.         Now consider the squirrel trying to maintain a CEV
  43. "I am well fed". This is set by the squirrel's metabolism and diet.
  44. On a summer day the squirrel does not need to burn any calories
  45. to stay warm (low metabolic load), plus it can find a lot of food
  46. easily (good diet). However on a winter day the squirrel must burn
  47. a lot of calories to stay warm, and cannot find much food. This
  48. is the maximum disturbance case.
  49.         If the squirrel cannot make assumptions about the pattern
  50. of summer and winter days then it must be able to survive
  51. indefinitely in winter. I'm not sure what such a squirrel would
  52. look like, but it would be big to keep surface heat losses down.
  53. (Maybe a mammoth?)
  54.     In reality species (through evolution) have a long history
  55. of the climate. Squirrels "know" that they can expect the winter
  56. to end (and have a fair estimate of how long winters are). Their
  57. bodies and lifestyles are tailored to have enough fat reserves at
  58. fall to survive a bad winter, and not much more. If a squirrel
  59. stores as much fat as possible (rather than as much as it will
  60. likely need) then it won't get around to such cruicial things as
  61. finding mates to make baby squirrels with.
  62.     Many control systems in living organisms make similar
  63. assumptions about the pattern of disturbances they will encounter.
  64.  
  65.  
  66.     I've made a program to illustrate an extremely abstract version
  67. of a "loose" control system.
  68.     The environment is one dimensional (represented by a number).
  69. Time is quantised in ticks. There is a "disturbance" size (default 4),
  70. and each tick the environment is changed by this size. (A random
  71. number gives a 50% chance of increment, and 50% chance of decrement.)
  72.     Three copies of this environment are kept. In one there is no
  73. attempt to control it. In the second the number is moved two units
  74. towards zero each tick. In the third the environment is incremented
  75. by one unit (to introduce a "bias") before being moved toards zero
  76. as in the second.
  77.  
  78.     In case that was unclear here is some pseudo code:
  79.  
  80.     for (each tick)
  81.  
  82.         if /* 50% chance of being true */
  83.             change =  4
  84.         else
  85.             change = -4
  86.  
  87.         free_new = free_old + change
  88.         cont_new = cont_old + change
  89.         bias_new = bias_old + change + 1
  90.  
  91.         if (cont_new > 0)  cont_new = cont_new - 2
  92.         if (cont_new < 0)  cont_new = cont_new + 2
  93.  
  94.         if (bias_new > 0)  bias_new = bias_new - 2
  95.         if (bias_new < 0)  bias_new = bias_new + 2
  96.  
  97.  
  98.     The tick-by-tick disturbance has a magnitude of 4, however the
  99. long term average disturbance is 0 (or +1 in the biased case).
  100.     The "gain" of the controlled system is (at most) -0.5, and
  101. indeed the error is often non-zero. However it keeps the environment
  102. within 8 units of zero 93% of the time.
  103.     The biased system has better effective gain if the error is
  104. negative, and worse gain is the error is positive. Nonetheless
  105. it too keeps the error bounded at small values.
  106.  
  107.     The results of one run (of 10000 ticks) are displayed below.
  108. Min and max are the highest and lowest values of the number.
  109. Sum is the average of the absolute value of the error, while
  110. "err" is the average of the square of the error.
  111.  
  112.  %wavers: loops=1 bias=0, incr=4
  113.  
  114.  %wavers: free max=  404 min= -124 sum=  208.36 err=51220.66
  115.  %wavers: cont max=   28 min=  -30 sum=    3.20 err=   23.29
  116.  %wavers: bias max=   61 min=  -13 sum=    6.67 err=  104.30
  117.  
  118.  
  119.     The code of the program follows at the end of the post. It
  120. generates a graph of the environment in PostScript, as well as
  121. the summaries above.
  122.  
  123.  
  124.     Now for a few comments:
  125. > The importance of the result in the eyes of a biologist doesn't mean
  126. > that there's a control system for the variable. In lower animals, many
  127. > reference levels are inherited and are not adjustable.
  128.  
  129.     I think this point is irrelevant. Your reference level for blood
  130. CO2 level is inherited and not adjustable in the same fashion, yet
  131. you have a control system for it.
  132.  
  133.  
  134. > You'd better draw me a diagram of [the squirrel's] control system.
  135.  
  136.     The concert hall cooler is easier to diagram, and makes the same
  137. point. It shows a system that can maintain a CEV (temperature is less
  138. than a given value) even though it's instantaneous gain (cooling power)
  139. is overwhelmed by the heating power of the audience.
  140.  
  141. > >We get the same sort of thing in concert halls. The air
  142. > >conditioning cannot handle the heat output of 40,000 sweaty rock
  143. > >fans. [But it] can keep the temperature acceptable even
  144. > >though it can only compensate for a fraction of the momentary
  145. > >disturbance.
  146.  
  147.                   Max Safe Temp
  148.                        v
  149.     Heat        +-----------------+
  150.     Schedule--> | Climate Control |
  151.     & Time      +-----------------+
  152.                  ^          |
  153.                  |          v
  154.                 Temp       Air
  155.                         Conditioner
  156.  
  157.     Here's a diagram of the system. The top level reference is
  158. 35 degrees Celsius (95 F). If the temperature gets higher than
  159. that then people start collapsing of heat-stroke, and the hall
  160. gets hit with lawsuits.
  161.  
  162.     The climate control ECS uses the input function:
  163.  
  164.     delta heat = expected heat from concert * fudge factor -
  165.                   cooling capacity of air conditioners
  166.     delta temp = delta heat * thermal mass of the concert hall
  167.     predicted temp = delta temp + current temp
  168.  
  169.     The comparator of the ECS is:
  170.  
  171.         if (predicted temp >= max safe temp)
  172.             error =  predicted temp - max safe temp
  173.         else
  174.             error = 0
  175.  
  176.     And the output function is:
  177.  
  178.         if (error not zero)
  179.             turn on air conditioners
  180.  
  181.     (Note: this portrays only the cooling side of the climate control
  182. system.)
  183.  
  184. > The only control that exists is over a 24-hour period. The average
  185. > temperature is kept within plus or minus x degrees of a reference
  186. > level. That's not very good control.
  187.  
  188.     The actual CEV is "temperature is not high enough to be a health
  189. hazard", and this is controlled quite well unless the drummer
  190. spontaneously combusts.
  191.  
  192. > The only reason this works is that the fans are willing to accept a
  193. > wide range of temperature error, beginning at "too cold" and ending up
  194. > at "too hot".
  195.  
  196.     Exactly. Not all control systems are built to microscopic
  197. tolerances.
  198.  
  199.  
  200.  
  201. > RE: Greg helping Evan to solve a problem, at Evan's request:
  202. >
  203. > >> See how easy it is when nobody is trying to figure out how to
  204. > >>control someone else?
  205. >
  206. > >See why it seems that your definition of control is not:
  207. > >     - getting someone else to do what you want
  208. > >but
  209. > >     - getting someone to do what they don't want to
  210. >
  211. > It isn't so much getting someone to do what they don't want to as
  212. > getting someone to do what you want, without considering what they
  213. > want. You're controlling in either case, of course.
  214.  
  215.     Ack! If you limit "control" in social situations to mean
  216. almost instantaneous 100% compliance regardless of the wishes of
  217. the controlee then a science of social interactions does not
  218. have to consider control any more than it considers unicorns.
  219.     If you threaten people with "walk through that door or I'll shoot"
  220. you assume that they do not wish to be shot. If you want control
  221. regardless you'll have to pick themm up and toss them through
  222. the door. This passes way outside the realm of psychology, and
  223. into the realm of physics.
  224.  
  225.  
  226. ----------8<------cut here-------->8-----------------
  227.  
  228. /* a quick-and-dirty program to test a loose control system
  229.  *
  230.  *    This tests three systems that all have the same disturbance.
  231.  *    They are:
  232.  *        free - no control
  233.  *        cont - some control
  234.  *        bias - bias in the disturbance
  235.  */
  236.  
  237. #include    <stdio.h>
  238.  
  239.  
  240. #define    ABS(x)    (x)>0 ? x : -(x)
  241.  
  242. #define    BINS    512
  243. #define    BIN2    (BINS/2)
  244.  
  245. long    free_bin [BINS];
  246. long    cont_bin [BINS];
  247. long    bias_bin [BINS];
  248.  
  249.  
  250.  
  251.  
  252. main (argc, argv)
  253.  
  254. int    argc;
  255. char*    argv[];
  256.  
  257. {
  258.  
  259. int    max_loop;            /* time to run            */
  260. int    init_bias;            /* initial value of counters    */
  261. int    increment;            /* size of counter increment    */
  262. int    d, i, j, k;
  263. int    blip,    last;            /* random booleans        */
  264. int    pos,    neg;
  265. int    up,    down,    high,    low;    /* bins to test random numbers    */
  266.  
  267. long    b, max_bin, first_bin;
  268.  
  269. long    seed;
  270.  
  271. long    free_tot, free_max, free_min;
  272. long    cont_tot, cont_max, cont_min;
  273. long    bias_tot, bias_max, bias_min;
  274.  
  275. float    free_err, free_sum;
  276. float    cont_err, cont_sum;
  277. float    bias_err, bias_sum;
  278.  
  279.     printf ("%%!PS\n");
  280.  
  281.     if (argc > 1)
  282.         max_loop = atoi (argv [1]);
  283.  
  284.     if (max_loop < 1)
  285.         max_loop = 1;
  286.  
  287.     increment = 4;
  288.     if (argc > 2)
  289.         increment = atoi (argv [2]);
  290.  
  291.     init_bias = 0;
  292.     if (argc > 3)
  293.         init_bias = atoi (argv [3]);
  294.  
  295.     printf ("%%%s: loops=%d bias=%d, incr=%d\n",
  296.         argv [0], max_loop, init_bias, increment);
  297.  
  298.  
  299.     seed = time (0);
  300.     srandom (seed);
  301.  
  302.     printf ("%%%s: seed=%ld\n", argv [0], seed);
  303.  
  304.  
  305.         /* initialize counters and variables */
  306.  
  307.     free_tot = free_max = free_min = init_bias;
  308.     free_sum = free_err = 0;
  309.     cont_tot = cont_max = cont_min = init_bias;
  310.     cont_sum = cont_err = 0;
  311.     bias_tot = bias_max = bias_min = init_bias;
  312.     bias_sum = bias_err = 0;
  313.  
  314.     pos = neg = up = down = high = low = 0;
  315.     last = 0;
  316.  
  317.     for (b=0; b<BINS; b++)
  318.         free_bin [b] = cont_bin [b] = bias_bin [b] = 0;
  319.  
  320.     k = 0;
  321.  
  322.         /* simulation loop */
  323.  
  324.     for (j=0; j<max_loop; j++) {
  325.  
  326.     for (i=0; i<10000; i++) {
  327.  
  328.         blip = random() & 0x100;
  329.  
  330.         if (blip) {
  331.             d =  increment;
  332.             pos++;
  333.             if (last) high++; else up++;
  334.         } else {
  335.             d = -increment;
  336.             neg++;
  337.             if (last) down++; else low++;
  338.         }
  339.         last = blip;
  340.  
  341.         free_tot += d;
  342.         cont_tot += d;
  343.         bias_tot += d;
  344.  
  345.         if (cont_tot > 0) cont_tot -= 2;
  346.         if (cont_tot < 0) cont_tot += 2;
  347.  
  348.         bias_tot++;
  349.         if (bias_tot > 0) bias_tot -= 2;
  350.         if (bias_tot < 0) bias_tot += 2;
  351.  
  352.         b = free_tot + BIN2; if (b >= 0 && b < BINS) free_bin [b]++;
  353.         b = cont_tot + BIN2; if (b >= 0 && b < BINS) cont_bin [b]++;
  354.         b = bias_tot + BIN2; if (b >= 0 && b < BINS) bias_bin [b]++;
  355.  
  356.         free_sum += ABS (free_tot);
  357.         cont_sum += ABS (cont_tot);
  358.         bias_sum += ABS (bias_tot);
  359.  
  360.         free_err += (free_tot * free_tot);
  361.         cont_err += (cont_tot * cont_tot);
  362.         bias_err += (bias_tot * bias_tot);
  363.  
  364.         if (free_tot > free_max) free_max = free_tot;
  365.         if (free_tot < free_min) free_min = free_tot;
  366.         if (cont_tot > cont_max) cont_max = cont_tot;
  367.         if (cont_tot < cont_min) cont_min = cont_tot;
  368.         if (bias_tot > bias_max) bias_max = bias_tot;
  369.         if (bias_tot < bias_min) bias_min = bias_tot;
  370. /*
  371.         printf ("%%%s: free max=%5ld min=%5ld sum=%f err=%f \n",
  372.             argv [0], free_max, free_min, free_sum, free_err);
  373.         printf ("%%%s: cont max=%5ld min=%5ld sum=%f err=%f \n",
  374.             argv [0], cont_max, cont_min, cont_sum, cont_err);
  375.         printf ("%%%s: bias max=%5ld min=%5ld sum=%f err=%f \n",
  376.             argv [0], bias_max, bias_min, bias_sum, bias_err);
  377.         printf ("%%\n");
  378.  */
  379.     }
  380.     k += i;
  381.  
  382.     printf ("%%%s: pos=%ld, neg=%ld, 00=%5d, 01=%5d, 10=%5d, 11=%5d\n",
  383.         argv [0], pos, neg, low, up, down, high);
  384.     printf ("%%%s: free max=%5ld min=%5ld sum=%8.2f err=%8.2f \n",
  385.         argv [0], free_max, free_min, free_sum/k, free_err/k);
  386.     printf ("%%%s: cont max=%5ld min=%5ld sum=%8.2f err=%8.2f \n",
  387.         argv [0], cont_max, cont_min, cont_sum/k, cont_err/k);
  388.     printf ("%%%s: bias max=%5ld min=%5ld sum=%8.2f err=%8.2f \n",
  389.         argv [0], bias_max, bias_min, bias_sum/k, bias_err/k);
  390.     printf ("%%\n");
  391.     }
  392.  
  393.     max_bin = 1;
  394.     first_bin = 0;
  395.     for (b=0; b<BINS; b++) {
  396.         if (free_bin [b] && (!first_bin)) first_bin = b;
  397.         if (free_bin [b] > max_bin) max_bin = free_bin [b];
  398.     }
  399.  
  400.     printf ("\n %% free variables, scale=%ld\n", max_bin);
  401.     printf ("[1 1] 0 setdash\n %ld    50 moveto\n", first_bin+50);
  402.  
  403.     for (b=0; b<BINS; b++)
  404.         if (free_bin[b])
  405.         printf ("%ld    %ld    lineto\n",
  406.             b+50, (long) (600.0 * free_bin [b] / max_bin) + 50);
  407.     printf ("stroke\n");
  408.  
  409.  
  410.     max_bin = 1;
  411.     first_bin = 0;
  412.     for (b=0; b<BINS; b++) {
  413.         if (cont_bin [b] && (!first_bin)) first_bin = b;
  414.         if (cont_bin [b] > max_bin) max_bin = cont_bin [b];
  415.     }
  416.  
  417.     printf ("\n %% cont variables, scale=%ld\n", max_bin);
  418.     printf ("[2 1] 0 setdash\n %ld    50 moveto\n", first_bin+50);
  419.  
  420.     for (b=0; b<BINS; b++)
  421.         if (cont_bin[b])
  422.         printf ("%ld    %ld    lineto\n",
  423.             b+50, (long) (600.0 * cont_bin [b] / max_bin)+50);
  424.     printf ("stroke\n");
  425.  
  426.  
  427.     max_bin = 1;
  428.     first_bin = 0;
  429.     for (b=0; b<BINS; b++) {
  430.         if (bias_bin [b] && (!first_bin)) first_bin = b;
  431.         if (bias_bin [b] > max_bin) max_bin = bias_bin [b];
  432.     }
  433.  
  434.     printf ("\n %% bias variables, scale=%ld\n", max_bin);
  435.     printf ("[2 2] 0 setdash\n %ld    50 moveto\n", first_bin+50);
  436.  
  437.     for (b=0; b<BINS; b++)
  438.         if (bias_bin[b])
  439.         printf ("%ld    %ld    lineto\n",
  440.             b+50, (long) (600.0 * bias_bin [b] / max_bin)+50);
  441.     printf ("stroke\n");
  442.  
  443.     printf ("showpage\n");
  444. }
  445. --
  446. De apibus semper dubitandum est - Winni Ille Pu
  447.