Prof. Avishalom Marani
IN MEMORY OF
Prof. Avishalom Marani
1924 - 2020
Cotton physiology and breeding; Moisture stress in field crops; Quantitative genetics in plant breeding; Heterosis in cotton.
The source code of Cotton2K is hereby made available for research and education purposes. As many other crop simulation models, this model simulates processes involving weather elements, soil water, soil nitrogen, soil temperature, root growth, plant growth, plant phenology, plant water relations, plant nitrogen, etc. Some of these simulated processes are unique to the cotton crop, but most of them can be used (unchanged, or with some modifications) in simulation models of other crops.
Scientists who try to develop crop simulation models often spend a lot of their time in developing the framework of the model, and in repeating tasks that have already been done by other scientists. Programming is a very time - consuming effort (if done by scientists or graduate students), or expensive (if done by hired programmers). Progress in crop modeling would therefore be greatly enhanced if some modelers will be willing to share their efforts, and other modelers will be able to use some existing "building blocks" and add to them their own contribution. The concept of "object oriented programming", which is now used in all modern programming languages, makes it easy to transfer code segments from one model to another.
For general information about the cotton2Kmodel see: Description of Cotton2K
I hope some segments of this code will be found useful by members of the crop modelling community. Please do not hesitate to write me if you have any questions, comments or criticism.
The code is written in C++, and compiled by Microsoft Visual C++.Net 2003. Microsoft Foundation Classes (MFC) are used for deriving the framework of the model, but most of the functions are class-free and may probably be compiled by any C++ compiler. The code is commented to add explanations for most of the code segments. Local variables are defined when declared in each function. The 'file scope' variables are defined at the beginning of each file. The 'global' variables are defined in file 'global.cpp'.
This program (version 4.0) has been written in 2004 by
Avishalom Marani
Professor Emeritus at the Institute of Plant Science
School of Agriculture of the Hebrew University of Jerusalem
P.O.Box 12
Rehovoth 76100
Israel
Email address: Avshalom.Marani@mail.huji.ac.il
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 2 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. To receive a copy of the GNU General Public License write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, or contact http://www.gnu.org/licenses/gpl.txt
The following is adapted from parts of the document created by the Free Software Foundation.
You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work, provided that you also meet all of these conditions:
Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission.
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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.
The code of program CottonModel includes the following files and functions:
Package A. General Framework:Package B. Input Routines:
Package C. Climate:
Package E. Soil Temperature:
Package F. The Root System:
Package G.The Cotton Plant:
Package H. Output Routines:
All the source code files can be downloaded at once (file size 208 KB). Another option is to download each or some of the packages separately . To get the list of files in each package see List of files and functions . In this case, it is recommended not to exclude Section A, which contains the header files and the dictionary of global variables.Downloading Information
The downloaded files are stored as *.zip files. Unzip before attempting to read these files. Read these files by any text editor (like Notepad) or any C++ compiler.
Section A contains some files, specific for the compiler, which are needed for compilation. If compilation is not needed, only files of type *.cpp, *.h, or *.rc have to be read.
To download All the files of the source code: Download Source Code of Cotton2K
To download individual sections of the source code:
Package A - Download General Framework
Package B - Download Input Routines
Package C - Download Climate Routines
Package D - Download Soil Routines
Package E - Download Soil Temperature Routines
Package F - Download Root System Routines
Package G - Download Cotton Plant Routines
Package H - Download Output Routines