proc SCHEMATIC_optical_modulator {} {
make output -name out_i -origin {370 -150}
make output -name out_q -origin {370 80}
make cos_sq_func -name xi1 -origin {170 -80}
make sin_sq_func -name xi2 -origin {170 10}
make multiplier -name xi3 -origin {290 -150}
make multiplier -orient RY -name xi4 -origin {290 80}
make input -name optical_in -origin {-260 -150}
make input -name electrical_in -origin {-490 230}
make add2 -name xi6 -origin {0 230}
make constant -name xi7 -consval 1/4 -origin {-90 380}
make gain -name xi5 -gain 1/vpi -origin {-360 230}
make name_net -name phi -origin {80 -80}
make name_net -name el1 -origin {-280 230}
make resonant_bandpass -name xi0 -fo fo -Q Q -origin {-150 230}
  make_wire 330 -150 370 -150
  make_wire 330 80 370 80
  make_wire 230 10 290 10
  make_wire 230 -80 290 -80
  make_wire -200 -150 -200 80
  make_wire -200 80 250 80
  make_wire -200 -150 -260 -150
  make_wire -200 -150 250 -150
  make_wire 70 230 30 230
  make_wire 0 260 0 380
  make_wire -50 380 0 380
  make_wire 70 10 120 10
  make_wire 290 10 290 40
  make_wire 290 -110 290 -80
  make_wire 70 -80 70 10
  make_wire 70 10 70 230
  make_wire 80 -80 70 -80
  make_wire 80 -80 120 -80
  make_wire -280 230 -310 230
  make_wire -490 230 -400 230
  make_wire -70 230 -30 230
  make_wire -230 230 -280 230
}

proc ICON_optical_modulator args {

  icon_setup $args {{origin {0 0}} {orient R0} {name x} {fo 1.0} {Q 1.0} {vpi 1.0}}
icon_term -type output -origin {70 -20} -name out_i
icon_term -type output -origin {70 10} -name out_q
icon_term -type input -origin {-70 -20} -name optical_in
icon_term -type input -origin {-70 10} -name electrical_in
icon_property -origin {-70 -50} -label {$name}
icon_property -origin {-20 60} -label {fo = $fo Hz}
  icon_property -origin {-70 130} -type user -name name -default x
  icon_property -origin {-70 150} -type user -name fo -default 1.0
icon_property -origin {-60 40} -label optical_modulator
  icon_line -70 -40 70 -40 70 50 -70 50 -70 -40
icon_property -origin {-20 80} -label {Q = $Q}
icon_property -origin {-20 100} -label {vpi = $vpi}
  icon_property -origin {-70 170} -type user -name Q -default 1.0
  icon_property -origin {-70 190} -type user -name vpi -default 1.0
icon_property -origin {-60 -20} -label opt_in
icon_property -origin {-60 10} -label elec_in
icon_property -origin {60 -20} -anchor e -label out_i
icon_property -origin {60 10} -anchor e -label out_q

}

