Show
Ignore:
Timestamp:
10/19/2007 02:48:05 PM (15 months ago)
Author:
clauss
Message:

error fixed: Within gates the number of inputs was not given to the included Basic model correctly. Additionally: pulse source redesigned according to Martins proposal. comment at Logic type changed - useful for parameter setup e.g. in the component modifier window in Dymola

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Modelica/branches/maintenance/2.2.2/Modelica/Electrical/Digital.mo

    r597 r719  
    24822482      constant Integer min=1; 
    24832483      constant Integer max=9; 
    2484       constant Integer 'U'=1 "Uninitialized"; 
    2485       constant Integer 'X'=2 "Forcing Unknown"; 
    2486       constant Integer '0'=3 "Forcing 0"; 
    2487       constant Integer '1'=4 "Forcing 1"; 
    2488       constant Integer 'Z'=5 "High Impedance"; 
    2489       constant Integer 'W'=6 "Weak    Unknown"; 
    2490       constant Integer 'L'=7 "Weak    0"; 
    2491       constant Integer 'H'=8 "Weak    1"; 
    2492       constant Integer '-'=9 "Don't care"; 
     2484      constant Integer 'U'=1 "U  Uninitialized"; 
     2485      constant Integer 'X'=2 "Forcing Unknown"; 
     2486      constant Integer '0'=3 "Forcing 0"; 
     2487      constant Integer '1'=4 "Forcing 1"; 
     2488      constant Integer 'Z'=5 "High Impedance"; 
     2489      constant Integer 'W'=6 "W  Weak    Unknown"; 
     2490      constant Integer 'L'=7 "Weak    0"; 
     2491      constant Integer 'H'=8 "Weak    1"; 
     2492      constant Integer '-'=9 "Don't care"; 
    24932493      annotation (Documentation(info="<html> 
    24942494<p><b>Code Table:</b></p> 
     
    33953395      extends D.Interfaces.MISO; 
    33963396      extends D.Delay.DelayParams; 
    3397       D.Basic.And G1(final n)     annotation (extent=[-40, -20; 0, 20]); 
     3397      D.Basic.And G1(final n=n)     annotation (extent=[-40, -20; 0, 20]); 
    33983398      D.Delay.InertialDelaySensitive G2( 
    33993399        tLH=tLH, 
     
    35193519        Diagram, 
    35203520        DymolaStoredErrors); 
    3521       D.Basic.Nand G1(final n)      annotation (extent=[-40,-20; 0,20]); 
     3521      D.Basic.Nand G1(final n=n)      annotation (extent=[-40,-20; 0,20]); 
    35223522      D.Delay.InertialDelaySensitive G2( 
    35233523        tLH=tLH, 
     
    35373537      extends D.Delay.DelayParams; 
    35383538      extends D.Interfaces.MISO; 
    3539       D.Basic.Or G1(final n)    annotation (extent=[-40, -20; 0, 20]); 
     3539      D.Basic.Or G1(final n=n)    annotation (extent=[-40, -20; 0, 20]); 
    35403540      D.Delay.InertialDelaySensitive G2( 
    35413541        tLH=tLH, 
     
    35913591      extends D.Delay.DelayParams; 
    35923592      extends D.Interfaces.MISO; 
    3593       D.Basic.Nor G1(final n)     annotation (extent=[-40, -20; 0, 20]); 
     3593      D.Basic.Nor G1(final n=n)     annotation (extent=[-40, -20; 0, 20]); 
    35943594      D.Delay.InertialDelaySensitive G2( 
    35953595        tLH=tLH, 
     
    36513651      extends D.Delay.DelayParams; 
    36523652      extends D.Interfaces.MISO; 
    3653       D.Basic.Xor G1(final n)     annotation (extent=[-40, -20; 0, 20]); 
     3653      D.Basic.Xor G1(final n=n)     annotation (extent=[-40, -20; 0, 20]); 
    36543654      D.Delay.InertialDelaySensitive G2( 
    36553655        tLH=tLH, 
     
    37053705      extends D.Delay.DelayParams; 
    37063706      extends D.Interfaces.MISO; 
    3707       D.Basic.Xnor G1(final n)      annotation (extent=[-40,-20; 0,20]); 
     3707      D.Basic.Xnor G1(final n=n)      annotation (extent=[-40,-20; 0,20]); 
    37083708      D.Delay.InertialDelaySensitive G2( 
    37093709        tLH=tLH, 
     
    41134113      D.Interfaces.DigitalOutput y  
    41144114                    annotation (extent=[90,-10; 110,10]); 
    4115     algorithm  
    4116       if nperiod == 0 then 
    4117         y := quiet; 
    4118       elseif (nperiod >= np) or (nperiod < 0) then 
    4119         when sample(startTime, period) then 
    4120           T0 := time; 
    4121           if (nperiod > 0) then 
    4122             np := np + 1; 
    4123           end if; 
    4124         end when; 
    4125         y := if (time < startTime or time >= T0 + ((width*period)/ 
    4126           100)) or not (nperiod >= np or nperiod < 0) then quiet else pulse; 
     4115    protected  
     4116      Boolean sampling; 
     4117    equation  
     4118      sampling = nperiod <> 0 and (nperiod >= pre(np) or nperiod < 0); 
     4119       
     4120      when sampling and sample(startTime, period) then 
     4121         T0 = time; 
     4122         np = if nperiod > 0 then pre(np) + 1 else pre(np); 
     4123      end when; 
     4124       
     4125      if sampling then 
     4126         y = if time < startTime or time >= T0 + ((width*period)/100) then quiet else pulse; 
    41274127      else 
    4128         y := quiet; 
     4128         y = quiet; 
    41294129      end if; 
     4130       
    41304131      annotation (Documentation(info="<HTML> 
    41314132<P>