Model circuit


A qualitative model of the circuit.

Source: PROLOG programming for artificial intelligence, 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7.


Program source code:


% Figure 20.11  A qualitative model of the circuit in Figure 20.10.
:-  op( 220, xfy, ..).
%  Qualitative model of electric circuit with resistor and capacitors
landmarks( volt, [minf, zero, v0, inf]).   % Voltage on capacitors
landmarks( voltR, [minf, zero, v0, inf]).  % Voltage on resistor
landmarks( current, [minf, zero, inf]).
correspond( voltR:zero, current:zero).
legalstate( [ UC1, UC2, UR, CurrR])  :-
  sum( UR, UC2, UC1),
  mplus( UR, CurrR),                  % Ohm's law for resistor
  deriv( UC2, CurrR),
  sum( CurrR, current:CurrC1, current:zero/std),   % CurrC1 = - CurrR
  deriv( UC1, current:CurrC1).        % CurrC1 = d/dt UC1
initial( [ volt:v0/dec, volt:zero/inc, voltR:v0/dec, current:zero..inf/dec]).


pl/prolog/pllib/model_circuit.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna) Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0