<?xml version="1.0" encoding="UTF-8"?>
<net name="Event_LE_to_GT" type="iopt-flow">
  <signal id="max" x="115" y="310" mode="input" type="range" min="0" max="100" frac="0" value="0" dynamic="none" io_pin="0"/>
  <signal id="min" x="115" y="365" mode="input" type="range" min="0" max="100" frac="0" value="0" dynamic="none" io_pin="0"/>
  <signal id="Valid_In" x="120" y="260" mode="input" type="boolean" min="0" max="1"/>
  <signal id="ValidOut" x="1020" y="425" mode="output" type="boolean" min="0" max="1" dynamic="type" frac="0"/>
  <operation id="o1" x="195" y="165" rot="0" shape="arrow" size="32">
    <name off_x="-27" off_y="-32" text="o1"/>
    <input off_x="-32" off_y="-16" name="signal" id="o1.signal" type="range" min="-32768" max="32767" frac="0"/>
    <input off_x="-32" off_y="0" name="k" id="o1.k" type="range" min="-32768" max="32767" frac="0"/>
    <input off_x="-32" off_y="16" name="delta" id="o1.delta" type="range" min="-32768" max="32767" frac="0"/>
    <output off_x="32" off_y="0" name="out" id="o1.out" type="event" min="0" max="1" dynamic="none" frac="0">
      <expression>
        <operand type="sub-expression">
          <operand type="signal" idRef="signal" delay="1"/>
          <operator type="less-or-equal"/>
          <operand type="signal" idRef="k"/>
        </operand>
        <operator type="and"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="signal"/>
          <operator type="more"/>
          <operand type="signal" idRef="k"/>
        </operand>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="delta"/>
          <operator type="equal"/>
          <operand type="literal" value="0"/>
        </operand>
        <text>(signal[-1] &lt;= k) AND (signal &gt; k) WHEN (delta = 0)</text>
      </expression>
      <expression>
        <operand type="sub-expression">
          <operand type="sub-expression">
            <operand type="signal" idRef="signal" delay="1"/>
            <operator type="sub"/>
            <operand type="signal" idRef="signal" delay="2"/>
          </operand>
          <operator type="less-or-equal"/>
          <operand type="signal" idRef="k"/>
        </operand>
        <operator type="and"/>
        <operand type="sub-expression">
          <operand type="sub-expression">
            <operand type="signal" idRef="signal"/>
            <operator type="sub"/>
            <operand type="signal" idRef="signal" delay="1"/>
          </operand>
          <operator type="more"/>
          <operand type="signal" idRef="k"/>
        </operand>
        <text>((signal[-1] - signal[-2]) &lt;= k) AND ((signal - signal[-1]) &gt; k) OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="signal" x="115" y="115" mode="input" type="range" min="-1000" max="1000" frac="0" value="0" dynamic="none" io_pin="0"/>
  <signal id="k" x="120" y="165" mode="input" type="range" min="0" max="1000" frac="0" value="0" dynamic="none" io_pin="0"/>
  <signal id="delta" x="120" y="210" mode="input" type="range" min="0" max="100" frac="0" value="0" dynamic="none" io_pin="0"/>
  <event id="evout" x="385" y="115" mode="output"/>
  <arc id="a3" type="read" source="signal" target="o1.signal"/>
  <arc id="a7" type="read" source="k" target="o1.k"/>
  <arc id="a1" type="read" source="delta" target="o1.delta"/>
  <arc id="a4" type="read" source="o1.out" target="evout"/>
  <operation id="o3" x="425" y="210" rot="0" shape="arrow" size="25" locked="true">
    <name text="AND" off_x="-12" off_y="-5"/>
    <input id="o3.Valid_In" name="Valid_In" type="boolean" dynamic="name" off_x="-25" off_y="-10"/>
    <input id="o3.o1" name="o1" type="event" dynamic="name" off_x="-25" off_y="10" min="0" max="1" frac="0"/>
    <output id="o3.out" name="out" type="event" off_x="25" off_y="0" min="0" max="1" frac="0">
      <expression>
        <text>Valid_In AND o1</text>
        <operand type="signal" idRef="Valid_In"/>
        <operator type="and"/>
        <operand type="signal" idRef="o1"/>
      </expression>
    </output>
  </operation>
  <arc id="a6" type="read" source="o1.out" target="o3.o1"/>
  <arc id="a11" type="read" source="Valid_In" target="o3.Valid_In"/>
  <event id="MevOut" x="730" y="160" mode="output"/>
  <operation id="o33" x="870" y="400" rot="0" shape="arrow" size="32">
    <name off_x="-27" off_y="-32" text="o33"/>
    <input off_x="-32" off_y="-16" name="max" id="o33.max" type="range" min="-32768" max="32767" frac="0"/>
    <input off_x="-32" off_y="0" name="count" id="o33.count" type="range" min="-32768" max="32767" frac="0"/>
    <input off_x="-32" off_y="16" name="min" id="o33.min" type="range" min="-32768" max="32767" frac="0"/>
    <output off_x="32" off_y="0" name="out" id="o33.out" type="boolean" min="0" max="1" dynamic="type" frac="0">
      <expression>
        <operand type="sub-expression">
          <operand type="signal" idRef="count"/>
          <operator type="more-or-equal"/>
          <operand type="signal" idRef="min"/>
        </operand>
        <operator type="and"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="count"/>
          <operator type="less-or-equal"/>
          <operand type="signal" idRef="max"/>
        </operand>
        <text>(count &gt;= min) AND (count &lt;= max)</text>
      </expression>
    </output>
  </operation>
  <arc id="a35" type="read" source="o33.out" target="ValidOut"/>
  <arc id="a36" type="read" source="max" target="o33.max"/>
  <arc id="a37" type="read" source="min" target="o33.min"/>
  <arc id="a5" type="read" source="o3.out" target="MevOut"/>
  <operation id="o001" x="615" y="300" rot="0" shape="arrow" size="32">
    <name off_x="-27" off_y="-32" text="o001"/>
    <input off_x="-32" off_y="-16" name="event" id="o001.event" type="event" min="0" max="1" frac="0"/>
    <input off_x="-32" off_y="0" name="max" id="o001.max" type="range" min="0" max="100" dynamic="all" frac="0"/>
    <input off_x="-32" off_y="16" name="o001" id="o001.o001" type="range" min="-32768" max="32767" dynamic="all" frac="0"/>
    <output off_x="32" off_y="0" name="count" id="o001.count" type="range" min="-32768" max="32767" dynamic="type" frac="0">
      <expression>
        <operand type="literal" value="0"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="event"/>
          <operator type="equal"/>
          <operand type="literal" value="1"/>
        </operand>
        <text>0 WHEN (event = 1)</text>
      </expression>
      <expression>
        <operand type="sub-expression">
          <operand type="signal" idRef="o001" delay="1"/>
          <operator type="add"/>
          <operand type="literal" value="1"/>
        </operand>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="event"/>
          <operator type="equal"/>
          <operand type="literal" value="0"/>
          <operator type="and"/>
          <operand type="sub-expression">
            <operand type="signal" idRef="o001"/>
            <operator type="more"/>
            <operand type="sub-expression">
              <operand type="signal" idRef="max"/>
            </operand>
          </operand>
        </operand>
        <text>(o001[-1] + 1) WHEN (event = 0 AND (o001 &gt; (max)))</text>
      </expression>
      <expression>
        <operand type="sub-expression">
          <operand type="signal" idRef="o001" delay="1"/>
        </operand>
        <text>(o001[-1]) OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="a002" type="read" source="o3.out" target="o001.event"/>
  <arc id="a003" type="read" source="o001.count" target="o001.o001" view="symbolic"/>
  <arc id="a004" type="read" source="max" target="o001.max"/>
  <arc id="a005" type="read" source="o001.count" target="o33.count"/>
</net>
