Last active
April 21, 2018 17:09
-
-
Save kenwebb/5cfe135c89af9d503cb7053960b47c7d to your computer and use it in GitHub Desktop.
Cybernetics - Ashby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Sat Apr 21 2018 13:09:17 GMT-0400 (EDT)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Cybernetics - Ashby | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 5cfe135c89af9d503cb7053960b47c7d | |
Keywords: | |
My Notes | |
-------- | |
April 20, 2018 | |
Ashby provides numerous examples in his book "An Introducttion to Cybernetics". | |
Some of these involve finite sets, where A × A → A | |
This is instead of infinite sets such as the set of positive integers ℤ, where ℤ × ℤ → ℤ | |
The problem with infinite sets, is that I can't represent their elements in Xholon as a small number of specific nodes. | |
But I can do this with some of Ashby's examples. | |
Chapter 1 [1] | |
--------- | |
1/1. Cybernetics was defined by Wiener as “the science of control | |
and communication, in the animal and the machine” | |
1/2. The peculiarities of cybernetics. Many a book has borne the | |
title “Theory of Machines”, but it usually contains information | |
about mechanical things, about levers and cogs. Cybernetics, too, | |
is a “theory of machines”, but it treats, not things but ways of | |
behaving. It does not ask “what is this thing?” but “what does it | |
do?” | |
The truths of cybernetics are not conditional on their being derived from some other branch of science. | |
1/3. Cybernetics stands to the real machine—electronic, mechanical, | |
neural, or economic—much as geometry stands to a real object | |
in our terrestrial space. | |
It takes as its subject-matter the domain of “all possible machines”, | |
and is only secondarily interested if informed that some of them | |
have not yet been made, either by Man or by Nature. What cybernetics | |
offers is the framework on which all individual machines | |
may be ordered, related and understood. | |
1/5. In keeping with this method, which works primarily with the | |
comprehensive and general, cybernetics typically treats any | |
given, particular, machine by asking not “what individual act will | |
it produce here and now?” but “what are all the possible behaviours | |
that it can produce?” | |
Even whether the system is closed to energy or open is often irrelevant; what is important | |
is the extent to which the system is subject to determining and controlling | |
factors. So no information or signal or determining factor | |
may pass from part to part without its being recorded as a significant | |
event. Cybernetics might, in fact, be defined as the study of systems | |
that are open to energy but closed to information and control—systems that are “information-tight”. | |
1/6. The uses of cybernetics. | |
There are, however, two peculiar scientific virtues of cybernetics that | |
are worth explicit mention. | |
One is that it offers a single vocabulary and a single set of concepts | |
suitable for representing the most diverse types of system. | |
It has been found repeatedly in science that the discovery that | |
two branches are related leads to each branch helping in the development | |
of the other. | |
Here I need only mention the | |
fact that cybernetics is likely to reveal a great number of interesting | |
and suggestive parallelisms between machine and brain and | |
society. And it can provide the common language by which discoveries | |
in one branch can readily be made use of in the others. | |
1/7. The complex system. The second peculiar virtue of cybernetics | |
is that it offers a method for the scientific treatment of the system | |
in which complexity is outstanding and too important to be | |
ignored Such systems are, as we well know, only too common in | |
the biological world! | |
Prominent among the methods for dealing with complexity is | |
cybernetics. It rejects the vaguely intuitive ideas that we pick up | |
from handling such simple machines as the alarm clock and the | |
bicycle, and sets to work to build up a rigorous discipline of the subject. | |
Cybernetics offers the hope of providing effective methods for | |
the study, and control, of systems that are intrinsically extremely complex. | |
Chapter 2 | |
--------- | |
2/1. The most fundamental concept in cybernetics is that of “difference”, | |
either that two things are recognisably different or that | |
one thing has changed with time. | |
Often a change occurs continuously, that is, by infinitesimal | |
steps, as when the earth moves through space, or a sunbather’s | |
skin darkens under exposure. The consideration of steps that are | |
infinitesimal, however, raises a number of purely mathematical | |
difficulties, so we shall avoid their consideration entirely. Instead, | |
we shall assume in all cases that the changes occur by finite steps | |
in time and that any difference is also finite. We shall assume that | |
the change occurs by a measurable jump, as the money in a bank | |
account changes by at least a penny. | |
When the differences are finite, all the important questions, | |
as we shall see later, can be decided by simple counting, so | |
that it is easy to be quite sure whether we are right or not. | |
As a simple trick, the discrete can often be carried over into the | |
continuous, in a way suitable for practical purposes, by making a | |
graph of the discrete, with the values shown as separate points. It | |
is then easy to see the form that the changes will take if the points | |
were to become infinitely numerous and close together. | |
KSW - see my Brusselator examples | |
Ashby Terminology (page 10) | |
----------------- | |
operand - that which is acted on | |
transform - what the operand is changed to | |
operator - the factor that acts on the operand | |
transition - the change that occurs | |
transformation - a set of transitions, on a set of operands | |
page 10 - sunshine | |
------- | |
2/2. Next, a few words that will have to be used repeatedly. | |
Consider the simple example in which, under the influence of sunshine, | |
pale skin changes to dark skin. Something, the pale skin, is | |
acted on by a factor, the sunshine, and is changed to dark skin. | |
That which is acted on, the pale skin, will be called the operand, | |
the factor will be called the operator, and what the operand is | |
changed to will be called the transform. The change that occurs, | |
which we can represent unambiguously by | |
pale skin → dark skin | |
is the transition. | |
The transition is specified by the two states and the indication | |
of which changed to which. | |
TRANSFORMATION | |
2/3. The single transition is, however, too simple. Experience has | |
shown that if the concept of “change” is to be useful it must be | |
enlarged to the case in which the operator can act on more than | |
one operand, inducing a characteristic transition in each. Thus the | |
operator “exposure to sunshine” will induce a number of transitions, | |
among which are: | |
cold soil → warm soil | |
unexposed photographic plate → exposed plate | |
coloured pigment → bleached pigment | |
Such a set of transitions, on a set of operands, is a transformation. | |
KSW: | |
- each of these 4 transitions is a change in state on an object, where the operand object is the same as the transform object | |
- sunshine is a Xholon active object | |
- skin, soil, plate, pigment are passive objects, with a state variable that may be discrete (2 possible values) or continuous | |
page 11 - letter transposition code | |
------- | |
Another example of a transformation is given by the simple coding that turns each letter of a message to the one that follows it in the alphabet, | |
Z being turned to A; so CAT would become DBU. The transformation is defined by the table: | |
A → B | |
B → C | |
… | |
Y → Z | |
Z → A | |
For convenience of printing, such a transformation can also be | |
expressed thus: | |
↓ A B … Y Z | |
B C … Z A | |
2/4. Closure. | |
2/5. A transformation may have an infinite number of discrete | |
operands | |
2/6. Notation. Many transformations become inconveniently | |
lengthy if written out in extenso. Already, in S.2/3, we have been | |
forced to use dots ... to represent operands that were not given | |
individually. For merely practical reasons we shall have to | |
develop a more compact method for writing down our transformations. | |
Such as any of these three: | |
Operand → operand plus three | |
Op. → Op. + 3 | |
n → n + 3 (n = 1, 2, 3, 4) | |
2/7. The transformations mentioned so far have all been characterised | |
by being “single-valued”. A transformation is single-valued | |
if it converts each operand to only one transform. | |
2/8. Of the single-valued transformations, a type of some importance | |
in special cases is that which is one-one. In this case the | |
transforms are all different from one another. | |
A transformation that is single-valued but not one-one will be referred to as many-one. | |
2/9. The identity. An important transformation, apt to be dismissed | |
by the beginner as a nullity, is the identical transformation, | |
in which no change occurs, in which each transform is the | |
same as its operand. | |
2/10. Representation by matrix. All these transformations can be | |
represented in a single schema, which shows clearly their mutual | |
relations. | |
Thus every transformation can be shown as a matrix. | |
REPEATED CHANGE | |
2/11. Power. | |
such a transformation may be applied more than once, generating a series of changes analogous to the | |
series of changes that a dynamic system goes through when active | |
Thus, from each closed transformation we can obtain another | |
closed transformation whose effect, if applied once, is identical | |
with the first one’s effect if applied twice. The second is said to be | |
the “square” of the first, and to be one of its “powers” | |
2/12. The trial in the previous exercise will make clear the importance | |
of closure. An unclosed transformation such as W cannot be | |
applied twice; for although it changes h to k, its effect on k is | |
undefined, so it can go no farther. The unclosed transformation is | |
thus like a machine that takes one step and then jams. | |
2/13. Elimination. When a transformation is given in abbreviated | |
arm, such as n' = n + 1, the result of its double application must be found | |
2/14. Higher powers. Higher powers are found simply by adding | |
symbols for higher transforms, n"', etc., and eliminating the symbols | |
for the intermediate transforms. | |
So the triple application causes the same changes as would be | |
caused by a single application of m' = 8m – 21. If the original was T, this is T3. | |
2/15. Notation. The notation that indicates the transform by the | |
addition of a prime (') is convenient if only one transformation is | |
under consideration; but if several transformations might act on n, | |
the symbol n' does not show which one has acted. For this reason, | |
another symbol is sometimes used: if n is the operand, and transformation | |
T is applied, the transform is represented by T(n). | |
2/16. Product. We have just seen that after a transformation T has | |
been applied to an operand n, the transform T(n) can be treated as | |
an operand by T again, getting T(T(n)), which is written T2(n). In | |
exactly the same way T(n) may perhaps become operand to a | |
transformation U, which will give a transform U(T(n)). | |
V is said to be the product or composition of T and U | |
2/17. Kinematic graph. | |
KSW - this is about combining individual edges into a graph | |
Chapter 3 | |
--------- | |
THE DETERMINATE MACHINE | |
3/1. Having now established a clear set of ideas about transforma- | |
tions, we can turn to their first application: the establishment of an | |
exact parallelism between the properties of transformations, as | |
developed here, and the properties of machines and dynamic sys- | |
tems, as found in the real world. | |
determinate machine - that which behaves in the same way as does a closed single-valued transformation. | |
It should be noticed that the definition refers to a way of behav- | |
ing, not to a material thing. We are concerned in this book with | |
those aspects of systems that are determinate—that follow regular | |
and reproducible courses. It is the determinateness that we shall | |
study, not the material substance. | |
this Chapter will deal only with the machine in isolation—the machine to which nothing actively is being done. | |
As a simple and typical example of a determinate machine, con- | |
sider a heavy iron frame that contains a number of heavy beads | |
joined to each other and to the frame by springs. | |
state of a system - any well-defined condition or | |
property that can be recognised if it occurs again. Every system | |
will naturally have many possible states. | |
trajectory or line of behaviour | |
each transform is single-valued | |
examples: | |
- A bacteriological culture that has just been inoculated will | |
increase in “number of organisms present” from hour to hour. | |
- Next consider a clock, in good order and wound, whose hands, | |
pointing now to a certain place on the dial, will point to some | |
determinate place after the lapse of a given time. | |
- A series of changes as regular as those of the clock are not | |
readily found in the biological world, but the regular courses of | |
some diseases show something of the same features. | |
- Next consider an iron casting that has been heated so that its | |
various parts are at various but determinate temperatures. | |
- certain forms of reflex animal behaviour. | |
- male and female threespined stickleback | |
By relating machine and transformation we enter the discipline | |
that relates the behaviours of real physical systems to the proper- | |
ties of symbolic expressions, written with pen on paper | |
To summarise: Every machine or dynamic system has many | |
distinguishable states. If it is a determinate machine, fixing its cir- | |
cumstances and the state it is at will determine, i.e. make unique | |
the state it next moves to. These transitions of state correspond to | |
those of a transformation on operands, each state corresponding to | |
a particular operand. Each state that the machine next moves to | |
corresponds to that operand’s transform. The successive powers | |
of the transformation correspond, in the machine, to allowing | |
double, treble, etc., the unit time-interval to elapse before record- | |
ing the next state. And since a determinate machine cannot go to | |
two states at once, the corresponding transformation must be sin- | |
gle-valued. | |
3/2. Closure. | |
3/3. The discrete machine. | |
3/4. Machine and transformation. | |
The parallelism between | |
machine and transformation is shown most obviously when we | |
compare the machine’s behaviour, as state succeeds state, with the | |
kinematic graph (S.2/17), as the arrows lead from element to ele- | |
ment. | |
VECTORS | |
3/5. | |
“compound” states | |
we are now beginning to consider the relation, most important in machinery that exists | |
between the whole and the parts. Thus, it often happens that the | |
state of the whole is given by a list of the states taken, at that | |
moment, by each of the parts. | |
Such a quantity is a vector, which is defined as a compound | |
entity, having a definite number of components. It is conve- | |
niently written thus: ( a 1 , a 2 , . . ., a n ), which means that the first | |
component has the particular value a 1 , the second the value a 2 , | |
and so on. | |
Here are some well-known examples. | |
(1) A ship’s “position” at any moment cannot be described by a | |
simple number; two numbers are necessary: its latitude and its | |
longitude. “Position” is thus a vector with two components. | |
(2) “The weather at Kew” cannot be specified by a single num- | |
ber, but it can be specified to any desired completeness by our tak- | |
ing sufficient components. An approximation would be the | |
vector: height of barometer, temperature, cloudiness, humidity), | |
and a particular state might be (998 mbars, 56.2°F, 8, 72%). | |
(3) Most of the administrative “forms” that have to be filled in | |
are really intended to define some vector. Thus the form that the | |
motorist has to fill in: | |
Two vectors are considered equal only if each component of | |
the one is equal to the corresponding component of the other. | |
When such a vector is transformed, the operation is in no way | |
different from any other transformation, provided we remember | |
that the operand is the vector as a whole, not the individual com- | |
ponents (though how they are to change is, of course, an essential | |
part of the transformation’s definition). Suppose, for instance, the | |
“system” consists of two coins, each of which may show either | |
Head or Tail. | |
Finally, nothing said so far excludes the possibility that some or | |
all of the components may themselves be vectors! | |
3/6. Notation. | |
3/7. (This section may be omitted.) | |
The previous section is of fundamental importance, for it is an introduction to the methods of | |
mathematical physics, as they are applied to dynamic systems. | |
The reader is therefore strongly advised to work through all the | |
exercises, for only in this way can a real grasp of the principles be | |
obtained. If he has done this, he will be better equipped to appre- | |
ciate the meaning of this section, which summarises the method. | |
3/8. After this discussion of differential equations, | |
3/9. “Unsolvable” equations. | |
3/10. Phase space. | |
3/11. What is a “system”? | |
every material object contains no less than | |
an infinity of variables and therefore of possible systems. | |
KSW - my ideas about modeling discrete systems using unit values (=1) | |
Chapter 4 | |
--------- | |
THE MACHINE WITH INPUT | |
4/1. In the previous chapter we studied the relation between trans- | |
formation and machine, regarding the latter simply as a unit. We | |
now proceed to find, in the world of transformations, what corre- | |
sponds to the fact that every ordinary machine can be acted on by | |
various conditions, and thereby made to change its behaviour, as | |
a crane can be controlled by a driver or a muscle controlled by a | |
nerve. For this study to be made, a proper understanding must be | |
had of what is meant by a “parameter”. | |
References | |
---------- | |
(1) http://pespmc1.vub.ac.be/books/IntroCyb.pdf | |
AN INTRODUCTION TO CYBERNETICS, by W. ROSS ASHBY | |
(2) https://en.wikipedia.org/wiki/Algebraic_structure | |
see my Magma Xholon Workbook | |
One set with operations | |
======================= | |
Simple structures: no binary operation: | |
----------------- | |
Set: a degenerate algebraic structure S having no operations. | |
Pointed set: S has one or more distinguished elements, often 0, 1, or both. | |
Unary system: S and a single unary operation over S. | |
Pointed unary system: a unary system with S a pointed set. | |
example from Ashby page 11, is a Unary system, but it has two unary operations over S (the set of Letters) | |
(3) https://en.wikipedia.org/wiki/William_Ross_Ashby | |
W. Ross Ashby (6 September 1903 in London – 15 November 1972) was an English psychiatrist and a pioneer in cybernetics, | |
the study of the science of communications and automatic control systems in both machines and living things. | |
His first name was not used: he was known as Ross Ashby. | |
His two books, Design for a Brain and An Introduction to Cybernetics, were landmark works. | |
They introduced exact and logical thinking into the brand new discipline of cybernetics and were highly influential. | |
Despite being widely influential within cybernetics, systems theory and, more recently, complex systems, | |
Ashby is not as well known as many of the notable scientists his work influenced, including Herbert A. Simon, Norbert Wiener, Ludwig von Bertalanffy, Stafford Beer, Stanley Milgram, Kevin Warwick, and Stuart Kauffman. | |
Ashby kept a journal for over 44 years in which he recorded his ideas about new theories. | |
He started May 1928, when he was medical student at St. Bartholomew's Hospital in London. | |
Over the years, he wrote down a series of 25 volumes totalling 7,189 pages. | |
In 2003, these journals were given to The British Library, London, and in 2008, they were made available online as The W. Ross Ashby Digital Archive. | |
(4) http://ashby.de/rossashby.info/index.html | |
Ashby's journals | |
(5) https://archive.org/details/designforbrainor00ashb | |
Design For a Brain | |
(6) amazon.ca | |
An Introduction to Cybernetics, $16.48 CDN, paperback reprint | |
Design for a Brain: The Origin of Adaptive Behavior, $17.76 | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<Example/> | |
<Operands/> | |
<Operators/> | |
<!-- example from page 10 --> | |
<Skin/> | |
<Soil/> | |
<PhotographicPlate/> | |
<Pigment/> | |
<Sunshine/> | |
<!-- example from page 11 --> | |
<Letter/> | |
<Letters/> | |
<UncodedMessage superClass="Attribute_String"/> | |
<EncodedMessage superClass="Attribute_String"/> | |
<DecodedMessage superClass="Attribute_String"/> | |
<Encoder/> | |
<Decoder/> | |
<!-- example from page 21-23 --> | |
<KinematicGraph/> | |
<KgNode/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<Sunshine xhType="XhtypePureActiveObject"> | |
<port name="port" index="0" connector="../../Operands/Skin"/> | |
<port name="port" index="1" connector="../../Operands/Soil"/> | |
<port name="port" index="2" connector="../../Operands/PhotographicPlate"/> | |
<port name="port" index="3" connector="../../Operands/Pigment"/> | |
</Sunshine> | |
<KgNode xhType="XhtypePureActiveObject"/> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<!-- example from page 10, Exposure to Sunshine --> | |
<Example roleName="Sunshine"> | |
<Operands> | |
<Skin state="pale"/> | |
<Soil state="cold" temperature="1"/> <!-- 1 degrees C --> | |
<PhotographicPlate state="unexposed"/> | |
<Pigment state="coloured"/> | |
</Operands> | |
<Operators> | |
<Sunshine/> | |
</Operators> | |
</Example> | |
<!-- example from page 11 | |
A single instance of a Set (the letters), | |
with two unary operators (encode, decode). | |
encode: L → L | |
decode: L → L | |
--> | |
<Example roleName="Letter transposition code (page 11)"> | |
<!--<UncodedMessage>CAT</UncodedMessage>--> | |
<UncodedMessage>THE CAT IN THE HAT</UncodedMessage> | |
<EncodedMessage/> <!-- should become DBU --> | |
<DecodedMessage/> <!-- should become CAT --> | |
<Letters> | |
<Letter roleName="A"/> | |
<Letter roleName="B"/> | |
<Letter roleName="C"/> | |
<Letter roleName="D"/> | |
<Letter roleName="E"/> | |
<Letter roleName="F"/> | |
<Letter roleName="G"/> | |
<Letter roleName="H"/> | |
<Letter roleName="I"/> | |
<Letter roleName="J"/> | |
<Letter roleName="K"/> | |
<Letter roleName="L"/> | |
<Letter roleName="M"/> | |
<Letter roleName="N"/> | |
<Letter roleName="O"/> | |
<Letter roleName="P"/> | |
<Letter roleName="Q"/> | |
<Letter roleName="R"/> | |
<Letter roleName="S"/> | |
<Letter roleName="T"/> | |
<Letter roleName="U"/> | |
<Letter roleName="V"/> | |
<Letter roleName="W"/> | |
<Letter roleName="X"/> | |
<Letter roleName="Y"/> | |
<Letter roleName="Z"/> | |
</Letters> | |
<Encoder/> | |
<Decoder/> | |
</Example> | |
<!-- example from page 21-23, Kinematic graph --> | |
<Example roleName="Kinematic graph (page 21-23)"> | |
<Attribute_String roleName="T"> | |
T: ↓ | |
A B C D E F G H I J K L M N P Q | |
D H D I Q G Q H A E E N B A N E | |
</Attribute_String> | |
<Script><![CDATA[ | |
var me = this.parent(); // Example node | |
var str = me.first().text(); | |
me.first().remove(); | |
var strArr = str.split("\n"); | |
var nodesStr = strArr[1]; | |
var targetNodesStr = strArr[2]; | |
var nodesArr = nodesStr.split(" "); | |
var targetNodesArr = targetNodesStr.split(" "); | |
var xmlStr = "<KinematicGraph>\n"; | |
for (var i = 0; i < nodesArr.length; i++) { | |
xmlStr += ' <KgNode roleName="' + nodesArr[i] + '">' | |
xmlStr += ' <port name="port" index="0" connector="../KgNode[@roleName=' + "'" + targetNodesArr[i] + "'" + ']"/>'; | |
xmlStr += ' </KgNode>\n' | |
} | |
xmlStr += "</KinematicGraph>\n"; | |
me.append(xmlStr); | |
//# sourceURL=KgScript.js | |
]]></Script> | |
<!-- an instance of KinematicGraph will be added here, along with multiple instances of KgNode --> | |
</Example> | |
</PhysicalSystem> | |
<Sunshinebehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
$wnd.xh.root().append(this.cnode.remove()); | |
}, | |
act: function() { | |
var msgData = "sunshine"; | |
var portNum = 0; | |
var portInst = me.port(portNum); | |
while (portInst) { | |
portInst.msg(101, msgData, me); | |
portNum++; | |
portInst = me.port(portNum); | |
} | |
} | |
} | |
//# sourceURL=Sunshinebehavior.js | |
]]></Sunshinebehavior> | |
<Skinbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
//$wnd.xh.root().append(this.cnode.remove()); // behavior must be a direct child of me in order to receive forwarded messages | |
}, | |
act: function() { | |
me.println(me.xhc().name() + " state: " + me["state"]); | |
}, | |
processReceivedMessage: function(msg) { | |
me.println(me.xhc().name() + " received message '" + msg.data + "' from " + msg.sender.name()); | |
me["state"] = "dark"; | |
} | |
} | |
//# sourceURL=Skinbehavior.js | |
]]></Skinbehavior> | |
<Soilbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
}, | |
act: function() { | |
me.println(me.xhc().name() + " state: " + me["state"] + " temperature: " + me["temperature"]); | |
}, | |
processReceivedMessage: function(msg) { | |
me.println(me.xhc().name() + " received message '" + msg.data + "' from " + msg.sender.name()); | |
me["temperature"] = me["temperature"] * 1.2; | |
if (me["temperature"] > 10) { | |
me["state"] = "warm"; | |
} | |
} | |
} | |
//# sourceURL=Soilbehavior.js | |
]]></Soilbehavior> | |
<PhotographicPlatebehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
}, | |
act: function() { | |
me.println(me.xhc().name() + " state: " + me["state"]); | |
}, | |
processReceivedMessage: function(msg) { | |
me.println(me.xhc().name() + " received message '" + msg.data + "' from " + msg.sender.name()); | |
me["state"] = "exposed"; | |
} | |
} | |
//# sourceURL=PhotographicPlatebehavior.js | |
]]></PhotographicPlatebehavior> | |
<Pigmentbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
}, | |
act: function() { | |
me.println(me.xhc().name() + " state: " + me["state"]); | |
}, | |
processReceivedMessage: function(msg) { | |
me.println(me.xhc().name() + " received message '" + msg.data + "' from " + msg.sender.name()); | |
me["state"] = "bleached"; | |
} | |
} | |
//# sourceURL=Pigmentbehavior.js | |
]]></Pigmentbehavior> | |
<Lettersbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
this.cnode.remove(); | |
var ltr = me.first(); | |
while (ltr) { | |
// encoding | |
var nxtLtr = ltr.next(); | |
if (nxtLtr == null) { | |
nxtLtr = me.first(); | |
} | |
ltr.transformE = nxtLtr; | |
// decoding | |
var prvLtr = ltr.prev(); | |
if (prvLtr == null) { | |
prvLtr = me.last(); | |
} | |
ltr.transformD = prvLtr; | |
// | |
ltr = ltr.next(); | |
} | |
} | |
} | |
//# sourceURL=Lettersbehavior.js | |
]]></Lettersbehavior> | |
<Encoderbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
this.cnode.remove(); | |
var ltrsNode = me.xpath("../Letters"); | |
var umsgNode = me.xpath("../UncodedMessage"); | |
var emsgNode = me.xpath("../EncodedMessage"); | |
var umsg = umsgNode.text(); | |
var emsg = ""; | |
for (var i = 0; i < umsg.length; i++) { | |
var ultr = umsg[i]; | |
var eltrNode = ltrsNode.xpath("Letter[@roleName='" + ultr + "']"); | |
if (eltrNode) { | |
emsg += eltrNode.transformE.role(); | |
} | |
else { | |
emsg += ultr; | |
} | |
} | |
emsgNode.text(emsg); | |
} | |
} | |
//# sourceURL=Encoderbehavior.js | |
]]></Encoderbehavior> | |
<Decoderbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
this.cnode.remove(); | |
var ltrsNode = me.xpath("../Letters"); | |
var emsgNode = me.xpath("../EncodedMessage"); | |
var dmsgNode = me.xpath("../DecodedMessage"); | |
var emsg = emsgNode.text(); | |
var dmsg = ""; | |
for (var i = 0; i < emsg.length; i++) { | |
var eltr = emsg[i]; | |
var dltrNode = ltrsNode.xpath("Letter[@roleName='" + eltr + "']"); | |
//dmsg += dltrNode.transformD.role(); | |
if (dltrNode) { | |
dmsg += dltrNode.transformD.role(); | |
} | |
else { | |
dmsg += eltr; | |
} | |
} | |
dmsgNode.text(dmsg); | |
} | |
} | |
//# sourceURL=Decoderbehavior.js | |
]]></Decoderbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Letters</title> | |
<rect id="PhysicalSystem/Example[2]/Letters" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Sunshine</title> | |
<rect id="PhysicalSystem/Example[1]/Operators/Sunshine" fill="#6AB06A" height="50" width="10" x="80" y="0"/> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment