Commit a2c028c8 authored by Andrew Senior's avatar Andrew Senior

Initial import

parents
This diff is collapsed.
#!/bin/bash
#
# erpmodel.sh - shell script to start ERP model
#
# Copyright 2016 Andrew Senior
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Figure out where we are and start Octave with the correct path
ERP_ROOT=`readlink -f $0`
ERP_ROOT=`dirname $ERP_ROOT`
ERP_ROOT=`dirname $ERP_ROOT` # remove /bin too
octave --path $ERP_ROOT/octave --eval startup --persist
body {
font-family: helvetica;
}
<html>
<head>
<title>EISCAT Heater ERP model</title>
<link rel="stylesheet" type="text/css" href="heatererp.css" />
</head>
<body>
<h1>The EISCAT Heater ERP model</h1>
<h2>Contents</h2>
<nl>
<li><a href="overview.html">Overview</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="running.html">Running the Model</a></li>
</nl>
</body>
</html>
<html>
<head>
<title>Installation: EISCAT Heater ERP model</title>
<link rel="stylesheet" type="text/css" href="heatererp.css" />
</head>
<h1>Installation</h1>
<p>If the software was obtained from the <em>git</em> repository then it will
be located in the directory where it was put by <code>git clone</code> and
should contain the following directory structure
<pre>
<code>/some/path/doc -- this documentation</code>
<code> /bin -- binary/executable/script files</code>
<code> /octave -- Octave source files</code>
<code> /nec-patch -- patch for Debian/Ubuntu nec package</code>
</pre>
where <code>/some/path</code> is the directory it was cloned into.</p>
<p>In the <code>bin</code> directory is a shell script, <code>erpmodel.sh</code>
, which is used to start the software. You should create a symbolic link to
this file somewhere on your shell's search path,
e.g. <code>/usr/local/bin/erpmodel</code>. The software can then be started
simply by typing <code>erpmodel</code> at the shell prompt.</p>
<h2>NEC installation</h2>
<p>The software is designed to work with the version of NEC from the Debian/
Ubuntu <code>nec</code> package. Unfortunately the standard version of this
package does not permit enough sources to be applied to the antenna structure to
model the HF heating arrays. A patch is supplied in the <code>nec-patch</code>
subdirectory of the ERP model installation.</p>
<p>If you are running Debian or Ubuntu, first install the <code>nec</code>
<em>source</em> package into a location of your choice by doing
<pre>
<code>cd /path/of/your/choice</code>
<code>apt-get source nec</code>
</pre>
This will install the NEC source in the directory
<code>/path/of/your/choice</code>. You may need to install some other packages
so that <code>apt-get</code> can correctly set up the source (you should receive
a warning message if this is the case).</p>
<p>You can now apply the patch in the following way
<pre>
<code>cd /path/of/your/choice/nec-2</code>
<code>patch -p1 &lt; /some/path/nec-patch/NEC-PATCH</code>
</pre>
where <code>/some/path</code> is the path where the ERP model software was
installed above. Finally, the NEC software should be built using
<pre>
<code>make</code>
</pre>
You may have to install the <code>f2c</code> package in order to build the
NEC code.</p>
<h2>Setup</h2>
<p>After installation, the first time a user runs the software, they will be
prompted to configure it by specifying the location of various files such as
the transmitter logs, the antenna array model files, where plots and results
should be stored and the path to the NEC executable. These settings are stored
individually for each user.</p>
<p>If you installed the NEC software according to the instructions above, the
path to the NEC excutable will be
<code>/path/of/your/choice/nec-2/nec/nec2</code></p>
<body>
</body>
</html>
<html>
<head>
<title>Overview: The EISCAT Heater ERP model</title>
<link rel="stylesheet" type="text/css" href="heatererp.css" />
</head>
<body>
<h1>Overview</h1>
<h2>Purpose</h2>
<p>The Heater ERP model is intended to make easy the calculation of the Heater's
effective radiated power and beam properties based on the logged transmitter
operating parameters. Given a time of operation, the model will find the
log entry, run an electromagnetic model of the antenna array and produce plots
showing the resulting beams and ERPs.</p>
<h2>Structure</h2>
<p>The model consists of two parts. At the core is the Numerical
Electromagnetics Code (NEC), a FORTRAN code developed at the Lawrence
Livermore Lab. This code has formed the basis of a number of commercial
antenna modelling packages. In addition to NEC is an Octave program which
"drives" NEC by first finding the transmitter parameters and creating the
necessary input file before invoking NEC to process this file. The Octave
code then processes the NEC output file to produce annotated plots of the
results.</p>
<hr>
<p><a href="index.html">Contents</a></p>
</body>
</html>
<html>
<head>
<title>Running: EISCAT Heater ERP model</title>
<link rel="stylesheet" type="text/css" href="heatererp.css" />
</head>
<body>
<h1>Running the model</h1>
<h2>Normal usage</h2>
<p>If the software has been installed correctly, it can be started by typing
<pre>
<code>erpmodel</code>
</pre>
at the shell prompt.</p>
<p>To run the model for the time 1970-01-01 00:01:00, give the command
<pre>
<code>erpmodel('01-Jan-1970 00:01:00')</code>
</pre>
Note that the format of the date/time string must be one which the Octave
<code>datenum</code> function will recognise.</p>
<p>The model will then search for a transmitter log entry nearest to the time
requested when at least one transmitter was active. If a log file cannot be
identified based on the date requested, you will be prompted to supply the
path and filename of the appropriate log file.</p>
<p>Having found a suitable log entry, the model will then group the transmitters
according to frequency and array and run NEC for each group of transmitters.
Plots showing the results for each group of transmitters will appear on the
screen and PDF files of the plots will be saved in the plots directory.
The NEC input and output files will be archived in .zip archives in the results
directory.</p>
<h2>Special cases</h2>
<p>It may be useful to run the model for a case which does not exist in a log
file, e.g. to investigate the effect of changing transmitter parameters on
the radiation pattern. The model makes this possible by allowing the user to
specify the transmitter parameters directly, rather than by searching for a
log entry.</p>
<p>The transmitter parameters should be placed in an Octave structure, here
called <code>L</code>, as follows
<pre>
<code>L.dn=datenum('1970-01-01 12:34:56');</code>
<code>L.freq=5.423*ones(1,12);</code>
<code>L.arr=1*ones(1,12);</code>
<code>L.pha=[0 90 0 90 0 90 0 90 0 90 0 90];</code>
<code>L.swr=1*ones(1,12);</code>
<code>L.pwr=85*ones(1,12);</code>
<code>L.ref_freq=5.423*[1 1];</code>
</pre>
This creates a representation of a log entry for 1970-01-01 12:34:56 where
all 12 transmitters are operating on 5.423 MHz using Array 1 and phased for
a vertical X-mode beam. All transmitters have a power of 85 kW. The model
can then be run using the command
<pre>
<code>erpmodel(L)</code>
</pre>
The program will prompt for an optional plot title which can be left blank
for the default. The plot title always contains the antenna array, frequency
and total transmitter power; a title entered by the user is placed in front
of this information in place of the date and time.</p>
<p>The program will also prompt for an optional file name which can also be
left blank for the default. If a name is entered, it is used instead of the
date and time at the beginning of each file name; the antenna array and
frequency are always included in the file name.
</p>
<p>If the default plot title or file name is selected but the log entry
structure does not contain a valid date/time in the <code>dn</code> field,
the program will prompt for a date and time to be entered.</p>
<hr>
<p><a href="index.html">Contents</a></p>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
% HF Array 2 simple model
% Copyright 2016 EISCAT Scientific Association
%
% This work is licensed under the Creative Commons
% Attribution-NonCommercial-ShareAlike 4.0 International License.
% To view a copy of this license, visit
% http://creativecommons.org/licenses/by-nc-sa/4.0/
% or send a letter to Creative Commons, PO Box 1866, Mountain View,
% CA 94042, USA.
%
43.836 270.086 15.800 1.414 227.664 15.800 0.009
89.086 270.086 15.800 46.664 227.664 15.800 0.009
134.336 270.086 15.800 91.914 227.664 15.800 0.009
179.586 270.086 15.800 137.164 227.664 15.800 0.009
224.836 270.086 15.800 182.414 227.664 15.800 0.009
270.086 270.086 15.800 227.664 227.664 15.800 0.009
1.414 270.086 15.800 43.836 227.664 15.800 0.009
46.664 270.086 15.800 89.086 227.664 15.800 0.009
91.914 270.086 15.800 134.336 227.664 15.800 0.009
137.164 270.086 15.800 179.586 227.664 15.800 0.009
182.414 270.086 15.800 224.836 227.664 15.800 0.009
227.664 270.086 15.800 270.086 227.664 15.800 0.009
43.836 224.836 15.800 1.414 182.414 15.800 0.009
89.086 224.836 15.800 46.664 182.414 15.800 0.009
134.336 224.836 15.800 91.914 182.414 15.800 0.009
179.586 224.836 15.800 137.164 182.414 15.800 0.009
224.836 224.836 15.800 182.414 182.414 15.800 0.009
270.086 224.836 15.800 227.664 182.414 15.800 0.009
1.414 224.836 15.800 43.836 182.414 15.800 0.009
46.664 224.836 15.800 89.086 182.414 15.800 0.009
91.914 224.836 15.800 134.336 182.414 15.800 0.009
137.164 224.836 15.800 179.586 182.414 15.800 0.009
182.414 224.836 15.800 224.836 182.414 15.800 0.009
227.664 224.836 15.800 270.086 182.414 15.800 0.009
43.836 179.586 15.800 1.414 137.164 15.800 0.009
89.086 179.586 15.800 46.664 137.164 15.800 0.009
134.336 179.586 15.800 91.914 137.164 15.800 0.009
179.586 179.586 15.800 137.164 137.164 15.800 0.009
224.836 179.586 15.800 182.414 137.164 15.800 0.009
270.086 179.586 15.800 227.664 137.164 15.800 0.009
1.414 179.586 15.800 43.836 137.164 15.800 0.009
46.664 179.586 15.800 89.086 137.164 15.800 0.009
91.914 179.586 15.800 134.336 137.164 15.800 0.009
137.164 179.586 15.800 179.586 137.164 15.800 0.009
182.414 179.586 15.800 224.836 137.164 15.800 0.009
227.664 179.586 15.800 270.086 137.164 15.800 0.009
43.836 134.336 15.800 1.414 91.914 15.800 0.009
89.086 134.336 15.800 46.664 91.914 15.800 0.009
134.336 134.336 15.800 91.914 91.914 15.800 0.009
179.586 134.336 15.800 137.164 91.914 15.800 0.009
224.836 134.336 15.800 182.414 91.914 15.800 0.009
270.086 134.336 15.800 227.664 91.914 15.800 0.009
1.414 134.336 15.800 43.836 91.914 15.800 0.009
46.664 134.336 15.800 89.086 91.914 15.800 0.009
91.914 134.336 15.800 134.336 91.914 15.800 0.009
137.164 134.336 15.800 179.586 91.914 15.800 0.009
182.414 134.336 15.800 224.836 91.914 15.800 0.009
227.664 134.336 15.800 270.086 91.914 15.800 0.009
43.836 89.086 15.800 1.414 46.664 15.800 0.009
89.086 89.086 15.800 46.664 46.664 15.800 0.009
134.336 89.086 15.800 91.914 46.664 15.800 0.009
179.586 89.086 15.800 137.164 46.664 15.800 0.009
224.836 89.086 15.800 182.414 46.664 15.800 0.009
270.086 89.086 15.800 227.664 46.664 15.800 0.009
1.414 89.086 15.800 43.836 46.664 15.800 0.009
46.664 89.086 15.800 89.086 46.664 15.800 0.009
91.914 89.086 15.800 134.336 46.664 15.800 0.009
137.164 89.086 15.800 179.586 46.664 15.800 0.009
182.414 89.086 15.800 224.836 46.664 15.800 0.009
227.664 89.086 15.800 270.086 46.664 15.800 0.009
43.836 43.836 15.800 1.414 1.414 15.800 0.009
89.086 43.836 15.800 46.664 1.414 15.800 0.009
134.336 43.836 15.800 91.914 1.414 15.800 0.009
179.586 43.836 15.800 137.164 1.414 15.800 0.009
224.836 43.836 15.800 182.414 1.414 15.800 0.009
270.086 43.836 15.800 227.664 1.414 15.800 0.009
1.414 43.836 15.800 43.836 1.414 15.800 0.009
46.664 43.836 15.800 89.086 1.414 15.800 0.009
91.914 43.836 15.800 134.336 1.414 15.800 0.009
137.164 43.836 15.800 179.586 1.414 15.800 0.009
182.414 43.836 15.800 224.836 1.414 15.800 0.009
227.664 43.836 15.800 270.086 1.414 15.800 0.009
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
% HF Array 3 simple model
% Copyright 2016 EISCAT Scientific Association
%
% This work is licensed under the Creative Commons
% Attribution-NonCommercial-ShareAlike 4.0 International License.
% To view a copy of this license, visit
% http://creativecommons.org/licenses/by-nc-sa/4.0/
% or send a letter to Creative Commons, PO Box 1866, Mountain View,
% CA 94042, USA.
%
30.869 190.869 11.170 1.131 161.131 11.170 0.009
62.869 190.869 11.170 33.131 161.131 11.170 0.009
94.869 190.869 11.170 65.131 161.131 11.170 0.009
126.869 190.869 11.170 97.131 161.131 11.170 0.009
158.869 190.869 11.170 129.131 161.131 11.170 0.009
190.869 190.869 11.170 161.131 161.131 11.170 0.009
1.131 190.869 11.170 30.869 161.131 11.170 0.009
33.131 190.869 11.170 62.869 161.131 11.170 0.009
65.131 190.869 11.170 94.869 161.131 11.170 0.009
97.131 190.869 11.170 126.869 161.131 11.170 0.009
129.131 190.869 11.170 158.869 161.131 11.170 0.009
161.131 190.869 11.170 190.869 161.131 11.170 0.009
30.869 158.869 11.170 1.131 129.131 11.170 0.009
62.869 158.869 11.170 33.131 129.131 11.170 0.009
94.869 158.869 11.170 65.131 129.131 11.170 0.009
126.869 158.869 11.170 97.131 129.131 11.170 0.009
158.869 158.869 11.170 129.131 129.131 11.170 0.009
190.869 158.869 11.170 161.131 129.131 11.170 0.009
1.131 158.869 11.170 30.869 129.131 11.170 0.009
33.131 158.869 11.170 62.869 129.131 11.170 0.009
65.131 158.869 11.170 94.869 129.131 11.170 0.009
97.131 158.869 11.170 126.869 129.131 11.170 0.009
129.131 158.869 11.170 158.869 129.131 11.170 0.009
161.131 158.869 11.170 190.869 129.131 11.170 0.009
30.869 126.869 11.170 1.131 97.131 11.170 0.009
62.869 126.869 11.170 33.131 97.131 11.170 0.009
94.869 126.869 11.170 65.131 97.131 11.170 0.009
126.869 126.869 11.170 97.131 97.131 11.170 0.009
158.869 126.869 11.170 129.131 97.131 11.170 0.009
190.869 126.869 11.170 161.131 97.131 11.170 0.009
1.131 126.869 11.170 30.869 97.131 11.170 0.009
33.131 126.869 11.170 62.869 97.131 11.170 0.009
65.131 126.869 11.170 94.869 97.131 11.170 0.009
97.131 126.869 11.170 126.869 97.131 11.170 0.009
129.131 126.869 11.170 158.869 97.131 11.170 0.009
161.131 126.869 11.170 190.869 97.131 11.170 0.009
30.869 94.869 11.170 1.131 65.131 11.170 0.009
62.869 94.869 11.170 33.131 65.131 11.170 0.009
94.869 94.869 11.170 65.131 65.131 11.170 0.009
126.869 94.869 11.170 97.131 65.131 11.170 0.009
158.869 94.869 11.170 129.131 65.131 11.170 0.009
190.869 94.869 11.170 161.131 65.131 11.170 0.009
1.131 94.869 11.170 30.869 65.131 11.170 0.009
33.131 94.869 11.170 62.869 65.131 11.170 0.009
65.131 94.869 11.170 94.869 65.131 11.170 0.009
97.131 94.869 11.170 126.869 65.131 11.170 0.009
129.131 94.869 11.170 158.869 65.131 11.170 0.009
161.131 94.869 11.170 190.869 65.131 11.170 0.009
30.869 62.869 11.170 1.131 33.131 11.170 0.009
62.869 62.869 11.170 33.131 33.131 11.170 0.009
94.869 62.869 11.170 65.131 33.131 11.170 0.009
126.869 62.869 11.170 97.131 33.131 11.170 0.009
158.869 62.869 11.170 129.131 33.131 11.170 0.009
190.869 62.869 11.170 161.131 33.131 11.170 0.009
1.131 62.869 11.170 30.869 33.131 11.170 0.009
33.131 62.869 11.170 62.869 33.131 11.170 0.009
65.131 62.869 11.170 94.869 33.131 11.170 0.009
97.131 62.869 11.170 126.869 33.131 11.170 0.009
129.131 62.869 11.170 158.869 33.131 11.170 0.009
161.131 62.869 11.170 190.869 33.131 11.170 0.009
30.869 30.869 11.170 1.131 1.131 11.170 0.009
62.869 30.869 11.170 33.131 1.131 11.170 0.009
94.869 30.869 11.170 65.131 1.131 11.170 0.009
126.869 30.869 11.170 97.131 1.131 11.170 0.009
158.869 30.869 11.170 129.131 1.131 11.170 0.009
190.869 30.869 11.170 161.131 1.131 11.170 0.009
1.131 30.869 11.170 30.869 1.131 11.170 0.009
33.131 30.869 11.170 62.869 1.131 11.170 0.009
65.131 30.869 11.170 94.869 1.131 11.170 0.009
97.131 30.869 11.170 126.869 1.131 11.170 0.009
129.131 30.869 11.170 158.869 1.131 11.170 0.009
161.131 30.869 11.170 190.869 1.131 11.170 0.009
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
# Source limit patch for NEC 2
#
# Written in 2016 by Andrew Senior <andrew.senior01@gmail.com>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software.
#
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
#
diff --git a/nec/nec2.f b/nec/nec2.f
index 004f776..a2191c3 100644
--- a/nec/nec2.f
+++ b/nec/nec2.f
@@ -36,6 +36,9 @@ C .. M is number patches
C .. N2M = N+2*M, N3M = N+3*M
PARAMETER ( NM=10000, N2M=15000, N3M=20000)
+C Maximum number of sources
+ PARAMETER (NSMAX = 300)
+
CHARACTER AIN*2, ATST*2, INFILE*256, OTFILE*256
C***
C INTEGER AIN,ATST,PNET
@@ -68,8 +71,8 @@ C..Command Line parsing..
&20)
COMMON /SEGJ/ AX(30), BX(30), CX(30), JCO(30), JSNO, ISCON(50),
&NSCON, IPCON(10), NPCON
- COMMON /VSORC/ VQD(30), VSANT(30), VQDS(30), IVQD(30), ISANT(30)
- &, IQDS(30), NVQD, NSANT, NQDS
+ COMMON /VSORC/ VQD(NSMAX), VSANT(NSMAX), VQDS(NSMAX),
+ & IVQD(NSMAX), ISANT(NSMAX), IQDS(NSMAX), NVQD, NSANT, NQDS
COMMON /NETCX/ ZPED, PIN, PNLS, NEQ, NPEQ, NEQ2, NONET, NTSOL,
&NPRINT, MASYM, ISEG1(150), ISEG2(150), X11R(150), X11I(150),
&X12R(150), X12I(150), X22R(150), X22I(150), NTYP(150)
@@ -101,7 +104,9 @@ C***
DATA PNET/6H ,2H ,6HSTRAIG,2HHT,6HCROSSE,1HD/
DATA TA/1.745329252D-02/, CVEL/299.8/
C***
- DATA LOADMX, NSMAX, NETMX/200,150,150/, NORMF/200/
+C DATA LOADMX, NSMAX, NETMX/200,150,150/, NORMF/200/
+ DATA LOADMX, NETMX/200,150/, NORMF/200/
+
706 CONTINUE
C..Fortran 77 Extension to get number args..
@@ -1210,8 +1215,9 @@ C
&CII( NM), CUR( N3M)
COMMON /SEGJ/ AX(30), BX(30), CX(30), JCO(30), JSNO, ISCON(50),
&NSCON, IPCON(10), NPCON
- COMMON /VSORC/ VQD(30), VSANT(30), VQDS(30), IVQD(30), ISANT(30)
- &, IQDS(30), NVQD, NSANT, NQDS
+ PARAMETER (NSMAX = 300)
+ COMMON /VSORC/ VQD(NSMAX), VSANT(NSMAX), VQDS(NSMAX),
+ & IVQD(NSMAX), ISANT(NSMAX), IQDS(NSMAX), NVQD, NSANT, NQDS
COMMON /ANGL/ SALP( NM)
DIMENSION T1X(1), T1Y(1), T1Z(1), T2X(1), T2Y(1), T2Z(1)
DIMENSION CURX(1), CCJX(2)
@@ -2460,8 +2466,9 @@ C
&, VQD, VSANT, VQDS
COMMON /YPARM/ NCOUP, ICOUP, NCTAG(5), NCSEG(5), Y11A(5), Y12A(
&20)
- COMMON /VSORC/ VQD(30), VSANT(30), VQDS(30), IVQD(30), ISANT(30)
- &, IQDS(30), NVQD, NSANT, NQDS
+ PARAMETER (NSMAX = 300)
+ COMMON /VSORC/ VQD(NSMAX), VSANT(NSMAX), VQDS(NSMAX),
+ & IVQD(NSMAX), ISANT(NSMAX), IQDS(NSMAX), NVQD, NSANT, NQDS
DIMENSION CUR(1)
IF( NSANT.NE.1.OR. NVQD.NE.0) RETURN
J= ISEGNO( NCTAG( ICOUP+1), NCSEG( ICOUP+1))
@@ -3298,8 +3305,9 @@ C
&Z( NM), SI( NM), BI( NM), ALP( NM), BET( NM), ICON1( N2M), ICON2(
& N2M), ITAG( N2M), ICONX( NM), WLAM, IPSYM
COMMON /ANGL/ SALP( NM)
- COMMON /VSORC/ VQD(30), VSANT(30), VQDS(30), IVQD(30), ISANT(30)
- &, IQDS(30), NVQD, NSANT, NQDS
+ PARAMETER (NSMAX = 300)
+ COMMON /VSORC/ VQD(NSMAX), VSANT(NSMAX), VQDS(NSMAX),
+ & IVQD(NSMAX), ISANT(NSMAX), IQDS(NSMAX), NVQD, NSANT, NQDS
COMMON /GND/ ZRATI, ZRATI2, FRATI, CL, CH, SCRWL, SCRWR, NRADL,
&KSYMP, IFAR, IPERF, T1, T2
DIMENSION CAB(1), SAB(1), E( N2M)
@@ -6293,8 +6301,9 @@ C
& N2M), ITAG( N2M), ICONX( NM), WLAM, IPSYM
COMMON /CRNT/ AIR( NM), AII( NM), BIR( NM), BII( NM), CIR( NM),
&CII( NM), CUR( N3M)
- COMMON /VSORC/ VQD(30), VSANT(30), VQDS(30), IVQD(30), ISANT(30)
- &, IQDS(30), NVQD, NSANT, NQDS
+ PARAMETER (NSMAX = 300)
+ COMMON /VSORC/ VQD(NSMAX), VSANT(NSMAX), VQDS(NSMAX),
+ & IVQD(NSMAX), ISANT(NSMAX), IQDS(NSMAX), NVQD, NSANT, NQDS
COMMON /NETCX/ ZPED, PIN, PNLS, NEQ, NPEQ, NEQ2, NONET, NTSOL,
&NPRINT, MASYM, ISEG1(150), ISEG2(150), X11R(150), X11I(150),
&X12R(150), X12I(150), X22R(150), X22I(150), NTYP(150)
@@ -7190,8 +7199,9 @@ C FILL INCIDENT FIELD ARRAY FOR CHARGE DISCONTINUITY VOLTAGE SOURCE
COMMON /DATA/ LD, N1, N2, N, NP, M1, M2, M, MP, X( NM), Y( NM),
&Z( NM), SI( NM), BI( NM), ALP( NM), BET( NM), ICON1( N2M), ICON2(
& N2M), ITAG( N2M), ICONX( NM), WLAM, IPSYM
- COMMON /VSORC/ VQD(30), VSANT(30), VQDS(30), IVQD(30), ISANT(30)
- &, IQDS(30), NVQD, NSANT, NQDS
+ PARAMETER (NSMAX = 300)
+ COMMON /VSORC/ VQD(NSMAX), VSANT(NSMAX), VQDS(NSMAX),
+ & IVQD(NSMAX), ISANT(NSMAX), IQDS(NSMAX), NVQD, NSANT, NQDS
COMMON /SEGJ/ AX(30), BX(30), CX(30), JCO(30), JSNO, ISCON(50),
&NSCON, IPCON(10), NPCON
COMMON /DATAJ/ S, B, XJ, YJ, ZJ, CABJ, SABJ, SALPJ, EXK, EYK,
@@ -7641,7 +7651,7 @@ C END OF I-TH NUMERICAL FIELD
C USER PUT DECIMAL POINT FOR INTEGER
IF( IND.EQ. NLEN) NLEN= NLEN-1
READ( BUFFER(1: NLEN),111,ERR=110) IARR( I)
-111 format(i3)
+111 FORMAT(I4)
90 CONTINUE
DO 100 I= NINT+1, IFOUND
NLEN= EP( I)- BP( I)+1
function [GL,GR,G_avg,A]=analyseradpat(T,P,G,Et,Ep)
% ANALYSERADPAT Analyse radiation pattern
%
% [GL, GR, G_avg, A]=analyseradpat(T, P, G, Et, Ep)
%
% T, P, G, Et, Ep are matrices of the same size giving the zenith and
% azimuth angles, the total gain and the zenithal and azimuthal components
% of the electric field respectively for each point in the radiation pattern.
%
% GL and GR are matrices of the same size as the inputs giving the gains for
% LHCP and RHCP respectively.
%
% G_avg is the average total power gain (linear, not dB) and A is the
% averaging area in steradians. Ideally, for a model with perfect ground,
% G_avg=2. Deviation of G_avg from the ideal can be used to correct the gains.
% Copyright 2016 Andrew Senior
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
% Find magnitudes of the left- and right-hand circular components
% of the electric field
ER_mag=0.5*sqrt((real(Et)-imag(Ep)).^2 + (imag(Et)+real(Ep)).^2);
EL_mag=0.5*sqrt((real(Et)+imag(Ep)).^2 + (-imag(Et)+real(Ep)).^2);
% Proportion of total power in LHCP and RHCP
Ptot=ER_mag.^2+EL_mag.^2;
PR=ER_mag.^2./Ptot;
PL=EL_mag.^2./Ptot;
% Gain for LHCP and RHCP
GR=G+10*log10(PR);
GL=G+10*log10(PL);
% If electric fields were zero, force gain to zero too.
k=find(abs(Et==0) & (Ep==0));
GR(k)=-inf;
GL(k)=-inf;
% Average total power gain
% NB: this is not necessarily exactly how NEC2 does it!
dT=(T(2,1)-T(1,1))*pi/180;
dP=(P(1,2)-P(1,1))*pi/180;
% all points except zenith
dA=sind(T)*dT*dP;
dA(T==0)=0;
dA(T==90)=0.5*dA(T==90);
A=sum(dA(:));
G_avg=sum(dA(:).*10.^(G(:)/10));
% zenith point
dA=dT^2*pi/4;
A=A+dA;
G_avg=(G_avg+dA*10.^(G(1,1)/10))/A;
function erpmodel(t_wanted)
% ERPMODEL Run Heater ERP model for specified time
%
% erpmodel(t_wanted)
%
% Where t_wanted is a date/time string in a format recognised by
% the DATENUM function, e.g. '30-Nov-2010 10:00:10'
% Copyright 2016 Andrew Senior
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%