Discussion:
how to handle . . . ?
Add Reply
Jens Kallup
2020-06-24 01:37:27 UTC
Reply
Permalink
Hello Group,

I have following Situation:
__
___|| <- 1x switch (1x in & out
+---/ ------+ <- 2x (1x open) wire port in/out (2x1 in closed)
| |
| | <- 2x wire port in/out
+---[+] [-]---+ <- 2x wire +/-
| |
+-+ +-+
| Power | <- 1x power source/supply
+-------+

following code:

;; collectors/port's - plus, and minus polarisation != 0
(defstruct ports
(pport 0.0 :type short-float) ; positive Pol : default 0 - off
(mport 0.0 :type short-float) ; negative Pol : default 0 - off
)
;; power/energy source stdandard type ...
(defstruct (power-source
(:include ports))
(volt 9.0 :type short-float) ; voltage/Spannung: default 9.0
)
;; definition of a wire.
(defstruct (wire
(:include ports))
)
;; definition of a switch.
(defstruct (switch
(:include ports))
)
;; definition of a LED.
;; color: RGB value red-green-blue
(defstruct (led
(:include ports))
(color '(255 255 255) :type list) ; color RGB: default: white
)

;; ----------------------------------------
;; pre-pare application ...
;; ----------------------------------------
;; variables:
(defvar power-source-1 (make-power-source
:mport 0.0
:pport 0.0)
)
(defvar switch-1 (make-switch
:mport 0.0
:pport 0.0)
)
(defvar led-1 (make-led
:mport 0.0
:pport 0.0)
)


Question:
How can I create an releation or connection of
all components, so, when I press the switch (by giving
mport/pport a value, the power stream streams through
all components?

Jens
Jens Kallup
2020-06-24 02:04:49 UTC
Reply
Permalink
as example:

(defvar wire-0 (make-wire))
(defvar wire-1 (make-wire
:pport (switch-mport switch-1)
:mport (wire-pport wire-0) ; how todo next?
)
)
Madhu
2020-06-24 02:25:46 UTC
Reply
Permalink
Post by Jens Kallup
(defvar wire-0 (make-wire))
(defvar wire-1 (make-wire
:pport (switch-mport switch-1)
:mport (wire-pport wire-0) ; how todo next?
)
)
Is this homework?

To model connections as a "graph" the wire would have to be an "edge" it
would have to have (at least) two ends. It would connect to "nodes" -
then you can write functions to propagate signals.

I'd start with a graph implementation which already implemented a model
of propagation.
Jens Kallup
2020-06-24 03:55:13 UTC
Reply
Permalink
Post by Madhu
Is this homework?
Hello Madu,
no homework, simply new.

(defvar wire-1 (make-wire))
(defvar wire-2 (make-wire))
(defvar wire-3 (make-wire))
(defvar wire-4 (make-wire))
(defvar wire-5 (make-wire))
(defvar wire-6 (make-wire))
(defvar wire-7 (make-wire))
(defvar wire-8 (make-wire))
(defvar wire-9 (make-wire))
(defvar wire-10 (make-wire))

; switch 1 mport => pport - wire 8
; switch 1 pport => mport - power -
(defvar switch-1 (make-switch
:mport ( wire-pport wire-8)
:pport ( power-source-mport power-source-1)))

; wire 8 mport => pport & wire 9
; wire 8 pport => mport & switch-1
(defvar wire-8 (make-wire
:mport ( wire-pport wire-9)
:pport ( switch-mport switch-1)))

; wire 9 mport => pport - power +
; wire 9 pport => mport - wire 8
(defvar wire-9 (make-wire
:mport ( power-source-pport power-source-1)
:pport ( wire-mport wire-8)))

I have this simply graph.
The question is still: How did I implement a simulation,
and how to extend switch-1, with a flag, for open/close.
How can I do calculation the p/mport values, when a voltage
is on/off.
Madhu
2020-06-24 04:50:35 UTC
Reply
Permalink
I don't really understand how you are modeling it to make any
suggestions

I remember there was
a discussion on CLL thread "Re: a "dispatch"-ing object system in CL"
from October 2007 involving Eli Bendersky when I posted some code about
"propagation" in a half adder Message-ID
<***@robolove.meer.net> - sorry I cant use the google product
for a more accessible reference.

There was also a discussion in April 2007 from Frank Buss on "dataflow
basics" Message-ID: <1ky35tbjpdcr1$.xnfs62zmvz2l$***@40tude.net>
which dealt with the issue.

I think I saw some more recent posts/ blogposts where lisp was used for
demonstrating CELLS/KR (Knowledge Representation)/REACTIVE paradigms
which used switches and gates to do the exact same thing you are doing
but my brain is not working at the moment to look that up
t***@google.com
2020-06-25 23:29:48 UTC
Reply
Permalink
Post by Jens Kallup
Hello Group,
__
___|| <- 1x switch (1x in & out
+---/ ------+ <- 2x (1x open) wire port in/out (2x1 in closed)
| |
| | <- 2x wire port in/out
+---[+] [-]---+ <- 2x wire +/-
| |
+-+ +-+
| Power | <- 1x power source/supply
+-------+
[snip]
How can I create an releation or connection of
all components, so, when I press the switch (by giving
mport/pport a value, the power stream streams through
all components?
I think you should first come up with a good model of the topography of your
circuit, like Madhu suggests.

Some papers you could consider consulting would be Walter Hamscher's work from 1991 and earlier: https://dblp.org/pers/h/Hamscher:Walter.html
Some of the papers are available at no cost.

One of the basic ideas of the modeling is to have "components", which are elements of the circuit that do things. The components have "ports", which have
an inside and outside. The inside is used internally in the logic of the port
to achieve the effect that you want. The outside is used to connect different
components to each other. You may also want to have "state" for some components
such as a switch.

You would still need to build a system for running a simulation or if it is
just a simple combinatoric circuit, the value propagation.

Also, as far as modeling is concerned, if you use the :INCLUDE option in a
DEFSTRUCT definition, you will make the new type a sub-type of the included
item. That may not be what you want. Do you intend to say, for example, that
a switch is a specialized type of port? I think it will be better to
differentiate between subclassing and having components (the precise term I'm
looking for eludes me right now -- is it aggregation?).
g***@gmail.com
2020-06-27 00:35:06 UTC
Reply
Permalink
Post by t***@google.com
Post by Jens Kallup
Hello Group,
__
___|| <- 1x switch (1x in & out
+---/ ------+ <- 2x (1x open) wire port in/out (2x1 in closed)
| |
| | <- 2x wire port in/out
+---[+] [-]---+ <- 2x wire +/-
| |
+-+ +-+
| Power | <- 1x power source/supply
+-------+
[snip]
How can I create an releation or connection of
all components, so, when I press the switch (by giving
mport/pport a value, the power stream streams through
all components?
I think you should first come up with a good model of the topography of your
circuit, like Madhu suggests.
Some papers you could consider consulting would be Walter Hamscher's work from 1991 and earlier: https://dblp.org/pers/h/Hamscher:Walter.html
Some of the papers are available at no cost.
One of the basic ideas of the modeling is to have "components", which are elements of the circuit that do things. The components have "ports", which have
an inside and outside. The inside is used internally in the logic of the port
to achieve the effect that you want. The outside is used to connect different
components to each other. You may also want to have "state" for some components
such as a switch.
You would still need to build a system for running a simulation or if it is
just a simple combinatoric circuit, the value propagation.
Also, as far as modeling is concerned, if you use the :INCLUDE option in a
DEFSTRUCT definition, you will make the new type a sub-type of the included
item. That may not be what you want. Do you intend to say, for example, that
a switch is a specialized type of port? I think it will be better to
differentiate between subclassing and having components (the precise term I'm
looking for eludes me right now -- is it aggregation?).
I would do a ROLE PLAYING GAME where you play 1 electron


YOU ARE AT pos

YOU CAN [go batt] [go light]
YOU CAN [drop finger] [drop switch]
YOU CAN [use finger ] [use switch ]


[use finger] [with switch]

the circuit is open




Try GAME MAKER at www.miniBASE.com you can lock doors preventing FLOW
Loading...