diff --git a/openair1/SIMULATION/LTE_PHY_L2/COPYING b/openair1/SIMULATION/LTE_PHY_L2/COPYING
deleted file mode 100644
index 818433ecc0e094a4db1023c68b33f24344643ad8..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY_L2/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/openair1/SIMULATION/LTE_PHY_L2/Makefile b/openair1/SIMULATION/LTE_PHY_L2/Makefile
deleted file mode 100644
index 96cd65c22cfe8c4ce79972e441b97fb2aee9681a..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY_L2/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-include $(OPENAIR_HOME)/common/utils/Makefile.inc
-TOP_DIR      = ../..
-OPENAIR1_TOP = ../..
-OPENAIR2_TOP = ../../../openair2
-OPENAIR3_TOP = ../../../openair3
-OPENAIR3     = $(OPENAIR3_DIR)
-
-CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
-
-ASN1_MSG_INC = ../../../openair2/RRC/LITE/MESSAGES
-
-CFLAGS += -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE 
-
-#CFLAGS += -DXFORMS
-
-ifdef DEBUG_PHY
-CFLAGS += -DDEBUG_PHY
-endif
-
-ifdef NAS_NETLINK
-CFLAGS += -DNAS_NETLINK -DLINUX
-LINUX=1
-endif
-
-CFLAGS += -DPHY_ABSTRACTION #:wq
--DEMIT_ASN_DEBUG=1
-
-ifdef OCG
-CFLAGS += -I/usr/include/libxml2 -lxml2
-endif
-
-include $(OPENAIR1_DIR)/PHY/Makefile.inc
-include $(OPENAIR1_DIR)/SCHED/Makefile.inc
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-SIMULATION_OBJS  = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o  
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o  
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o  
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/taus.o  
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/multipath_channel.o
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/rf.o
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/adc.o
-SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/dac.o
-
-OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(ASN1_MSG_OBJS)
-
-all: physim
-
-
-$(OBJ) : %.o : %.c
-	$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o $@ $<
-
-$(L2_OBJS) : %.o : %.c
-	$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o $@ $<
-
-physim : $(OBJ) $(L2_OBJS) phy_procedures_sim.c phy_procedures_sim_form.c 
-	$(CC)  phy_procedures_sim.c phy_procedures_sim_form.c -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o physim $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(L2_OBJS) -lm -lforms -L/usr/local/lib -lforms -lX11 -L/usr/X11R6/lib -lXpm -lblas -lpthread
-
-clean:
-	rm -f physim
-	rm -f $(OBJ)
-	rm -f $(L2_OBJS)
-	rm -f *.o
-	rm -f *.exe*
-
-cleanl1:
-	rm -f physim
-	rm -f $(OBJ)
-	rm -f *.o
-	rm -f *.exe
-cleanl2:
-	rm -f $(L2_OBJS)
diff --git a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim.c b/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim.c
deleted file mode 100644
index 90ad3d8688ec5a9f08d140ea0f928f72a4580518..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim.c
+++ /dev/null
@@ -1,1472 +0,0 @@
-/*******************************************************************************
-    OpenAirInterface
-    Copyright(c) 1999 - 2014 Eurecom
-
-    OpenAirInterface is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-
-    OpenAirInterface is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenAirInterface.The full GNU General Public License is
-   included in this distribution in the file called "COPYING". If not,
-   see <http://www.gnu.org/licenses/>.
-
-  Contact Information
-  OpenAirInterface Admin: openair_admin@eurecom.fr
-  OpenAirInterface Tech : openair_tech@eurecom.fr
-  OpenAirInterface Dev  : openair4g-devel@eurecom.fr
-
-  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
-
- *******************************************************************************/
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-#include "SIMULATION/TOOLS/defs.h"
-#include "SIMULATION/RF/defs.h"
-#include "PHY/types.h"
-#include "PHY/defs.h"
-#include "PHY/vars.h"
-#include "MAC_INTERFACE/vars.h"
-
-#ifdef OPENAIR2
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/vars.h"
-#include "UTIL/LOG/log_if.h"
-#include "UTIL/LOG/log_extern.h"
-#include "RRC/MESH/vars.h"
-#include "PHY_INTERFACE/vars.h"
-#ifdef OCG
-#include "UTIL/OCG/OCG.h"
-#include "OCG_extern.h"
-#endif
-#endif
-
-#include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
-
-#ifdef IFFT_FPGA
-#include "PHY/LTE_REFSIG/mod_table.h"
-#endif
-
-#include "SCHED/defs.h"
-#include "SCHED/vars.h"
-
-#ifdef XFORMS
-#include "forms.h"
-#include "phy_procedures_sim_form.h"
-#endif
-
-#define DEBUG_PHY
-#define RF
-
-//#define DEBUG_SIM
-
-#define BW 7.68
-
-#define N_TRIALS 1
-
-/*
-  DCI0_5MHz_TDD0_t          UL_alloc_pdu;
-  DCI1A_5MHz_TDD_1_6_t      CCCH_alloc_pdu;
-  DCI2_5MHz_2A_L10PRB_TDD_t DLSCH_alloc_pdu1;
-  DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2;
-*/
-
-#define UL_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,24)
-#define CCCH_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,3)
-#define RA_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,3)
-#define DLSCH_RB_ALLOC 0x1fff
-
-
-uint16_t NODE_ID[1];
-uint8_t NB_INST=2;
-
-void init_bypass()
-{
-
-  msg("[PHYSIM] INIT BYPASS\n");
-  pthread_mutex_init(&Tx_mutex,NULL);
-  pthread_cond_init(&Tx_cond,NULL);
-  Tx_mutex_var=1;
-  pthread_mutex_init(&emul_low_mutex,NULL);
-  pthread_cond_init(&emul_low_cond,NULL);
-  emul_low_mutex_var=1;
-  bypass_init(emul_tx_handler,emul_rx_handler);
-}
-
-log_mapping level_names[] = {
-  {"emerg", LOG_EMERG},
-  {"alert", LOG_ALERT},
-  {"crit", LOG_CRIT},
-  {"err", LOG_ERR},
-  {"warn", LOG_WARNING},
-  {"notice", LOG_NOTICE},
-  {"info", LOG_INFO},
-  {"debug", LOG_DEBUG},
-  {"trace", LOG_TRACE},
-  {NULL, -1}
-};
-
-
-
-void help(void)
-{
-  printf("Usage: physim -h -a -e -x transmission_mode -m target_dl_mcs -r(ate_adaptation) -n n_frames -s snr_dB -k ricean_factor -t max_delay -f forgetting factor\n");
-  printf("-h provides this help message!\n");
-  printf("-a Activates PHY abstraction mode\n");
-  printf("-e Activates extended prefix mode\n");
-  printf("-m Gives a fixed DL mcs\n");
-  printf("-r Activates rate adaptation (DL for now)\n");
-  printf("-n Set the number of frames for the simulation\n");
-  printf("-s snr_dB set a fixed (average) SNR\n");
-  printf("-k Set the Ricean factor (linear)\n");
-  printf("-t Set the delay spread (microseconds)\n");
-  printf("-f Set the forgetting factor for time-variation\n");
-  printf("-b Set the number of local eNB\n");
-  printf("-u Set the number of local UE\n");
-  printf("-M Set the machine ID for Ethernet-based emullation\n");
-  printf("-p Set the total number of machine in emulation - valid if M is set\n");
-  printf("-g Set multicast group ID (0,1,2,3) - valid if M is set\n");
-  printf("-l Set the log level (trace, debug, info, warn, err) only valid for MAC layer\n");
-  printf("-c Activate the config generator (OCG) - used in conjunction with openair emu web portal\n");
-  printf("-x Set the transmission mode (1,2,6 supported for now)\n");
-}
-
-#ifdef XFORMS
-void do_forms(FD_phy_procedures_sim *form, LTE_UE_DLSCH **lte_ue_dlsch_vars,LTE_eNB_ULSCH **lte_eNB_ulsch_vars, struct complex **ch,uint32_t ch_len)
-{
-
-  int32_t j,s,i;
-  float I[3600],Q[3600],I2[3600],Q2[3600],I3[300],Q3[300];
-
-  j=0;
-
-  //  printf("rxdataF_comp %p, lte_ue_dlsch_vars[0] %p\n",lte_ue_dlsch_vars[0]->rxdataF_comp[0],lte_ue_dlsch_vars[0]);
-  for (s=4; s<12; s++) {
-    for(i=0; i<12*12; i++) {
-      I[j] = (float)((short*)lte_ue_dlsch_vars[0]->rxdataF_comp[0])[(2*25*12*s)+2*i];
-      Q[j] = (float)((short*)lte_ue_dlsch_vars[0]->rxdataF_comp[0])[(2*25*12*s)+2*i+1];
-      //      printf("%d (%d): %f,%f : %d,%d\n",j,(25*12*s)+i,I[j],Q[j],lte_ue_dlsch_vars[0]->rxdataF_comp[0][(2*25*12*s)+2*i],lte_ue_dlsch_vars[0]->rxdataF_comp[0][(2*25*12*s)+2*i+1]);
-      j++;
-    }
-
-    if (s==5)
-      s=6;
-    else if (s==8)
-      s=9;
-  }
-
-  if (j>0)
-    fl_set_xyplot_data(form->pdsch_constellation,I,Q,j,"","","");
-
-
-  //fl_set_xyplot_xbounds(form->pdsch_constellation,-800,800);
-  //fl_set_xyplot_ybounds(form->pdsch_constellation,-800,800);
-
-
-  j=0;
-
-  //  printf("rxdataF_comp %p, lte_ue_dlsch_vars[0] %p\n",lte_ue_dlsch_vars[0]->rxdataF_comp[0],lte_ue_dlsch_vars[0]);
-  for (s=0; s<12; s++) {
-    for(i=0; i<6*12; i++) {
-      I2[j] = (float)((short*)lte_eNB_ulsch_vars[0]->rxdataF_comp[0][0])[(2*25*12*s)+2*i];
-      Q2[j] = (float)((short*)lte_eNB_ulsch_vars[0]->rxdataF_comp[0][0])[(2*25*12*s)+2*i+1];
-      //      printf("%d (%d): %f,%f : %d,%d\n",j,(25*12*s)+i,I[j],Q[j],lte_ue_dlsch_vars[0]->rxdataF_comp[0][(2*25*12*s)+2*i],lte_ue_dlsch_vars[0]->rxdataF_comp[0][(2*25*12*s)+2*i+1]);
-      j++;
-    }
-
-    if (s==1)
-      s=2;
-    else if (s==7)
-      s=8;
-  }
-
-  if (j>0)
-    fl_set_xyplot_data(form->pusch_constellation,I2,Q2,j,"","","");
-
-  fl_set_xyplot_xbounds(form->pusch_constellation,-800,800);
-  fl_set_xyplot_ybounds(form->pusch_constellation,-800,800);
-
-  for (j=0; j<ch_len; j++) {
-
-    I3[j] = j;
-    Q3[j] = 10*log10(ch[0][j].r*ch[0][j].r + ch[0][j].i*ch[0][j].i);
-  }
-
-  fl_set_xyplot_data(form->ch00,I3,Q3,ch_len,"","","");
-  //fl_set_xyplot_ybounds(form->ch00,-20,20);
-}
-#endif
-
-
-void do_DL_sig(double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],uint16_t next_slot,double *nf,
-               double snr_dB,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms)
-{
-
-  mod_sym_t **txdataF;
-#ifdef IFFT_FPGA
-  int32_t **txdataF2;
-  int l;
-#endif
-  int32_t **txdata,**rxdata;
-
-  uint8_t eNB_id=0,UE_id=0,aa;
-  double tx_pwr, rx_pwr;
-  int32_t rx_pwr2;
-  uint32_t i;
-  uint32_t slot_offset;
-
-  if (abstraction_flag == 0) {
-#ifdef IFFT_FPGA
-    txdata    = (int32_t **)malloc(2*sizeof(int32_t*));
-    txdata[0] = (int32_t *)malloc(OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    txdata[1] = (int32_t *)malloc(OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-
-    bzero(txdata[0],OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    bzero(txdata[1],OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-
-    txdataF2    = (int32_t **)malloc(2*sizeof(int32_t*));
-    txdataF2[0] = (int32_t *)malloc(NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    txdataF2[1] = (int32_t *)malloc(NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-
-    bzero(txdataF2[0],NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    bzero(txdataF2[1],NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-#endif
-
-
-    for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-
-      frame_parms = &PHY_vars_eNB_g[eNB_id]->lte_frame_parms;
-
-      txdataF = PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0];
-#ifndef IFFT_FPGA
-      txdata = PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0];
-#endif
-
-#ifdef IFFT_FPGA
-
-      slot_offset = (next_slot)*(PHY_vars_eNB_g[eNB_id]->lte_frame_parms.N_RB_DL*12)*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7);
-
-      //write_output("eNB_txsigF0.m","eNB_txsF0", lte_eNB_common_vars->txdataF[eNB_id][0],300*120,1,4);
-      //write_output("eNB_txsigF1.m","eNB_txsF1", lte_eNB_common_vars->txdataF[eNB_id][1],300*120,1,4);
-
-
-      // do talbe lookup and write results to txdataF2
-      for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-
-        l = slot_offset;
-
-        for (i=0; i<NUMBER_OF_OFDM_CARRIERS*((frame_parms->Ncp==1) ? 6 : 7); i++)
-          if ((i%512>=1) && (i%512<=150))
-            txdataF2[aa][i] = ((int32_t*)mod_table)[txdataF[aa][l++]];
-          else if (i%512>=362)
-            txdataF2[aa][i] = ((int32_t*)mod_table)[txdataF[aa][l++]];
-          else
-            txdataF2[aa][i] = 0;
-
-      }
-
-      for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-        if (frame_parms->Ncp == 1)
-          PHY_ofdm_mod(txdataF2[aa],        // input
-                       txdata[aa],         // output
-                       frame_parms->log2_symbol_size,                // log2_fft_size
-                       6,                 // number of symbols
-                       frame_parms->nb_prefix_samples,               // number of prefix samples
-                       frame_parms->twiddle_ifft,  // IFFT twiddle factors
-                       frame_parms->rev,           // bit-reversal permutation
-                       CYCLIC_PREFIX);
-        else {
-          normal_prefix_mod(txdataF2[aa],txdata[aa],7,frame_parms);
-        }
-      }
-
-#else //IFFT_FPGA
-
-      slot_offset = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);
-
-
-      for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-        if (frame_parms->Ncp == 1)
-          PHY_ofdm_mod(&txdataF[aa][slot_offset],        // input
-                       txdata[aa],         // output
-                       frame_parms->log2_symbol_size,                // log2_fft_size
-                       6,                 // number of symbols
-                       frame_parms->nb_prefix_samples,               // number of prefix samples
-                       frame_parms->twiddle_ifft,  // IFFT twiddle factors
-                       frame_parms->rev,           // bit-reversal permutation
-                       CYCLIC_PREFIX);
-        else {
-          normal_prefix_mod(&txdataF[aa][slot_offset],
-                            txdata[aa],
-                            7,
-                            frame_parms);
-        }
-      }
-
-#endif //IFFT_FPGA
-    }
-  }
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-
-    if (abstraction_flag!=0) {
-      for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++)
-        random_channel(eNB2UE[eNB_id][UE_id]);
-    } else {
-      // Compute RX signal for UE = UE_id
-      for (i=0; i<(frame_parms->samples_per_tti>>1); i++) {
-        for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
-          r_re[aa][i]=0.0;
-          r_im[aa][i]=0.0;
-
-        }
-      }
-
-      // Compute RX signal for UE = UE_id
-      for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-        frame_parms = &PHY_vars_eNB_g[eNB_id]->lte_frame_parms;
-        tx_pwr = dac_fixed_gain(s_re,
-                                s_im,
-                                txdata,
-                                0, //slot_offset,
-                                frame_parms->nb_antennas_tx,
-                                frame_parms->samples_per_tti>>1,
-                                14,
-
-                                18);
-#ifdef DEBUG_SIM
-        printf("[SIM][DL] tx_pwr eNB %d %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),next_slot,next_slot>>1);
-#endif
-        //     printf("channel for slot %d (subframe %d)\n",next_slot,next_slot>>1);
-
-
-
-
-        multipath_channel(eNB2UE[eNB_id][UE_id],s_re,s_im,r_re0,r_im0,
-                          frame_parms->samples_per_tti>>1,0);
-
-        rx_pwr = signal_energy_fp2(eNB2UE[eNB_id][UE_id]->ch[0],eNB2UE[eNB_id][UE_id]->channel_length);
-#ifdef DEBUG_SIM
-        printf("[SIM][DL] Channel eNB %d => UE %d : gain %f dB\n",eNB_id,UE_id,10*log10(rx_pwr));
-        printf("[SIM][DL] Channel eNB %d => UE %d : path_loss %f dB\n",eNB_id,UE_id,eNB2UE[eNB_id][UE_id]->path_loss_dB);
-#endif
-        rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
-#ifdef DEBUG_SIM
-        printf("[SIM][DL] UE %d : CH out %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),next_slot,next_slot>>1);
-#endif
-
-        if (eNB2UE[eNB_id][UE_id]->first_run == 1)
-          eNB2UE[eNB_id][UE_id]->first_run = 0;
-
-
-        // RF model
-#ifdef DEBUG_SIM
-        printf("[SIM][DL] UE_id %d: rx_gain %d dB for slot %d (subframe %d)\n",UE_id,PHY_vars_UE_g[UE_id]->rx_total_gain_dB,next_slot,next_slot>>1);
-#endif
-        rf_rx(r_re0,
-              r_im0,
-              NULL,
-              NULL,
-              0,
-              frame_parms->nb_antennas_rx,
-              frame_parms->samples_per_tti>>1,
-              (eNB_id==0) ? (1.0/7.68e6 * 1e9) : 1e9,  // sampling time (ns)
-              0.0,               // freq offset (Hz) (-20kHz..20kHz)
-              0.0,               // drift (Hz) NOT YET IMPLEMENTED
-              nf,                // noise_figure NOT YET IMPLEMENTED
-              (double)PHY_vars_UE_g[UE_id]->rx_total_gain_dB - 66.227,   // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
-              200,               // IP3_dBm (dBm)
-              &eNB2UE[eNB_id][UE_id]->ip,               // initial phase
-              30.0e3,            // pn_cutoff (kHz)
-              -500.0,            // pn_amp (dBc) default: 50
-              0.0,               // IQ imbalance (dB),
-              0.0);              // IQ phase imbalance (rad)
-
-        for (i=0; i<(frame_parms->samples_per_tti>>1); i++) {
-          for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
-            r_re[aa][i]+=r_re0[aa][i];
-            r_im[aa][i]+=r_im0[aa][i];
-
-          }
-        }
-
-      }
-
-      rx_pwr = signal_energy_fp(r_re,r_im,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
-#ifdef DEBUG_SIM
-      printf("[SIM][DL] UE %d : ADC in %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),next_slot,next_slot>>1);
-#endif
-      rxdata = PHY_vars_UE_g[UE_id]->lte_ue_common_vars.rxdata;
-
-      slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
-
-
-
-      adc(r_re,
-          r_im,
-          0,
-          slot_offset,
-          rxdata,
-          frame_parms->nb_antennas_rx,
-          frame_parms->samples_per_tti>>1,
-          12);
-
-      rx_pwr2 = signal_energy(rxdata[0]+slot_offset,frame_parms->samples_per_tti>>1);
-#ifdef DEBUG_SIM
-      printf("[SIM][DL] rx_pwr (ADC out) %f dB (%d) for slot %d (subframe %d)\n",10*log10((double)rx_pwr2),rx_pwr2,next_slot,next_slot>>1);
-#endif
-    } // abstraction_flag==0
-  } // UE_index loop
-
-
-#ifdef IFFT_FPGA
-  free(txdataF2[0]);
-  free(txdataF2[1]);
-  free(txdataF2);
-  free(txdata[0]);
-  free(txdata[1]);
-  free(txdata);
-#endif
-
-}
-
-void do_UL_sig(double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],uint16_t next_slot,double *nf,
-               double snr_dB,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms)
-{
-
-  mod_sym_t **txdataF;
-#ifdef IFFT_FPGA
-  int32_t **txdataF2;
-  int l;
-#endif
-  int32_t **txdata,**rxdata;
-
-  uint8_t UE_id=0,eNB_id=0,aa;
-  double tx_pwr, rx_pwr;
-  int32_t rx_pwr2;
-  uint32_t i;
-  uint32_t slot_offset;
-
-  if (abstraction_flag==0) {
-#ifdef IFFT_FPGA
-    txdata    = (int32_t **)malloc(2*sizeof(int32_t*));
-    txdata[0] = (int32_t *)malloc(OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    txdata[1] = (int32_t *)malloc(OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-
-    bzero(txdata[0],OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[0]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    bzero(txdata[1],OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[0]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-
-    txdataF2    = (int32_t **)malloc(2*sizeof(int32_t*));
-    txdataF2[0] = (int32_t *)malloc(NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    txdataF2[1] = (int32_t *)malloc(NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-
-    bzero(txdataF2[0],NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-    bzero(txdataF2[1],NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7)*sizeof(int32_t));
-#endif
-  }
-
-  if (abstraction_flag==0) {
-    for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-      frame_parms = &PHY_vars_UE_g[UE_id]->lte_frame_parms;
-
-
-      txdataF = PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdataF;
-      //    printf("UE %d txdataF[0] %p\n",UE_id,txdataF[0]);
-#ifndef IFFT_FPGA
-      txdata = PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata;
-#endif
-
-#ifdef IFFT_FPGA
-
-      slot_offset = (next_slot)*(PHY_vars_UE_g[UE_id]->lte_frame_parms.N_RB_DL*12)*((PHY_vars_eNB_g[UE_id]->lte_frame_parms.Ncp==1) ? 6 : 7);
-
-      //write_output("eNB_txsigF0.m","eNB_txsF0", lte_eNB_common_vars->txdataF[eNB_id][0],300*120,1,4);
-      //write_output("eNB_txsigF1.m","eNB_txsF1", lte_eNB_common_vars->txdataF[eNB_id][1],300*120,1,4);
-
-
-      // do talbe lookup and write results to txdataF2
-      for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-
-        l = slot_offset;
-
-        for (i=0; i<NUMBER_OF_OFDM_CARRIERS*((frame_parms->Ncp==1) ? 6 : 7); i++)
-          if ((i%512>=1) && (i%512<=150))
-            txdataF2[aa][i] = ((int32_t*)mod_table)[txdataF[aa][l++]];
-          else if (i%512>=362)
-            txdataF2[aa][i] = ((int32_t*)mod_table)[txdataF[aa][l++]];
-          else
-            txdataF2[aa][i] = 0;
-
-      }
-
-      for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
-        if (frame_parms->Ncp==1)
-          PHY_ofdm_mod(txdataF2[aa],        // input
-                       txdata[aa],         // output
-                       frame_parms->log2_symbol_size,                // log2_fft_size
-                       6,                 // number of symbols
-                       frame_parms->nb_prefix_samples,               // number of prefix samples
-                       frame_parms->twiddle_ifft,  // IFFT twiddle factors
-                       frame_parms->rev,           // bit-reversal permutation
-                       CYCLIC_PREFIX);
-        else {
-          normal_prefix_mod(txdataF2[aa],txdata[aa],7,frame_parms);
-        }
-
-      if ((next_slot==8) && (mac_xface->frame==4)) {
-        write_output("UEtxsigF20.m","txsF20", txdataF2[0],NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7),2,1);
-      }
-
-#else //IFFT_FPGA
-
-      slot_offset = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);
-
-
-      for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-        if (frame_parms->Ncp==1) {
-          PHY_ofdm_mod(&txdataF[aa][slot_offset],        // input
-                       txdata[aa],         // output
-                       frame_parms->log2_symbol_size,                // log2_fft_size
-                       6,                 // number of symbols
-                       frame_parms->nb_prefix_samples,               // number of prefix samples
-                       frame_parms->twiddle_ifft,  // IFFT twiddle factors
-                       frame_parms->rev,           // bit-reversal permutation
-                       CYCLIC_PREFIX);
-        } else {
-          normal_prefix_mod(&txdataF[aa][slot_offset],
-                            txdata[aa],
-                            7,
-                            frame_parms);
-
-        }
-      }
-
-      if ((next_slot==8) && (mac_xface->frame==4)) {
-        write_output("UEtxsigF0.m","txsF0", &txdataF[0][slot_offset],NUMBER_OF_OFDM_CARRIERS*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7),2,1);
-      }
-
-#endif //IFFT_FPGA
-
-      if ((next_slot==8) && (mac_xface->frame==4)) {
-        write_output("UEtxsig0.m","txs0", txdata[0],OFDM_SYMBOL_SIZE_SAMPLES*((PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Ncp==1) ? 6 : 7),1,1);
-      }
-
-    }  // UE_id TX loop
-  } // abstraction_flag
-
-
-  for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-
-    if (abstraction_flag!=0) {
-      for (UE_id=0; UE_id<NB_UE_INST; UE_id++)
-        random_channel(UE2eNB[UE_id][eNB_id]);
-    } else {
-      // Clear RX signal for eNB = eNB_id
-      for (i=0; i<(frame_parms->samples_per_tti>>1); i++) {
-        for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
-          r_re[aa][i]=0.0;
-          r_im[aa][i]=0.0;
-
-        }
-      }
-
-      // Compute RX signal for eNB = eNB_id
-      for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-
-        txdataF = PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdataF;
-        //      printf("UE %d txdataF[0] %p\n",UE_id,txdataF[0]);
-#ifndef IFFT_FPGA
-        txdata = PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata;
-#endif
-        frame_parms = &PHY_vars_UE_g[UE_id]->lte_frame_parms;
-        tx_pwr = dac_fixed_gain(s_re,
-                                s_im,
-                                txdata,
-                                0, //slot_offset,
-                                frame_parms->nb_antennas_tx,
-                                frame_parms->samples_per_tti>>1,
-                                14,
-                                18);
-#ifdef DEBUG_SIM
-        printf("[SIM][UL] UE %d txdataF %p tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,&txdataF[0][slot_offset],10*log10(tx_pwr),next_slot,next_slot>>1);
-#endif
-
-
-        rx_pwr = signal_energy_fp(s_re,s_im,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
-#ifdef DEBUG_SIM
-        printf("[SIM][UL] CH %d : CH in %f dB for slot %d (subframe %d), sptti %d\n",eNB_id,10*log10(rx_pwr),next_slot,next_slot>>1,frame_parms->samples_per_tti);
-#endif
-        /*
-        uint8_t aarx,aatx,k;
-        for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-        for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-        for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-        printf("BMP(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-        */
-
-        multipath_channel(UE2eNB[UE_id][eNB_id],s_re,s_im,r_re0,r_im0,
-                          frame_parms->samples_per_tti>>1,0);
-        /*
-        for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-        for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-        for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-        printf("AMP(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-        */
-
-        rx_pwr = signal_energy_fp2(UE2eNB[UE_id][eNB_id]->ch[0],UE2eNB[UE_id][eNB_id]->channel_length);
-#ifdef DEBUG_SIM
-        printf("[SIM][UL] Channel UE %d => eNB %d : %f dB\n",UE_id,eNB_id,10*log10(rx_pwr));
-#endif
-        rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
-#ifdef DEBUG_SIM
-        printf("[SIM][UL] CH %d : CH out %f dB for slot %d (subframe %d), sptti %d\n",eNB_id,10*log10(rx_pwr),next_slot,next_slot>>1,frame_parms->samples_per_tti);
-#endif
-
-        if (UE2eNB[UE_id][eNB_id]->first_run == 1)
-          UE2eNB[UE_id][eNB_id]->first_run = 0;
-
-
-        // RF model
-
-
-        rf_rx(r_re0,
-              r_im0,
-              NULL,
-              NULL,
-              0,
-              frame_parms->nb_antennas_rx,
-              frame_parms->samples_per_tti>>1,
-              (UE_id==0) ? (1.0/7.68e6 * 1e9) : 1e9,  // sampling time (ns) + set noise bandwidth to 0 for UE>0 (i.e. no noise except for first UE)
-              0.0,               // freq offset (Hz) (-20kHz..20kHz)
-              0.0,               // drift (Hz) NOT YET IMPLEMENTED
-              nf,                // noise_figure NOT YET IMPLEMENTED
-              (double)PHY_vars_eNB_g[eNB_id]->rx_total_gain_eNB_dB - 66.227,   // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
-              200,               // IP3_dBm (dBm)
-              &UE2eNB[UE_id][eNB_id]->ip,               // initial phase
-              30.0e3,            // pn_cutoff (kHz)
-              -500.0,            // pn_amp (dBc) default: 50
-              0.0,               // IQ imbalance (dB),
-              0.0);              // IQ phase imbalance (rad)
-
-        for (i=0; i<(frame_parms->samples_per_tti>>1); i++) {
-          for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
-            r_re[aa][i]+=r_re0[aa][i];
-            r_im[aa][i]+=r_im0[aa][i];
-
-          }
-        }
-
-        rx_pwr = signal_energy_fp(r_re,r_im,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
-#ifdef DEBUG_SIM
-        printf("[SIM][UL] rx_pwr (ADC in) %f dB for slot %d (subframe %d)\n",10*log10(rx_pwr),next_slot,next_slot>>1);
-#endif
-      }
-
-
-
-
-      rxdata = PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.rxdata[0];
-
-      slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
-
-
-
-      adc(r_re,
-          r_im,
-          0,
-          slot_offset,
-          rxdata,
-          frame_parms->nb_antennas_rx,
-          frame_parms->samples_per_tti>>1,
-          12);
-
-      rx_pwr2 = signal_energy(rxdata[0]+slot_offset,frame_parms->samples_per_tti>>1);
-#ifdef DEBUG_SIM
-      printf("[SIM][UL] eNB %d rx_pwr (ADC out) %f dB (%d) for slot %d (subframe %d)\n",eNB_id,10*log10((double)rx_pwr2),rx_pwr2,next_slot,next_slot>>1);
-#endif
-
-    } // abstraction_flag==0
-  }
-
-#ifdef IFFT_FPGA
-
-  if (abstraction_flag==0) {
-    free(txdataF2[0]);
-    free(txdataF2[1]);
-    free(txdataF2);
-    free(txdata[0]);
-    free(txdata[1]);
-    free(txdata);
-  }
-
-#endif
-}
-
-
-int main(int argc, char **argv)
-{
-
-
-  char c;
-  int32_t i,j;
-  double **s_re,**s_im,**r_re,**r_im,**r_re0,**r_im0;
-  double amps[8] = {0.3868472 , 0.3094778 , 0.1547389 , 0.0773694 , 0.0386847 , 0.0193424 , 0.0096712 , 0.0038685};
-  double aoa=.03,ricean_factor=.001,Td=1.0,forgetting_factor=.5,maxDoppler=0;
-  uint8_t channel_length,nb_taps=8;
-
-
-  int32_t n_frames,n_errors;
-
-  int32_t slot,last_slot, next_slot;
-
-  double nf[2] = {3.0,3.0}; //currently unused
-  double snr_dB;
-
-
-
-  uint8_t target_dl_mcs=4;
-  uint8_t target_ul_mcs=2;
-  uint8_t rate_adaptation_flag;
-  uint8_t transmission_mode;
-  uint8_t abstraction_flag=0,ethernet_flag=0;
-  uint16_t ethernet_id=0;
-  uint8_t extended_prefix_flag=0;
-  int32_t UE_id,eNB_id,ret;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
-  //uint8_t nb_ue_local=1,nb_ue_remote=0;
-  //uint8_t nb_eNB_local=1,nb_eNB_remote=0;
-  //uint8_t first_eNB_local=0,first_UE_local=0, nb_machine=0;
-
-  char * g_log_level="trace"; // by default global log level is set to trace
-  lte_subframe_t direction;
-
-  int OCG_flag =0;
-  OAI_Emulation * emulation_scen;
-
-  channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
-  channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
-
-#ifdef XFORMS
-  FD_phy_procedures_sim *form[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
-  char title[255];
-#endif
-  LTE_DL_FRAME_PARMS *frame_parms;
-
-  RRC_CONNECTION_FLAG = 1;
-
-  //default parameters
-  oai_emulation.info.is_primary_master=0;
-  oai_emulation.info.master_list=0;
-  oai_emulation.info.nb_ue_remote=0;
-  oai_emulation.info.nb_enb_remote=0;
-  oai_emulation.info.first_ue_local=0;
-  oai_emulation.info.first_enb_local=0;
-  oai_emulation.info.master_id=0;
-  oai_emulation.info.nb_master =0;
-  oai_emulation.info.nb_ue_local= 1;
-  oai_emulation.info.nb_enb_local= 1;
-  oai_emulation.info.ethernet_flag=0;
-  oai_emulation.info.multicast_group=0;
-
-  transmission_mode = 1;
-  target_dl_mcs = 0;
-  rate_adaptation_flag = 1;
-  n_frames = 100;
-  snr_dB = 30;
-
-  while ((c = getopt (argc, argv, "haect:k:x:m:rn:s:f:u:b:M:p:g:l")) != -1)
-
-  {
-    switch (c) {
-    case 'h':
-      help();
-      exit(1);
-
-    case 'x':
-      transmission_mode = atoi(optarg);
-      break;
-
-    case 'm':
-      target_dl_mcs = atoi(optarg);
-      break;
-
-    case 'r':
-      rate_adaptation_flag = 1;
-      break;
-
-    case 'n':
-      n_frames = atoi(optarg);
-      break;
-
-    case 's':
-      snr_dB = atoi(optarg);
-      break;
-
-    case 'k':
-      ricean_factor = atof(optarg);
-      break;
-
-    case 't':
-      Td = atof(optarg);
-      break;
-
-    case 'f':
-      forgetting_factor = atof(optarg);
-      break;
-
-    case 'u':
-      oai_emulation.info.nb_ue_local = atoi(optarg);
-      break;
-
-      //  case 'U':
-      //nb_ue_remote = atoi(optarg);
-      //break;
-    case 'b':
-      oai_emulation.info.nb_enb_local = atoi(optarg);
-      break;
-
-      //  case 'B':
-      // nb_eNB_remote = atoi(optarg);
-      //break;
-    case 'a':
-      abstraction_flag=1;
-      break;
-
-    case 'p':
-      oai_emulation.info.nb_master = atoi(optarg);
-      break;
-
-    case 'M':
-      abstraction_flag=1;
-      ethernet_flag=1;
-      ethernet_id = atoi(optarg);
-      oai_emulation.info.master_id=ethernet_id;
-      oai_emulation.info.ethernet_flag=1;
-      break;
-
-    case 'e':
-      extended_prefix_flag=1;
-      break;
-
-    case 'l':
-      g_log_level=optarg;
-      break;
-
-    case 'c':
-      OCG_flag=1;
-      break;
-
-    case 'g':
-      oai_emulation.info.multicast_group=atoi(optarg);
-      break;
-
-    default:
-      help ();
-      exit (-1);
-      break;
-    }
-  }
-
-  //initialize the log generator
-  logInit(map_str_to_int(level_names, g_log_level));
-  LOG_T(LOG,"global log level is set to %s \n",g_log_level );
-
-  //set_comp_log(EMU,  LOG_INFO, LOG_MED);
-#ifdef OCG
-
-  if (OCG_flag==1) { // activate OCG
-    printf("start\n");
-    emulation_scen= OCG_main();
-    LOG_I(MAC,"the area is x %f y %f option %s\n",
-          emulation_scen->envi_config.area.x,
-          emulation_scen->envi_config.area.y, emulation_scen->topo_config.eNB_topology.selected_option);
-    abstraction_flag=1;
-    extended_prefix_flag=1;
-
-    oai_emulation.info.nb_ue_local  = emulation_scen->topo_config.number_of_UE;
-
-    if (!strcmp(emulation_scen->topo_config.eNB_topology.selected_option, "random")) {
-      oai_emulation.info.nb_enb_local = emulation_scen->topo_config.eNB_topology.totally_random.number_of_eNB;
-    } else if (!strcmp(emulation_scen->topo_config.eNB_topology.selected_option, "hexagonal")) {
-      oai_emulation.info.nb_enb_local = emulation_scen->topo_config.eNB_topology.hexagonal.number_of_cells;
-    } else if (!strcmp(emulation_scen->topo_config.eNB_topology.selected_option, "grid")) {
-      oai_emulation.info.nb_enb_local = emulation_scen->topo_config.eNB_topology.grid.x * emulation_scen->topo_config.eNB_topology.grid.y;
-    }
-
-    n_frames  =  (int) emulation_scen->emu_config.emu_time * 60 * 100;
-    transmission_mode = 1;
-    //set_comp_log(EMU,  LOG_INFO, LOG_MED);
-    //set_comp_log(MAC,  LOG_INFO, LOG_MED);
-    //set_comp_log(RLC,  LOG_INFO, LOG_MED);
-
-    LOG_I(OCG," ue local %d enb local %d frame %d\n",   nb_ue_local,   nb_eNB_local, n_frames );
-  }
-
-#endif
-  //if ( (ethernet_flag==1) || (abstraction_flag==1) )
-  ret=netlink_init();
-
-  if (ethernet_flag==1) {
-    oai_emulation.info.master[oai_emulation.info.master_id].nb_ue=oai_emulation.info.nb_ue_local;
-    oai_emulation.info.master[oai_emulation.info.master_id].nb_enb=oai_emulation.info.nb_enb_local;
-
-    if(!oai_emulation.info.master_id)
-      oai_emulation.info.is_primary_master=1;
-
-    j=1;
-
-    for(i=0; i<oai_emulation.info.nb_master; i++) {
-      if(i!=oai_emulation.info.master_id)
-        oai_emulation.info.master_list=oai_emulation.info.master_list+j;
-
-      LOG_T(EMU, "Index of master id i=%d  MASTER_LIST %d\n",i,oai_emulation.info.master_list);
-      j*=2;
-    }
-
-    LOG_T(EMU,"nb_ue_local %d nb_enb_local %d nb_master %d master id %d\n",
-          oai_emulation.info.nb_ue_local,
-          oai_emulation.info.nb_enb_local,
-          oai_emulation.info.nb_master,
-          oai_emulation.info.master_id);
-
-    //ret=netlink_init();
-    init_bypass();
-
-    while (emu_tx_status != SYNCED_TRANSPORT ) {
-      LOG_T(EMU, " Waiting for EMU Transport to be synced\n");
-      emu_transport_sync();//emulation_tx_rx();
-    }
-  }// ethernet flag
-
-  NB_UE_INST = oai_emulation.info.nb_ue_local + oai_emulation.info.nb_ue_remote;
-  NB_CH_INST = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_enb_remote;
-
-
-  printf("Running with mode %d, target dl_mcs %d, rate adaptation %d, nframes %d\n",
-         transmission_mode,target_dl_mcs,rate_adaptation_flag,n_frames);
-
-  channel_length = (uint8_t) (11+2*BW*Td);
-
-  //PHY_vars = malloc(sizeof(PHY_VARS));
-  //  PHY_VARS_eNB *PHY_vars_eNB;
-
-  PHY_vars_eNB_g = malloc(NB_CH_INST*sizeof(PHY_VARS_eNB*));
-
-  for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-    PHY_vars_eNB_g[eNB_id] = malloc(sizeof(PHY_VARS_eNB));
-    PHY_vars_eNB_g[eNB_id]->Mod_id=eNB_id;
-  }
-
-  //  PHY_VARS_UE *PHY_vars_UE;
-  PHY_vars_UE_g = malloc(NB_UE_INST*sizeof(PHY_VARS_UE*));
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) { // begin navid
-    PHY_vars_UE_g[UE_id] = malloc(sizeof(PHY_VARS_UE));
-    PHY_vars_UE_g[UE_id]->Mod_id=UE_id;
-  }// end navid
-
-  //PHY_config = malloc(sizeof(PHY_CONFIG));
-  mac_xface = malloc(sizeof(MAC_xface));
-
-  frame_parms = malloc(sizeof(LTE_DL_FRAME_PARMS));
-  frame_parms->frame_type         = 1;
-  frame_parms->tdd_config         = 3;
-  frame_parms->N_RB_DL            = 25;
-  frame_parms->N_RB_UL            = 25;
-  frame_parms->phich_config_common.phich_resource = oneSixth;
-  frame_parms->Ncp                = extended_prefix_flag;
-  frame_parms->Nid_cell           = 0;
-  frame_parms->nushift            = 0;
-  frame_parms->nb_antennas_tx     = 2;
-  frame_parms->nb_antennas_rx     = 2;
-  frame_parms->mode1_flag = (transmission_mode == 1) ? 1 : 0;
-
-  init_frame_parms(frame_parms,1);
-  //copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
-  phy_init_top(frame_parms);
-
-  frame_parms->twiddle_fft      = twiddle_fft;
-  frame_parms->twiddle_ifft     = twiddle_ifft;
-  frame_parms->rev              = rev;
-  // navid
-  frame_parms->tdd_config = 3;
-
-  phy_init_lte_top(frame_parms);
-
-  // init all eNB vars
-
-  for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-    memcpy(&(PHY_vars_eNB_g[eNB_id]->lte_frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
-    phy_init_lte_eNB(&PHY_vars_eNB_g[eNB_id]->lte_frame_parms,
-                     &PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars,
-                     PHY_vars_eNB_g[eNB_id]->lte_eNB_ulsch_vars,
-                     0,
-                     PHY_vars_eNB_g[eNB_id],
-                     0,
-                     0,
-                     abstraction_flag);
-
-    /*
-      PHY_vars_eNB_g[eNB_id]->dlsch_eNB[0] = (LTE_eNB_DLSCH_t**) malloc16(NUMBER_OF_UE_MAX*sizeof(LTE_eNB_DLSCH_t*));
-      PHY_vars_eNB_g[eNB_id]->dlsch_eNB[1] = (LTE_eNB_DLSCH_t**) malloc16(NUMBER_OF_UE_MAX*sizeof(LTE_eNB_DLSCH_t*));
-      PHY_vars_eNB_g[eNB_id]->ulsch_eNB = (LTE_eNB_ULSCH_t**) malloc16((1+NUMBER_OF_UE_MAX)*sizeof(LTE_eNB_ULSCH_t*));
-    */
-
-    for (i=0; i<NUMBER_OF_UE_MAX; i++) {
-      for (j=0; j<2; j++) {
-        PHY_vars_eNB_g[eNB_id]->dlsch_eNB[i][j] = new_eNB_dlsch(1,8,abstraction_flag);
-
-        if (!PHY_vars_eNB_g[eNB_id]->dlsch_eNB[i][j]) {
-          msg("Can't get eNB dlsch structures\n");
-          exit(-1);
-        } else {
-          msg("dlsch_eNB[%d][%d] => %p\n",i,j,PHY_vars_eNB_g[eNB_id]->dlsch_eNB[i][j]);
-          PHY_vars_eNB_g[eNB_id]->dlsch_eNB[i][j]->rnti=0;
-        }
-      }
-
-      PHY_vars_eNB_g[eNB_id]->ulsch_eNB[1+i] = new_eNB_ulsch(3,abstraction_flag);
-
-      if (!PHY_vars_eNB_g[eNB_id]->ulsch_eNB[1+i]) {
-        msg("Can't get eNB ulsch structures\n");
-        exit(-1);
-      }
-
-    }
-
-    // ULSCH for RA
-    PHY_vars_eNB_g[eNB_id]->ulsch_eNB[0] = new_eNB_ulsch(3,abstraction_flag);
-
-    if (!PHY_vars_eNB_g[eNB_id]->ulsch_eNB[0]) {
-      msg("Can't get eNB ulsch structures\n");
-      exit(-1);
-    }
-
-    PHY_vars_eNB_g[eNB_id]->dlsch_eNB_SI  = new_eNB_dlsch(1,1,abstraction_flag);
-    printf("eNB %d : SI %p\n",eNB_id,PHY_vars_eNB_g[eNB_id]->dlsch_eNB_SI);
-    PHY_vars_eNB_g[eNB_id]->dlsch_eNB_ra  = new_eNB_dlsch(1,1,abstraction_flag);
-    printf("eNB %d : RA %p\n",eNB_id,PHY_vars_eNB_g[eNB_id]->dlsch_eNB_ra);
-
-    PHY_vars_eNB_g[eNB_id]->rx_total_gain_eNB_dB=150;
-  }
-
-  // init all UE vars
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-    memcpy(&(PHY_vars_UE_g[UE_id]->lte_frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
-
-    phy_init_lte_ue(&PHY_vars_UE_g[UE_id]->lte_frame_parms,
-                    &PHY_vars_UE_g[UE_id]->lte_ue_common_vars,
-                    PHY_vars_UE_g[UE_id]->lte_ue_dlsch_vars,
-                    PHY_vars_UE_g[UE_id]->lte_ue_dlsch_vars_SI,
-                    PHY_vars_UE_g[UE_id]->lte_ue_dlsch_vars_ra,
-                    PHY_vars_UE_g[UE_id]->lte_ue_pbch_vars,
-                    PHY_vars_UE_g[UE_id]->lte_ue_pdcch_vars,
-                    PHY_vars_UE_g[UE_id],
-                    abstraction_flag);
-
-    /*
-      PHY_vars_UE_g[UE_id]->dlsch_ue[0] = (LTE_UE_DLSCH_t**) malloc16(NUMBER_OF_eNB_MAX*sizeof(LTE_UE_DLSCH_t*));
-      PHY_vars_UE_g[UE_id]->dlsch_ue[1] = (LTE_UE_DLSCH_t**) malloc16(NUMBER_OF_eNB_MAX*sizeof(LTE_UE_DLSCH_t*));
-
-      PHY_vars_UE_g[UE_id]->ulsch_ue = (LTE_UE_ULSCH_t**) malloc16(NUMBER_OF_eNB_MAX*sizeof(LTE_UE_ULSCH_t*));
-
-      PHY_vars_UE_g[UE_id]->dlsch_ue_SI = (LTE_UE_DLSCH_t**) malloc16(NUMBER_OF_eNB_MAX*sizeof(LTE_UE_DLSCH_t*));
-      PHY_vars_UE_g[UE_id]->dlsch_ue_ra = (LTE_UE_DLSCH_t**) malloc16(NUMBER_OF_eNB_MAX*sizeof(LTE_UE_DLSCH_t*));
-    */
-
-    for (i=0; i<NUMBER_OF_eNB_MAX; i++) {
-      for (j=0; j<2; j++) {
-        PHY_vars_UE_g[UE_id]->dlsch_ue[i][j]  = new_ue_dlsch(1,8,abstraction_flag);
-
-        if (!PHY_vars_UE_g[UE_id]->dlsch_ue[i][j]) {
-          msg("Can't get ue dlsch structures\n");
-          exit(-1);
-        } else
-          msg("dlsch_ue[%d][%d] => %p\n",UE_id,i,PHY_vars_UE_g[UE_id]->dlsch_ue[i][j]);//navid
-      }
-
-
-      PHY_vars_UE_g[UE_id]->ulsch_ue[i]  = new_ue_ulsch(3,abstraction_flag);
-
-      if (!PHY_vars_UE_g[UE_id]->ulsch_ue[i]) {
-        msg("Can't get ue ulsch structures\n");
-        exit(-1);
-      }
-
-      PHY_vars_UE_g[UE_id]->dlsch_ue_SI[i]  = new_ue_dlsch(1,1,abstraction_flag);
-      PHY_vars_UE_g[UE_id]->dlsch_ue_ra[i]  = new_ue_dlsch(1,1,abstraction_flag);
-    }
-  }
-
-  // do the srs init
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-
-    PHY_vars_UE_g[UE_id]->lte_frame_parms.soundingrs_ul_config_common.srs_BandwidthConfig = 2;
-
-    PHY_vars_UE_g[UE_id]->soundingrs_ul_config_dedicated.srs_Bandwidth = 0;
-    PHY_vars_UE_g[UE_id]->soundingrs_ul_config_dedicated.transmissionComb = 0;
-    PHY_vars_UE_g[UE_id]->soundingrs_ul_config_dedicated.freqDomainPosition = 0;
-
-    // choose configurations 1 (UE0 SF 1), 3 (UE1 SF 2), 5 (UE2 SF 3)
-    PHY_vars_UE_g[UE_id]->soundingrs_ul_config_dedicated.srs_ConfigIndex = 1+(UE_id<<1);
-
-    if (UE_id>=3) {
-      printf("This SRS config will only work for 3 users! \n");
-
-    }
-
-    /// This is for 3 users (SRS can be transmitted in SF 1,2,3,4
-    PHY_vars_UE_g[UE_id]->lte_frame_parms.soundingrs_ul_config_common.srs_SubframeConfig = 7;
-
-    for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-
-      PHY_vars_eNB_g[eNB_id]->lte_frame_parms.soundingrs_ul_config_common.srs_BandwidthConfig = 2;
-      PHY_vars_eNB_g[eNB_id]->lte_frame_parms.soundingrs_ul_config_common.srs_SubframeConfig = 7;
-      PHY_vars_eNB_g[eNB_id]->soundingrs_ul_config_dedicated[UE_id].srs_Bandwidth = 0;
-      PHY_vars_eNB_g[eNB_id]->soundingrs_ul_config_dedicated[UE_id].transmissionComb = 0;
-      PHY_vars_eNB_g[eNB_id]->soundingrs_ul_config_dedicated[UE_id].freqDomainPosition = 0;
-      // choose configurations 1 (UE0 SF 1), 3 (UE1 SF 2), 5 (UE2 SF 3)
-      PHY_vars_eNB_g[eNB_id]->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex = 1+(UE_id<<1);
-    }
-  }
-
-
-  //  init_transport_channels(transmission_mode);
-
-  if (abstraction_flag==0) {
-    /*
-    #ifdef IFFT_FPGA
-    txdata    = (int32_t **)malloc16(2*sizeof(int32_t*));
-    txdata[0] = (int32_t *)malloc16(FRAME_LENGTH_BYTES);
-    txdata[1] = (int32_t *)malloc16(FRAME_LENGTH_BYTES);
-
-    bzero(txdata[0],FRAME_LENGTH_BYTES);
-    bzero(txdata[1],FRAME_LENGTH_BYTES);
-
-    txdataF2    = (int32_t **)malloc16(2*sizeof(int32_t*));
-    txdataF2[0] = (int32_t *)malloc16(FRAME_LENGTH_BYTES_NO_PREFIX);
-    txdataF2[1] = (int32_t *)malloc16(FRAME_LENGTH_BYTES_NO_PREFIX);
-
-    bzero(txdataF2[0],FRAME_LENGTH_BYTES_NO_PREFIX);
-    bzero(txdataF2[1],FRAME_LENGTH_BYTES_NO_PREFIX);
-    #endif
-    */
-
-    s_re = malloc(2*sizeof(double*));
-    s_im = malloc(2*sizeof(double*));
-    r_re = malloc(2*sizeof(double*));
-    r_im = malloc(2*sizeof(double*));
-    r_re0 = malloc(2*sizeof(double*));
-    r_im0 = malloc(2*sizeof(double*));
-
-
-    for (i=0; i<2; i++) {
-
-      s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      r_re0[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      bzero(r_re0[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      r_im0[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-      bzero(r_im0[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-    }
-
-  }
-
-  // initialized channel descriptors
-  for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-    for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-#ifdef DEBUG_SIM
-      printf("[SIM] Initializing channel from eNB %d to UE %d\n",eNB_id,UE_id);
-#endif
-      eNB2UE[eNB_id][UE_id] = new_channel_desc(PHY_vars_eNB_g[eNB_id]->lte_frame_parms.nb_antennas_tx,
-                              PHY_vars_UE_g[UE_id]->lte_frame_parms.nb_antennas_rx,
-                              nb_taps,
-                              channel_length,
-                              amps,
-                              NULL,
-                              NULL,
-                              Td,
-                              BW,
-                              ricean_factor,
-                              aoa,
-                              forgetting_factor,
-                              maxDoppler,
-                              0,
-                              0);
-
-      eNB2UE[eNB_id][UE_id]->path_loss_dB = -105 + snr_dB;
-
-      UE2eNB[UE_id][eNB_id] = new_channel_desc(PHY_vars_UE_g[UE_id]->lte_frame_parms.nb_antennas_tx,
-                              PHY_vars_eNB_g[eNB_id]->lte_frame_parms.nb_antennas_rx,
-                              nb_taps,
-                              channel_length,
-                              amps,
-                              NULL,
-                              NULL,
-                              Td,
-                              BW,
-                              ricean_factor,
-                              aoa,
-                              forgetting_factor,
-                              maxDoppler,
-                              0,
-                              0);
-
-      UE2eNB[UE_id][eNB_id]->path_loss_dB = -105 + snr_dB + 20;
-#ifdef DEBUG_SIM
-      printf("[SIM] Path loss from eNB %d to UE %d => %f dB\n",eNB_id,UE_id,eNB2UE[eNB_id][UE_id]->path_loss_dB);
-      printf("[SIM] Path loss from UE %d to eNB %d => %f dB\n",UE_id,eNB_id,UE2eNB[UE_id][eNB_id]->path_loss_dB);
-#endif
-    }
-  }
-
-  randominit(0);
-  set_taus_seed(0);
-
-  number_of_cards = 1;
-
-  openair_daq_vars.rx_rf_mode = 1;
-  openair_daq_vars.tdd = 1;
-  openair_daq_vars.rx_gain_mode = DAQ_AGC_ON;
-
-  if ((transmission_mode != 1) && (transmission_mode != 6))
-    openair_daq_vars.dlsch_transmission_mode = 2;
-  else
-    openair_daq_vars.dlsch_transmission_mode = transmission_mode;
-
-  openair_daq_vars.target_ue_dl_mcs = target_dl_mcs;
-  openair_daq_vars.target_ue_ul_mcs = target_ul_mcs;
-  openair_daq_vars.dlsch_rate_adaptation = rate_adaptation_flag;
-  openair_daq_vars.ue_ul_nb_rb = 2;
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) { // begin navid
-    PHY_vars_UE_g[UE_id]->rx_total_gain_dB=140;
-    PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
-    PHY_vars_UE_g[UE_id]->lte_ue_pdcch_vars[0]->crnti = 0xBEEF;
-    PHY_vars_UE_g[UE_id]->current_dlsch_cqi[0]=4;
-  }// end navid
-
-
-#ifdef XFORMS
-  fl_initialize(&argc, argv, NULL, 0, 0);
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++)
-    for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-      form[eNB_id][UE_id] = create_form_phy_procedures_sim();
-      sprintf(title,"LTE SIM UE %d eNB %d",UE_id,eNB_id);
-      fl_show_form(form[eNB_id][UE_id]->phy_procedures_sim,FL_PLACE_HOTSPOT,FL_FULLBORDER,title);
-    }
-
-#endif
-
-#ifdef OPENAIR2
-  l2_init(&PHY_vars_eNB_g[0]->lte_frame_parms);
-
-
-
-  if (NB_CH_INST>0)
-    mac_xface->mrbch_phy_sync_failure(0,0);
-
-#ifdef DEBUG_SIM
-  printf("[SIM] Synching to eNB\n");
-#endif
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++)
-    mac_xface->chbch_phy_sync_success(1+UE_id,0);
-
-#endif
-
-  for (mac_xface->frame=0; mac_xface->frame<n_frames; mac_xface->frame++) {
-
-    for (slot=0 ; slot<20 ; slot++) {
-      last_slot = (slot - 1)%20;
-
-      if (last_slot <0)
-        last_slot+=20;
-
-      next_slot = (slot + 1)%20;
-
-      if(next_slot %2 ==0)
-        clear_eNB_transport_info(oai_emulation.info.nb_enb_local);
-
-      for (eNB_id=oai_emulation.info.first_enb_local; eNB_id<(oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local); eNB_id++) {
-        //#ifdef DEBUG_SIM
-        printf("[SIM] EMU PHY procedures eNB %d for frame %d, slot %d (subframe %d)\n",eNB_id,mac_xface->frame,slot,next_slot>>1);
-        //#endif
-        phy_procedures_eNB_lte(last_slot,next_slot,PHY_vars_eNB_g[eNB_id],abstraction_flag);
-      }
-
-      direction = subframe_select(frame_parms,next_slot>>1);
-
-      if (ethernet_flag ==1) {
-        if (( (direction == SF_DL) || (direction == SF_S) ) && ((next_slot%2)== 0)) {
-          emu_transport_DL(last_slot,next_slot);
-          LOG_I(EMU, "DL frame %d subframe %d slot %d \n", mac_xface->frame, next_slot>>1, slot)
-        }
-      }
-
-      // Call ETHERNET emulation here
-      if((next_slot %2) == 0)
-        clear_UE_transport_info(oai_emulation.info.nb_ue_local);
-
-      for (UE_id=oai_emulation.info.first_ue_local; UE_id<(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local); UE_id++)
-        if (mac_xface->frame >= (UE_id*10)) { // activate UE only after 10*UE_id frames so that different UEs turn on separately
-          //#ifdef DEBUG_SIM
-          printf("[SIM] EMU PHY procedures UE %d for frame %d, slot %d (subframe %d)\n", UE_id,mac_xface->frame,slot, next_slot>>1);
-          //printf("[SIM] txdataF[0] %p\n",PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdataF[0]);
-          //#endif
-          phy_procedures_ue_lte(last_slot,next_slot,PHY_vars_UE_g[UE_id],0,abstraction_flag);
-        }
-
-      if (ethernet_flag == 1) {
-        if (((direction == SF_UL) && ((next_slot%2)==0)) || ((direction == SF_S) && ((last_slot%2)==1))) {
-          emu_transport_UL(last_slot , next_slot);
-          LOG_I(EMU, "UL frame %d subframe %d slot %d \n", mac_xface->frame, next_slot>>1, slot)
-        }
-      }
-
-      if (direction  == SF_DL) {
-        /*
-          uint8_t aarx,aatx,k;    for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-          for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-          for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-          printf("DL A(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-        */
-        do_DL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,eNB2UE,next_slot,nf,snr_dB,abstraction_flag,frame_parms);
-        /*
-          for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-          for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-          for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-          printf("DL B(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-        */
-      } else if (direction  == SF_UL) {
-        /*
-          for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-          for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-          for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-          printf("UL A(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-        */
-        do_UL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,UE2eNB,next_slot,nf,snr_dB,abstraction_flag,frame_parms);
-        /*
-          for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-          for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-          for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-          printf("UL B(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-        */
-      } else { //it must be a special subframe
-        if (next_slot%2==0) {//DL part
-          /*
-            for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-            for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-            for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-
-            printf("SA(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-          */
-          do_DL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,eNB2UE,next_slot,nf,snr_dB,abstraction_flag,frame_parms);
-          /*
-            for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-            for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-            for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-            printf("SB(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-          */
-        } else { // UL part
-          /*
-            for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-            for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-            for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-            printf("SC(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-          */
-          do_UL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,UE2eNB,next_slot,nf,snr_dB,abstraction_flag,frame_parms);
-          /*
-            for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-            for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-            for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-            printf("SD(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-          */
-        }
-      }
-
-      if ((last_slot==1) && (mac_xface->frame==1) && (abstraction_flag==0)) {
-        write_output("UErxsigF0.m","rxsF0", PHY_vars_UE_g[0]->lte_ue_common_vars.rxdataF[0],frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,2,1);
-        write_output("eNBrxsigF0.m","rxsF0", PHY_vars_eNB_g[0]->lte_eNB_common_vars.rxdataF[0][0],frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,2,1);
-        write_output("dlchan0.m","dlch0",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
-        write_output("pbch_rxF_comp0.m","pbch_comp0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],6*12*4,1,1);
-        write_output("pbch_rxF_llr.m","pbch_llr",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
-
-      }
-
-      /*
-      if ((last_slot==1) && (mac_xface->frame==1)) {
-      write_output("dlsch_rxF_comp0.m","dlsch0_rxF_comp0",PHY_vars_UE->lte_ue_dlsch_vars[eNB_id]->rxdataF_comp[0],300*(-(PHY_vars_UE->lte_frame_parms.Ncp*2)+14),1,1);
-      write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0],4*300,1,1);
-      }
-      */
-    }
-
-    if ((mac_xface->frame==1)&&(abstraction_flag==0)) {
-      write_output("UErxsig0.m","rxs0", PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
-      write_output("eNBrxsig0.m","rxs0", PHY_vars_eNB_g[0]->lte_eNB_common_vars.rxdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
-    }
-
-#ifdef XFORMS
-
-    for (UE_id=0; UE_id<NB_UE_INST; UE_id++)
-      for (eNB_id=0; eNB_id<NB_CH_INST; eNB_id++) {
-        do_forms(form[eNB_id][UE_id],PHY_vars_UE_g[UE_id]->lte_ue_dlsch_vars,PHY_vars_eNB_g[eNB_id]->lte_eNB_ulsch_vars,eNB2UE[eNB_id][UE_id]->ch,eNB2UE[eNB_id][UE_id]->channel_length);
-      }
-
-#endif
-
-  }
-
-  // relase all rx state
-  emu_transport_release();
-
-  if (abstraction_flag==0) {
-    /*
-    #ifdef IFFT_FPGA
-    free(txdataF2[0]);
-    free(txdataF2[1]);
-    free(txdataF2);
-    free(txdata[0]);
-    free(txdata[1]);
-    free(txdata);
-    #endif
-    */
-
-    for (i=0; i<2; i++) {
-      free(s_re[i]);
-      free(s_im[i]);
-      free(r_re[i]);
-      free(r_im[i]);
-    }
-
-    free(s_re);
-    free(s_im);
-    free(r_re);
-    free(r_im);
-
-    lte_sync_time_free();
-  }
-
-  return(n_errors);
-}
-
-
diff --git a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.c b/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.c
deleted file mode 100644
index 5e7879b66a4a9a070f3549f79627db425bfee9cd..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
-    OpenAirInterface
-    Copyright(c) 1999 - 2014 Eurecom
-
-    OpenAirInterface is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-
-    OpenAirInterface is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenAirInterface.The full GNU General Public License is
-   included in this distribution in the file called "COPYING". If not,
-   see <http://www.gnu.org/licenses/>.
-
-  Contact Information
-  OpenAirInterface Admin: openair_admin@eurecom.fr
-  OpenAirInterface Tech : openair_tech@eurecom.fr
-  OpenAirInterface Dev  : openair4g-devel@eurecom.fr
-
-  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
-
- *******************************************************************************/
-/* Form definition file generated with fdesign. */
-
-#include <forms.h>
-#include <stdlib.h>
-#include "phy_procedures_sim_form.h"
-
-FD_phy_procedures_sim *create_form_phy_procedures_sim(void)
-{
-  FL_OBJECT *obj;
-  FD_phy_procedures_sim *fdui = (FD_phy_procedures_sim *) fl_calloc(1, sizeof(*fdui));
-
-  fdui->phy_procedures_sim = fl_bgn_form(FL_NO_BOX, 640, 320);
-  obj = fl_add_box(FL_UP_BOX,0,0,640,320,"");
-  fdui->pusch_constellation = obj = fl_add_xyplot(FL_POINTS_XYPLOT,50,30,220,190,"PUSCH constellation");
-  fl_set_object_color(obj,FL_BLACK,FL_YELLOW);
-  fdui->pdsch_constellation = obj = fl_add_xyplot(FL_POINTS_XYPLOT,370,30,220,190,"PDSCH constellation");
-  fl_set_object_color(obj,FL_BLACK,FL_YELLOW);
-  fdui->ch00 = obj = fl_add_xyplot(FL_IMPULSE_XYPLOT,370,240,210,60,"CH00");
-  fl_set_object_color(obj,FL_BLACK,FL_YELLOW);
-  fl_end_form();
-
-  fdui->phy_procedures_sim->fdui = fdui;
-
-  return fdui;
-}
-/*---------------------------------------*/
-
diff --git a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.fd b/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.fd
deleted file mode 100644
index 278096ad91e73dbdb804744af8c55c66babeb975..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.fd
+++ /dev/null
@@ -1,88 +0,0 @@
-Magic: 13000
-
-Internal Form Definition File
-    (do not change)
-
-Number of forms: 1
-Unit of measure: FL_COORD_PIXEL
-
-=============== FORM ===============
-Name: phy_procedures_sim
-Width: 640
-Height: 320
-Number of Objects: 4
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 640 320
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_XYPLOT
-type: POINTS_XYPLOT
-box: 50 30 220 190
-boxtype: FL_FLAT_BOX
-colors: FL_BLACK FL_YELLOW
-alignment: FL_ALIGN_BOTTOM
-style: FL_NORMAL_STYLE
-size: FL_TINY_SIZE
-lcol: FL_BLACK
-label: PUSCH constellation
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: pusch_constellation
-callback: 
-argument: 
-
---------------------
-class: FL_XYPLOT
-type: POINTS_XYPLOT
-box: 370 30 220 190
-boxtype: FL_FLAT_BOX
-colors: FL_BLACK FL_YELLOW
-alignment: FL_ALIGN_BOTTOM
-style: FL_NORMAL_STYLE
-size: FL_TINY_SIZE
-lcol: FL_BLACK
-label: PDSCH constellation
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: pdsch_constellation
-callback: 
-argument: 
-
---------------------
-class: FL_XYPLOT
-type: IMPULSE_XYPLOT
-box: 370 240 210 60
-boxtype: FL_FLAT_BOX
-colors: FL_BLACK FL_YELLOW
-alignment: FL_ALIGN_BOTTOM
-style: FL_NORMAL_STYLE
-size: FL_TINY_SIZE
-lcol: FL_BLACK
-label: CH00
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: ch00
-callback: 
-argument: 
-
-==============================
-create_the_forms
diff --git a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.h b/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.h
deleted file mode 100644
index 2f37a7a5a78e92af7efd136f7f2e440817b8273d..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY_L2/phy_procedures_sim_form.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
-    OpenAirInterface
-    Copyright(c) 1999 - 2014 Eurecom
-
-    OpenAirInterface is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-
-    OpenAirInterface is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenAirInterface.The full GNU General Public License is
-   included in this distribution in the file called "COPYING". If not,
-   see <http://www.gnu.org/licenses/>.
-
-  Contact Information
-  OpenAirInterface Admin: openair_admin@eurecom.fr
-  OpenAirInterface Tech : openair_tech@eurecom.fr
-  OpenAirInterface Dev  : openair4g-devel@eurecom.fr
-
-  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
-
- *******************************************************************************/
-/** Header file generated with fdesign on Tue Jul 27 16:31:42 2010.**/
-
-#ifndef FD_phy_procedures_sim_h_
-#define FD_phy_procedures_sim_h_
-
-/** Callbacks, globals and object handlers **/
-
-
-/**** Forms and Objects ****/
-typedef struct {
-  FL_FORM *phy_procedures_sim;
-  void *vdata;
-  char *cdata;
-  long  ldata;
-  FL_OBJECT *pusch_constellation;
-  FL_OBJECT *pdsch_constellation;
-  FL_OBJECT *ch00;
-} FD_phy_procedures_sim;
-
-extern FD_phy_procedures_sim * create_form_phy_procedures_sim(void);
-
-#endif /* FD_phy_procedures_sim_h_ */