mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Removing the unused trick_test directory.
This commit is contained in:
parent
87741062e0
commit
555f78f7b8
@ -1,9 +0,0 @@
|
||||
<!-- Trick Requirements definition -->
|
||||
<!-- V 1.0 -->
|
||||
|
||||
<!ELEMENT requirement (#PCDATA | requirement)*>
|
||||
|
||||
<!ATTLIST requirement statement CDATA #IMPLIED>
|
||||
<!ATTLIST requirement tag CDATA #IMPLIED>
|
||||
<!ATTLIST requirement note CDATA #IMPLIED>
|
||||
<!ATTLIST requirement verify CDATA #IMPLIED>
|
@ -1,20 +0,0 @@
|
||||
all: build_date
|
||||
@ xsltproc XSLT/XMLstoXML.xsl src_xml/Test_List.xml > src_xml/AllTests.xml
|
||||
@ $(MAKE) -C TagRequirements/
|
||||
@ ./TagRequirements/TagRequirements src_xml/TopLevelReqs.xml > src_xml/TopLevelReqs_tag.xml
|
||||
@ xsltproc XSLT/REQtoREQNUM.xsl src_xml/TopLevelReqs_tag.xml > src_xml/intermediate.xml
|
||||
@ xsltproc XSLT/XMLtoHTML.xsl src_xml/intermediate.xml > Requirements.html
|
||||
@ rm -rf build_date.xml
|
||||
@ rm -rf src_xml/intermediate.xml
|
||||
@ rm -rf src_xml/TopLevelReqs_tag.xml
|
||||
@ rm -rf src_xml/AllTests.xml
|
||||
|
||||
build_date:
|
||||
@ echo "<build_date date=\"`date`\"/>" > build_date.xml
|
||||
|
||||
clean:
|
||||
@ rm -rf Requirements.html
|
||||
@ $(MAKE) -C TagRequirements clean
|
||||
|
||||
install: all
|
||||
@ cp Requirements.html ${TRICK_HOME}/docs/.
|
@ -1,41 +0,0 @@
|
||||
#######################################################################################
|
||||
README: TRICK 13 REQUIREMENTS DOCUMENT INSTRUCTIONS
|
||||
---------------------------------------------------
|
||||
Author: Lindsay Landry
|
||||
#######################################################################################
|
||||
|
||||
To generate Requirements.html in this directory, type (in the current directory):
|
||||
[usr]$ make
|
||||
**Requirements document is also made after typing "make test" from the top level directory
|
||||
Requirements.html will be put into the docs folder under trunk.
|
||||
|
||||
To add new unit test xml files to documentation, add the file name to "Test_List.xml"
|
||||
|
||||
To add requirements to the tree, make changes to "TopLevelReqs.xml"
|
||||
|
||||
These requirements are organized in a hierarchical format (think of a tree),
|
||||
with the topmost level requirements at the roots of this "tree" and the lower level
|
||||
requirements making up the branches. Keep this format in mind when adding, deleting,
|
||||
or making changes to requirements in the tree.
|
||||
|
||||
Each requirement in TopLevelReqs.xml looks as follows:
|
||||
|
||||
<requirement
|
||||
statement="This shall serve as an example requirement."/>
|
||||
|
||||
statement:
|
||||
This is where the actual requirement verbage goes, verbatim, as you want it to appear
|
||||
in the document.
|
||||
|
||||
Each requirement in Requirements.html looks as follows:
|
||||
|
||||
3.2.3 Trick shall respond to executive commands sent via the input processor. [3822434711]
|
||||
|
||||
[3822434711]:
|
||||
This is the tag associated with the requirement statement. This number is used when
|
||||
linking one or more unit test with this requirement.
|
||||
|
||||
For instructions on how to link unit tests with requirements, go to
|
||||
${TRICK_HOME}/trick_source/trick_utils/reqs/
|
||||
and look at the README document. As an alternative, you can look at the Integrator unit
|
||||
test code for examples.
|
@ -1,168 +0,0 @@
|
||||
#include "Requirement.hh"
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <string.h>
|
||||
|
||||
int Requirement::Initialize(xmlNode *root_node) {
|
||||
|
||||
int rc = 0;
|
||||
if (strcmp((char*) root_node->name, "requirement") == 0) {
|
||||
|
||||
/* Process children */
|
||||
xmlNode *current_node = root_node->children;
|
||||
|
||||
while (current_node != NULL) {
|
||||
|
||||
if (current_node->type == XML_ELEMENT_NODE) {
|
||||
|
||||
if ( strcmp( (char *)current_node->name, "requirement") == 0) {
|
||||
try {
|
||||
|
||||
Requirement* requirement = new Requirement(current_node);
|
||||
derivedRequirements.push_back(requirement);
|
||||
|
||||
} catch (std::invalid_argument) {
|
||||
std::cerr << "ERROR: <requirement> specification." << std::endl;
|
||||
}
|
||||
} else {
|
||||
std::cerr << "WARNING: unknown element \"<" << current_node->name << ">\". Skipping." << std::endl;
|
||||
}
|
||||
}
|
||||
current_node = current_node->next;
|
||||
}
|
||||
} else {
|
||||
std::cerr << "ERROR: Expected <requirement> component but alas it wasn\'t found." << std::endl;
|
||||
rc = -1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
// CONSTRUCTOR
|
||||
Requirement::Requirement(xmlNode *Base_node) throw (std::invalid_argument)
|
||||
: XMLComponent(Base_node) {
|
||||
|
||||
if ( Initialize( Base_node) < 0) {
|
||||
throw std::invalid_argument("Requirement is un-usable.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DESTRUCTOR
|
||||
Requirement::~Requirement() {
|
||||
}
|
||||
|
||||
unsigned int Requirement::derivedRequirementsCount() {
|
||||
return (unsigned int)derivedRequirements.size();
|
||||
}
|
||||
|
||||
unsigned int hash( const char * s ) {
|
||||
unsigned int h = 31;
|
||||
while (*s) {
|
||||
h = h * 101 + (unsigned int)*s;
|
||||
s++;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
// Strip all of the extraneous white space from a string.
|
||||
std::string normalize( std::string& s) {
|
||||
|
||||
int state = 0;
|
||||
std::string result_s;
|
||||
|
||||
for (std::string::iterator ii = s.begin() ; ii < s.end() ; ii++) {
|
||||
|
||||
if (state == 0) {
|
||||
if (!isspace(*ii)) {
|
||||
result_s += *ii;
|
||||
state = 1;
|
||||
}
|
||||
} else {
|
||||
if (isspace(*ii)) {
|
||||
result_s += ' ';
|
||||
state = 0;
|
||||
} else {
|
||||
result_s += *ii;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result_s;
|
||||
}
|
||||
|
||||
void Requirement::writeAttribute( std::string& v, const char* k) {
|
||||
|
||||
std::string out_v;
|
||||
std::cout << " " << k << " = \"" ;
|
||||
for (std::string::iterator ii = v.begin() ; ii < v.end() ; ii++) {
|
||||
if (*ii == '"' ) {
|
||||
out_v += """;
|
||||
} else if (*ii == '\'') {
|
||||
out_v += "'";
|
||||
} else {
|
||||
out_v += *ii;
|
||||
}
|
||||
}
|
||||
std::cout << out_v << "\"" ;
|
||||
}
|
||||
|
||||
/*
|
||||
void Requirement::writeStatement( std::string& s) {
|
||||
|
||||
std::string out_s;
|
||||
std::cout << " statement = \"" ;
|
||||
for (std::string::iterator ii = s.begin() ; ii < s.end() ; ii++) {
|
||||
if (*ii == '"' ) {
|
||||
out_s += """;
|
||||
} else if (*ii == '\'') {
|
||||
out_s += "'";
|
||||
} else {
|
||||
out_s += *ii;
|
||||
}
|
||||
}
|
||||
std::cout << out_s << "\"" ;
|
||||
}
|
||||
*/
|
||||
|
||||
void Requirement::writeTagged(int indent) {
|
||||
|
||||
for (int ii = 0; ii < indent; ii++) { std::cout << " "; }
|
||||
|
||||
std::cout << "<requirement";
|
||||
|
||||
std::string statement = AttributeValue("statement");
|
||||
|
||||
std::string normalized_statement = normalize(statement);
|
||||
writeAttribute(normalized_statement, "statement");
|
||||
|
||||
std::string note = AttributeValue("note");
|
||||
if(note[0] != '\0') {
|
||||
std::string normalized_note = normalize(note);
|
||||
writeAttribute(normalized_note, "note");
|
||||
}
|
||||
|
||||
std::string verify = AttributeValue("verify");
|
||||
if(verify[0] != '\0') {
|
||||
std::string normalized_verify = normalize(verify);
|
||||
writeAttribute(normalized_verify, "verify");
|
||||
}
|
||||
|
||||
unsigned int tag = hash(normalized_statement.c_str());
|
||||
std::cout << " tag = \"" << tag << "\"";
|
||||
|
||||
unsigned int numberOfDerivedRequirements = derivedRequirementsCount();
|
||||
|
||||
if (numberOfDerivedRequirements == 0) {
|
||||
std::cout << "/>" << std::endl;
|
||||
} else {
|
||||
std::cout << ">" << std::endl;
|
||||
for (unsigned int ii = 0; ii < numberOfDerivedRequirements; ii++) {
|
||||
Requirement* dreq = derivedRequirements[ii];
|
||||
dreq->writeTagged(indent+3);
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < indent; ii++) { std::cout << " "; }
|
||||
std::cout << "</requirement>" << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
#ifndef REQUIREMENT_HH
|
||||
#define REQUIREMENT_HH
|
||||
|
||||
#include <stdexcept>
|
||||
#include <libxml/tree.h>
|
||||
#include "XMLComponent.hh"
|
||||
|
||||
class Requirement : public XMLComponent {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
Requirement(xmlNode * node) throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~Requirement();
|
||||
|
||||
unsigned int derivedRequirementsCount();
|
||||
void writeTagged(int indent);
|
||||
void writeAttribute( std::string& v, const char* k);
|
||||
|
||||
private:
|
||||
std::vector <Requirement *> derivedRequirements;
|
||||
|
||||
int Initialize(xmlNode *node);
|
||||
};
|
||||
#endif
|
@ -1,66 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include "Requirement.hh"
|
||||
|
||||
const char*usage_info[] = {
|
||||
"--------------------------------------------------",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"--------------------------------------------------",
|
||||
};
|
||||
|
||||
#define N_USAGE_LINES (sizeof(usage_info)/sizeof(usage_info[0]))
|
||||
void print_usage(const char* info[], int nlines) {
|
||||
int i;
|
||||
for (i=0; i<nlines; i++) {
|
||||
std::cout << info[i] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
||||
if (argc <= 1) {
|
||||
print_usage(usage_info, N_USAGE_LINES);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
xmlParserCtxtPtr parser_context;
|
||||
xmlDocPtr doc;
|
||||
xmlNode *root_node;
|
||||
|
||||
int valid = 0;
|
||||
|
||||
LIBXML_TEST_VERSION
|
||||
|
||||
// Create a parser context.
|
||||
if ((parser_context = xmlNewParserCtxt()) == NULL) {
|
||||
std::cerr << "ERROR: Out of Memory" << std::endl;
|
||||
std::cerr.flush();
|
||||
exit(0);
|
||||
} else {
|
||||
doc = xmlCtxtReadFile( parser_context, argv[1], NULL, XML_PARSE_RECOVER );
|
||||
|
||||
if (doc != NULL) {
|
||||
|
||||
if (parser_context->valid == 0) {
|
||||
std::cerr << "WARNING: XML file \"" << argv[1] << "\"" << " is not valid according to the dtd." << std::endl;
|
||||
}
|
||||
root_node = xmlDocGetRootElement(doc);
|
||||
|
||||
Requirement* requirement = new Requirement( root_node);
|
||||
std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
|
||||
std::cout << "<!DOCTYPE TopLevelReqs PUBLIC \"-//Tricklab//DTD Session V1.0//EN\" \"DTD/TopLevelReqs.dtd\">" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
requirement->writeTagged(0);
|
||||
|
||||
xmlFreeDoc(doc);
|
||||
} else {
|
||||
std::cerr << "ERROR: Parse of XML file \"" << argv[1] << "\"" << " failed." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
#include "XMLAttribute.hh"
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
|
||||
// COPY CONSTRUCTOR
|
||||
XMLAttribute::XMLAttribute(const XMLAttribute *attr) {
|
||||
key = attr->key;
|
||||
value = attr->value;
|
||||
}
|
||||
|
||||
// MEMBER FUNCTION
|
||||
int XMLAttribute::key_is (const char *name) {
|
||||
return (strcmp(name, this->key.c_str()) == 0);
|
||||
}
|
||||
|
||||
// MEMBER FUNCTION
|
||||
const std::string& XMLAttribute::value_of() {
|
||||
return this->value;
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
#ifndef XMLATTRIBUTE_HH
|
||||
#define XMLATTRIBUTE_HH
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class XMLAttribute {
|
||||
|
||||
public:
|
||||
/**
|
||||
* XMLAttribute constructor.
|
||||
* @param Key the identifier for the attribute.
|
||||
* @param Value the value of he attribute.
|
||||
*/
|
||||
XMLAttribute(const std::string& Key, const std::string& Value)
|
||||
: key(Key), value(Value) {}
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*/
|
||||
XMLAttribute(const XMLAttribute *attr);
|
||||
|
||||
/**
|
||||
* If name matches the key value of the attribute return 1, otherwise return 0..
|
||||
*/
|
||||
int key_is(const char *name);
|
||||
|
||||
/**
|
||||
* Return a pointer to a copy of the attribute value. The caller shall
|
||||
* be responsible for deleting the string that is returned.
|
||||
*/
|
||||
const std::string& value_of();
|
||||
|
||||
private:
|
||||
std::string key; /**< The name of the attribute.*/
|
||||
std::string value; /**< The value of the attribute.*/
|
||||
};
|
||||
#endif
|
@ -1,54 +0,0 @@
|
||||
#include "XMLComponent.hh"
|
||||
|
||||
void XMLComponent::Initialize( xmlNode *Base_node) {
|
||||
|
||||
if ( (Base_node == NULL) ||
|
||||
(Base_node->type != XML_ELEMENT_NODE )) {
|
||||
std::cerr << "XMLComponent::Initialize: Bad parameters." << std::endl;
|
||||
} else {
|
||||
xmlAttr *current_attr = NULL;
|
||||
|
||||
/* Get Attributes from the XML parse tree. */
|
||||
for (current_attr = Base_node->properties; current_attr ; current_attr = current_attr->next ) {
|
||||
if (current_attr->type == XML_ATTRIBUTE_NODE ) {
|
||||
// Add the attribute to the list.
|
||||
std::string key( (const char *)current_attr->name);
|
||||
std::string value( (const char *)current_attr->children->content);
|
||||
attribute_list.push_back( new XMLAttribute(key, value) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XML CONSTRUCTOR
|
||||
XMLComponent::XMLComponent(xmlNode *Base_node) {
|
||||
|
||||
Initialize( Base_node);
|
||||
}
|
||||
|
||||
// DESTRUCTOR
|
||||
XMLComponent::~XMLComponent() {
|
||||
// destroy each of the attributes in the attribute list
|
||||
unsigned int i;
|
||||
std::vector<XMLAttribute *>::size_type attr_count = this->attribute_list.size();
|
||||
for (i = 0; i<attr_count ; i++) {
|
||||
delete this->attribute_list[i];
|
||||
}
|
||||
}
|
||||
|
||||
// MEMBER FUNCTION
|
||||
unsigned int XMLComponent::NumberOfAttributes() {
|
||||
return (unsigned int)attribute_list.size();
|
||||
}
|
||||
|
||||
// MEMBER FUNCTION
|
||||
const char *XMLComponent::AttributeValue( const char *name ) {
|
||||
unsigned int i;
|
||||
std::vector<XMLAttribute *>::size_type attr_count = this->attribute_list.size();
|
||||
for (i=0 ; i<attr_count ; i++) {
|
||||
if ( attribute_list[i]->key_is(name) ) {
|
||||
return ( attribute_list[i]->value_of().c_str());
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#ifndef XMLCOMPONENT_HH
|
||||
#define XMLCOMPONENT_HH
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <vector>
|
||||
#include "XMLAttribute.hh"
|
||||
|
||||
class XMLComponent {
|
||||
|
||||
public:
|
||||
|
||||
XMLComponent() {}
|
||||
/**
|
||||
* XML constructor.
|
||||
*/
|
||||
XMLComponent(xmlNode *element_node);
|
||||
|
||||
/**
|
||||
* XMLComponent Destructor.
|
||||
*/
|
||||
~XMLComponent();
|
||||
|
||||
/**
|
||||
* Return the number of attributes contained within this XMLComponent.
|
||||
*/
|
||||
unsigned int NumberOfAttributes();
|
||||
|
||||
/**
|
||||
* Return a pointer to a copy of the Attribute value by name.
|
||||
* @param key this is the key to be matched.
|
||||
*/
|
||||
const char *AttributeValue(const char *key);
|
||||
|
||||
protected:
|
||||
std::vector <XMLAttribute *> attribute_list; /**< This is the list of attributes
|
||||
associated with an XMLComponent. */
|
||||
|
||||
private:
|
||||
void Initialize( xmlNode *base_node);
|
||||
};
|
||||
#endif
|
@ -1,39 +0,0 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
SHELL = /bin/sh
|
||||
RM = rm -rf
|
||||
CC = gcc
|
||||
CPP = g++
|
||||
|
||||
INCDIRS = -I/usr/include/libxml2
|
||||
|
||||
CFLAGS = -g \
|
||||
-Wall \
|
||||
-Wshadow \
|
||||
-Wconversion \
|
||||
-Wextra \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-missing-braces \
|
||||
-Wno-unused-variable
|
||||
|
||||
OBJDIR = obj
|
||||
OBJS = XMLAttribute.o \
|
||||
XMLComponent.o \
|
||||
Requirement.o \
|
||||
TagRequirements.o
|
||||
|
||||
.cpp.o:
|
||||
${CPP} ${CFLAGS} ${INCDIRS} -c $<
|
||||
|
||||
all: TagRequirements
|
||||
|
||||
TagRequirements: ${OBJS}
|
||||
${CPP} ${CFLAGS} -o $@ ${OBJS} -lxml2
|
||||
|
||||
clean:
|
||||
${RM} *.o
|
||||
${RM} *~
|
||||
${RM} TagRequirements
|
||||
|
||||
spotless: clean
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output method="xml" version="1.0" indent="yes" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates match="requirement"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="requirement">
|
||||
<xsl:copy>
|
||||
<xsl:attribute name="numbr">
|
||||
<xsl:number/>
|
||||
</xsl:attribute>
|
||||
<xsl:apply-templates select="@*|node()" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output method="xml" version="1.0" indent="yes" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<testresults>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:for-each select="test_list/file">
|
||||
<xsl:apply-templates select="document(@name)/testsuites/testsuite"/>
|
||||
</xsl:for-each>
|
||||
</testresults>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="testsuite">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,183 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output method="html"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html style="font-family:arial;">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
h3 {
|
||||
line-height:110%;
|
||||
margin-bottom:1}
|
||||
p {
|
||||
line-height:110%;
|
||||
margin:10;
|
||||
margin-bottom:0}
|
||||
p.unitTest {
|
||||
line-height:110%;
|
||||
margin:2;
|
||||
font-family:courier;
|
||||
font-size:14px"}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Trick Software Requirements Specification</h1>
|
||||
<h2 style="display:inline">Automation, Robotics and Simulation Division</h2>
|
||||
<h3 style="text-align:right;margin:2">Trick 13  </h3>
|
||||
<p style="text-align:right;font-size:12px"><b>Last updated: </b>
|
||||
<xsl:apply-templates select="document('../build_date.xml')/build_date"/></p>
|
||||
<hr/>
|
||||
<p style="font-family:courier">Total Tests:
|
||||
<b><xsl:value-of
|
||||
select="count(document('../src_xml/AllTests.xml')/testresults/testsuite/testcase)"/></b>
|
||||
        Failures:
|
||||
<b><xsl:value-of
|
||||
select="count(document('../src_xml/AllTests.xml')/testresults/testsuite/testcase/failure)"/></b>
|
||||
</p>
|
||||
<br/>
|
||||
|
||||
<xsl:apply-templates select="document('../src_xml/headerReqs.xml')/introDocs/intro"/>
|
||||
<br/><br/><br/>
|
||||
<xsl:apply-templates select="requirement"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="build_date">
|
||||
<xsl:value-of select="@date"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="intro">
|
||||
<h3 style="margin-left:{(count(ancestor::*)-1)*.4}in">
|
||||
<b><xsl:value-of select="@num"/></b>
|
||||
<xsl:text>    </xsl:text>
|
||||
<xsl:value-of select="@title"/></h3>
|
||||
<xsl:if test="@statement">
|
||||
<p style="margin-left:{(count(ancestor::*)-1)*.4}in;">
|
||||
<xsl:value-of select="@statement"/></p>
|
||||
</xsl:if>
|
||||
<xsl:if test="@note">
|
||||
<p style="margin-left:{(count(ancestor::*)-1)*.4}in;">
|
||||
<xsl:value-of select="@note"/></p>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:apply-templates select="intro"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="requirement">
|
||||
<xsl:param name="tag" select="@tag"/>
|
||||
|
||||
<xsl:variable name="fred" select="count(ancestor::*)"/>
|
||||
<xsl:variable name="tab" select="$fred * 30"/>
|
||||
|
||||
<xsl:variable name="apple"
|
||||
select="concat(../../../../../../../@numbr, '.' ,../../../../../../@numbr,
|
||||
'.', ../../../../../@numbr, '.', ../../../../@numbr, '.',
|
||||
../../../@numbr, '.', ../../@numbr, '.', ../@numbr,
|
||||
'.', @numbr)"/>
|
||||
|
||||
<xsl:variable name="numbering" select="concat(3,substring-after($apple,'1'))"/>
|
||||
<xsl:variable name="txt_ind" select="string-length($numbering)*10"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(@statement,'[HEADER]')">
|
||||
<h3 style="margin-left:{$tab}px">
|
||||
<span style="font-weight:bold;">
|
||||
<xsl:value-of select="$numbering"/></span>
|
||||
<xsl:text>    </xsl:text>
|
||||
<xsl:value-of select="normalize-space(substring-after(@statement,'[HEADER]'))"/>
|
||||
</h3>
|
||||
<xsl:if test="@note">
|
||||
<p style="margin-left:{$tab}px">
|
||||
<xsl:value-of select="@note"/></p>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<p style="margin-left:{$tab+$txt_ind}px; text-indent:-{$txt_ind}px;">
|
||||
|
||||
<b><xsl:value-of select="$numbering"/></b>
|
||||
<xsl:text>      </xsl:text>
|
||||
<xsl:value-of select="@statement"/>
|
||||
<span style="font-size:10pt;">
|
||||
<font color="gray">
|
||||
<xsl:text>   [</xsl:text>
|
||||
<xsl:value-of select="$tag"/>]<br/></font></span>
|
||||
<xsl:if test="@note">
|
||||
<i><b>NOTE: </b><xsl:value-of select="@note"/></i>
|
||||
</xsl:if>
|
||||
</p>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="@verify">
|
||||
<p class="unitTest"
|
||||
style="margin-left:{($fred)*30+$txt_ind}px;">
|
||||
<font color="blue"><b>[VERIFIED] </b></font>
|
||||
<xsl:value-of select="@verify"/>
|
||||
</p>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:for-each select="document('../src_xml/AllTests.xml')/testresults/testsuite">
|
||||
<xsl:for-each select="testcase">
|
||||
<xsl:if test="@parent">
|
||||
<p class="unitTest"
|
||||
style="margin-left:{($fred)*30+$txt_ind}px;">
|
||||
|
||||
<xsl:call-template name="splitString">
|
||||
<xsl:with-param name="tag1" select="$tag"/>
|
||||
<xsl:with-param name="parNums" select="translate(@parent,',',' ')"/>
|
||||
</xsl:call-template>
|
||||
</p>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:apply-templates select="requirement"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="splitString">
|
||||
<xsl:param name="tag1"/>
|
||||
<xsl:param name="parNums" select="."/>
|
||||
|
||||
<xsl:if test="string-length($parNums)">
|
||||
<xsl:variable name="split"
|
||||
select="normalize-space(substring-before(concat($parNums,' '),' '))"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$tag1 = $split">
|
||||
<xsl:call-template name="printResults"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="splitString">
|
||||
<xsl:with-param name="tag1" select="$tag1"/>
|
||||
<xsl:with-param name="parNums" select="substring-after($parNums,' ')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="printResults">
|
||||
<xsl:param name="counter"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="failure">
|
||||
<font color="red"><b>[ FAILED ] </b></font>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<font color="green"><b>[ PASSED ] </b></font>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@classname"/>
|
||||
<xsl:text>: </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,43 +0,0 @@
|
||||
<test_list>
|
||||
<file name="../../Bitfield_tests.xml"/>
|
||||
<file name="../../Executive.xml"/>
|
||||
<file name="../../DataProducts_C.xml"/>
|
||||
<file name="../../DataProducts_M.xml"/>
|
||||
<file name="../../DataStream.xml"/>
|
||||
<file name="../../Integrator.xml"/>
|
||||
<file name="../../Interpolator.xml"/>
|
||||
<file name="../../MM_alloc_deps.xml"/>
|
||||
<file name="../../MM_clear_var.xml"/>
|
||||
<file name="../../MM_creation.xml"/>
|
||||
<file name="../../MM_declare_extern_var.xml"/>
|
||||
<file name="../../MM_declare_var.xml"/>
|
||||
<file name="../../MM_declare_var_2.xml"/>
|
||||
<file name="../../MM_read_checkpoint_from_string.xml"/>
|
||||
<file name="../../MM_ref_attributes.xml"/>
|
||||
<file name="../../MM_resize_array.xml"/>
|
||||
<file name="../../MM_sizeof_type.xml"/>
|
||||
<file name="../../MM_write_checkpoint_hexfloat.xml"/>
|
||||
<file name="../../MM_write_checkpoint.xml"/>
|
||||
<file name="../../MM_write_var.xml"/>
|
||||
<file name="../../MonteCarlo.xml"/>
|
||||
<file name="../../MonteCarlo_exceptions.xml"/>
|
||||
<file name="../../ScheduledJobQueue.xml"/>
|
||||
<file name="../../SIM_ball_L1.xml"/>
|
||||
<file name="../../SIM_Ball++_L1.xml"/>
|
||||
<file name="../../SIM_ball_L2.xml"/>
|
||||
<file name="../../SIM_ball_L3.xml"/>
|
||||
<file name="../../SIM_demo_sdefine.xml"/>
|
||||
<file name="../../SIM_sun.xml"/>
|
||||
<file name="../../SIM_test_dp.xml"/>
|
||||
<file name="../../SIM_test_ip_rti.xml"/>
|
||||
<file name="../../SIM_test_ip.xml"/>
|
||||
<file name="../../SIM_test_sched.xml"/>
|
||||
<file name="../../SIM_test_varserv.xml"/>
|
||||
<file name="../../SIM_threads.xml"/>
|
||||
<file name="../../SIM_target_master.xml"/>
|
||||
<file name="../../SIM_monte.xml"/>
|
||||
<file name="../../SIM_amoeba.xml"/>
|
||||
<file name="../../TrickComm.xml"/>
|
||||
<file name="../../UnitConvTestSuite.xml"/>
|
||||
<file name="../../UnitTestSuite.xml"/>
|
||||
</test_list>
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<introDocs>
|
||||
<intro
|
||||
num="1"
|
||||
title="Introduction">
|
||||
<intro
|
||||
num="1.1"
|
||||
title="Purpose"
|
||||
statement="This document establishes the Software Requirements Specification
|
||||
for the Trick Software."/>
|
||||
<intro
|
||||
num="1.2"
|
||||
title="Scope"
|
||||
statement="This specification defines the functional, performance, and interface
|
||||
intros for the Trick Software."/>
|
||||
<intro
|
||||
num="1.3"
|
||||
title="Office of Primary Responsibility"
|
||||
statement="The Software Requirements Specification (SRS) is the responsibility
|
||||
of the National Aeronautics and Space Administration (NASA) Johnson Space
|
||||
Center (JSC) Engineering Directorate Automation, Robotics and Simulations
|
||||
Division (ER)."/>
|
||||
<intro
|
||||
num="1.4"
|
||||
title="Change Authority"
|
||||
statement="All changes to this document will be processed in accordance with
|
||||
somebody important."/>
|
||||
</intro>
|
||||
<intro
|
||||
num="2"
|
||||
title="Applicable and Reference Documents">
|
||||
<intro
|
||||
num="2.1"
|
||||
title="Applicable Documents"
|
||||
statement="The following documents are reference documents utilized in the
|
||||
development of this SRS. These documents do not form a part of this SRS
|
||||
and are not controlled by their reference herein."/>
|
||||
<intro
|
||||
num="2.2"
|
||||
title="Reference Documents"
|
||||
statement="The following documents are reference documents utilized in
|
||||
the development of this SRS. These documents do not form a part of this
|
||||
SRS and are not controlled by their reference herein."/>
|
||||
<intro
|
||||
num="2.3"
|
||||
title="Order of Precedence"
|
||||
statement="In the event of a conflict between the text of this specification and an
|
||||
applicable document cited herein, the text of this specification takes precedence."
|
||||
note="All specifications, standards, exhibits, drawings or other documents that
|
||||
are invoked as "applicable" in this specification are incorporated as cited.
|
||||
All documents that are referred to by an applicable document are considered to be for
|
||||
guidance and information only, with the exception of Interface Control Documents
|
||||
(ICD) which will have their applicable documents considered to be incorporated as
|
||||
cited."/>
|
||||
</intro>
|
||||
</introDocs>
|
||||
|
@ -1,49 +0,0 @@
|
||||
#ifndef JD_H
|
||||
#define JD_H
|
||||
/**
|
||||
@file JD.h
|
||||
@brief the amalgomated, gonkulated JD.h file
|
||||
|
||||
Here is a detailed description. Here is a detailed description.
|
||||
Here is a detailed description. Here is a detailed description.
|
||||
Here is a detailed description. Here is a detailed description.
|
||||
Here is a detailed description. Here is a detailed description.
|
||||
Here is a detailed description.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* Returns 1 if the specified date is a Gregorian date.
|
||||
* @param Y (IN) Year
|
||||
* @param M (IN) Month
|
||||
* @param D (IN) Day
|
||||
*/
|
||||
int is_gregorian_date (int Y, int M, double D);
|
||||
/**
|
||||
* Returns 1 if the specified date is a Julian date.
|
||||
* @param Y (IN) Year
|
||||
* @param M (IN) Month
|
||||
* @param D (IN) Day
|
||||
*/
|
||||
int is_julian_date (int Y, int M, double D);
|
||||
/**
|
||||
* Calculates the Julian date from the given calendar date.
|
||||
* @param Y (IN) Year
|
||||
* @param M (IN) Month
|
||||
* @param D (IN) Day
|
||||
* @param JD (OUT) Julian date
|
||||
*/
|
||||
int Calendar_Date_to_JD (int Y, int M, float D, double * JD);
|
||||
void JD_to_Calendar_Date (double JD, int *year, int *month, float *day) ;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
#ifndef LH_COORDS_H
|
||||
#define LH_COORDS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void equatorial_to_local_horiz(double lat, /* Observer's latitude IN */
|
||||
double HA, /* hour_angle IN */
|
||||
double ra, /* Right Ascension (degrees) IN */
|
||||
double decl, /* Declination (degrees) IN */
|
||||
double *az, /* Azimuth (degrees) OUT */
|
||||
double *el) ; /* Elevation (degrees) OUT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
#ifndef SIDEREAL_H
|
||||
#define SIDEREAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void GST_secs_time( double JD, double *GST );
|
||||
void LST_secs_time( double GST, double longitude, double *LST );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,20 +0,0 @@
|
||||
#ifndef SUN_POS_H
|
||||
#define SUN_POS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Calculate the Sun's position at the given Julian day number.
|
||||
* @param JD The Julian day number.
|
||||
* @param sun_right_ascension.
|
||||
* @param sun_declination.
|
||||
*/
|
||||
int sun_pos_at_JD (double JD, double *sun_right_ascension, double *sun_declination );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,15 +0,0 @@
|
||||
SUN_PRED.observer_latitude = 29.55298;
|
||||
SUN_PRED.observer_longitude = 95.09379;
|
||||
SUN_PRED.observer_offset_from_UTC = -6;
|
||||
|
||||
SUN_PRED.local_time.year = 2006;
|
||||
SUN_PRED.local_time.month = 8;
|
||||
SUN_PRED.local_time.day = 8;
|
||||
SUN_PRED.local_time.hour = 12;
|
||||
SUN_PRED.local_time.min = 0;
|
||||
SUN_PRED.local_time.sec = 0.0;
|
||||
|
||||
SUN_PRED.label_UTC = "UTC";
|
||||
SUN_PRED.label_JD = "JD";
|
||||
SUN_PRED.label_Azimuth = "A";
|
||||
SUN_PRED.label_Elevation = "h";
|
@ -1,51 +0,0 @@
|
||||
/*************************************************************************
|
||||
PURPOSE: (SUN sim)
|
||||
**************************************************************************/
|
||||
#ifndef SUN_PRED_H
|
||||
#define SUN_PRED_H
|
||||
#include <wchar.h>
|
||||
|
||||
typedef struct {
|
||||
int year; /* (-- ) Year (-4712 .. INT_MAX) */
|
||||
int month; /* (-- ) Month (Jan=1, ... Dec=12) */
|
||||
int day; /* (day) Day of the month (1..31) */
|
||||
int hour; /* (hr ) Hour of the day (0..23) */
|
||||
int min; /* (min) Minute of the hour (0..59) */
|
||||
double sec; /* (s ) Second of the minute (0..59) */
|
||||
} CALENDAR_DATE;
|
||||
|
||||
typedef struct {
|
||||
double observer_latitude; /* (d) */
|
||||
double observer_longitude; /* (d) */
|
||||
CALENDAR_DATE local_time; /* (--) */
|
||||
double local_sidereal_time; /* (s) */
|
||||
double sidereal_time_at_Greenwich; /* (s) */
|
||||
int observer_offset_from_UTC; /* (hr) */
|
||||
CALENDAR_DATE utc; /* (--) */
|
||||
double JD_start; /* (day) Julian date at the beginning of the sim run.*/
|
||||
double JD; /* (day) Current Julian date */
|
||||
double right_ascension; /* (d) */
|
||||
double declination; /* (d) */
|
||||
double hour_angle; /* (d) */
|
||||
double solar_azimuth; /* (d) */
|
||||
double solar_elevation; /* (d) */
|
||||
wchar_t* label_UTC; /* (--) wide character pointer */
|
||||
wchar_t* label_JD; /* (--) wide character pointer */
|
||||
wchar_t* label_Azimuth; /* (--) wide character pointer */
|
||||
wchar_t* label_Elevation; /* (--) wide character pointer */
|
||||
} SUN_PRED;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int sun_pred_cyclic( SUN_PRED* S, double current_sim_time ) ;
|
||||
int sun_pred_init( SUN_PRED* S ) ;
|
||||
int sun_pred_shutdown( void ) ;
|
||||
int sun_pred_slow_display( SUN_PRED* S ) ;
|
||||
int sun_pred_fast_display( SUN_PRED* S ) ;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -1,94 +0,0 @@
|
||||
/*******************************************************************
|
||||
* @\file JD.c
|
||||
* @\brief This is the JD.c file
|
||||
* Reference(s):
|
||||
* (1) Meeus,Jean."Astronomical Algorithms",
|
||||
* 2nd Edition, Willmann-Bell, Inc.
|
||||
* Chapter 7.
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "JD.h"
|
||||
|
||||
int is_gregorian_date (int Y, int M, double D) {
|
||||
return ((Y>1582)||((Y==1582)&&(M>10))||((Y==1582)&&(M==10)&&(D>=15.0)));
|
||||
}
|
||||
|
||||
int is_julian_date (int Y, int M, double D) {
|
||||
return ((Y<1582)||((Y==1582)&&(M<10))||((Y==1582)&&(M==10)&&(D<5.0)));
|
||||
}
|
||||
|
||||
/* The algorithm for this function is described on page 60 of ref(1). */
|
||||
int Calendar_Date_to_JD (int Y, int M, float D, double * JD) {
|
||||
|
||||
int A, B;
|
||||
/* Is the day valid? */
|
||||
if ((D < 1.0) || (M >= 32.0)) return -1;
|
||||
|
||||
/* Is the month valid? */
|
||||
if ((M < 1) || (M > 12)) return -1;
|
||||
|
||||
/* Is the year valid? */
|
||||
if ((Y < -4712) || ((Y == -4712) && (D < 1.5))) return -1;
|
||||
|
||||
if (M <= 2) {
|
||||
Y = Y - 1;
|
||||
M = M + 12;
|
||||
}
|
||||
|
||||
A = (int)(Y / 100.0);
|
||||
|
||||
if (is_gregorian_date(Y,M,D)) {
|
||||
B = 2 - A + (int)(A/4.0);
|
||||
} else if (is_julian_date (Y,M,D)) {
|
||||
B = 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*JD = (int)(365.25 * (Y + 4716)) + (int)(30.6001 * (M+1)) + D + B - 1524.5;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The algorithm for this function is described on page 63 of ref(1). */
|
||||
void JD_to_Calendar_Date (double JD, int *Year, int *Month, float *Day) {
|
||||
|
||||
int Z,A,B,C,D,E;
|
||||
int alpha, year, month;
|
||||
float day;
|
||||
float F;
|
||||
|
||||
Z = (int)(JD + 0.5);
|
||||
F = (JD + 0.5) - Z;
|
||||
if ( Z < 2299161 ) {
|
||||
A = Z;
|
||||
} else {
|
||||
alpha = (int)( (Z - 1867216.25) / 36524.25 );
|
||||
A = Z + 1 + alpha - (int)(alpha/4);
|
||||
}
|
||||
B = A + 1524;
|
||||
C = (int)((B-122.1)/365.25);
|
||||
D = (int)(365.25 * C);
|
||||
E = (int)((B-D)/30.6001);
|
||||
|
||||
day = B - D - (int)(30.6001 * E) + F;
|
||||
|
||||
if ( E < 14) {
|
||||
month = E - 1;
|
||||
} else {
|
||||
month = E - 13;
|
||||
}
|
||||
|
||||
if ( month > 2 ) {
|
||||
year = C -4716;
|
||||
} else {
|
||||
year = C -4715;
|
||||
}
|
||||
|
||||
*Day = day;
|
||||
*Month = month;
|
||||
*Year = year;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*******************************************************************
|
||||
* Reference(s):
|
||||
* (1) Meeus,Jean."Astronomical Algorithms",
|
||||
* 2nd Edition, Willmann-Bell, Inc.
|
||||
* Chapter 13.
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "lh_coords.h"
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159264
|
||||
#endif
|
||||
#define DEG_TO_RAD (PI/180.0)
|
||||
#define RAD_TO_DEG (180.0/PI)
|
||||
|
||||
void equatorial_to_local_horiz(double lat, /* Observer's latitude IN */
|
||||
double HA, /* hour_angle IN */
|
||||
double ra, /* Right Ascension (degrees) IN */
|
||||
double decl, /* Declination (degrees) IN */
|
||||
double *az, /* Azimuth (degrees) OUT */
|
||||
double *el) { /* Elevation (degrees) OUT */
|
||||
|
||||
double HA_r = HA * DEG_TO_RAD;
|
||||
double lat_r = lat * DEG_TO_RAD;
|
||||
double decl_r = decl * DEG_TO_RAD;
|
||||
|
||||
/* Ref(1), (13.5) */
|
||||
*az = RAD_TO_DEG * atan2 ( sin(HA_r) , ( cos(HA_r) * sin(lat_r) - tan (decl_r) * cos(lat_r) ) );
|
||||
/* Ref(1), (13.6) */
|
||||
*el = RAD_TO_DEG * asin ( sin(lat_r) * sin(decl_r) + cos(lat_r)*cos(decl_r)*cos(HA_r) );
|
||||
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
/*******************************************************************
|
||||
* Reference(s):
|
||||
* (1) Meeus,Jean."Astronomical Algorithms",
|
||||
* 2nd Edition, Willmann-Bell, Inc.
|
||||
* Chapter 12.
|
||||
*******************************************************************
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "JD.h"
|
||||
#include "sidereal.h"
|
||||
|
||||
#define SECONDS_PER_DAY 86400
|
||||
|
||||
/* Calculate sidereal time at Greenwich. */
|
||||
void GST_secs_time( double JD, double *GST ) {
|
||||
|
||||
double T;
|
||||
double cap_theta_0;
|
||||
double theta_0;
|
||||
double JD_0;
|
||||
double UT;
|
||||
|
||||
/* In the calculation for mean sidereal time (below)
|
||||
* T must correspond to 0h UT of the date. So, we
|
||||
* calculate JD_0 that corresponds to 0h.
|
||||
*/
|
||||
if ( (JD-(int)JD) < 0.5) {
|
||||
JD_0 = (int)JD - 0.5;
|
||||
} else {
|
||||
JD_0 = (int)JD + 0.5;
|
||||
}
|
||||
|
||||
UT = (JD - JD_0) * SECONDS_PER_DAY;
|
||||
|
||||
/* Ref(1), equation (12.1). */
|
||||
/* Note that 2451545.0 is the J2000 epoch. */
|
||||
T = (JD_0 - 2451545.0) / 36525.0;
|
||||
|
||||
/* Ref(1), equation (12.2) */
|
||||
/* Mean sidereal time (in seconds) at Greenwich at 0-h UT. */
|
||||
cap_theta_0 = 24110.54842 +
|
||||
(8640184.812866 * T) +
|
||||
(0.093104 * T * T) -
|
||||
(0.0000062 * T * T * T);
|
||||
|
||||
/* We want it in the range 0..86400. */
|
||||
/* Note that there are 84600 seconds in a day. */
|
||||
if (cap_theta_0 >= 0.0) {
|
||||
cap_theta_0 = fmod(cap_theta_0, 86400.0);
|
||||
} else {
|
||||
cap_theta_0 = fmod(cap_theta_0, 86400.0) + 86400.0;
|
||||
}
|
||||
|
||||
/* Ref(1), page 87 */
|
||||
theta_0 = UT * 1.00273790935 + cap_theta_0;
|
||||
|
||||
if (theta_0 >= 0.0) {
|
||||
theta_0 = fmod(theta_0, 86400.0);
|
||||
} else {
|
||||
theta_0 = fmod(theta_0, 86400.0) + 86400.0;
|
||||
}
|
||||
|
||||
*GST = theta_0;
|
||||
|
||||
}
|
||||
|
||||
void LST_secs_time( double GST, double longitude, double *LST) {
|
||||
|
||||
*LST = GST - (longitude * (3600.0/15.0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
/*******************************************************************
|
||||
* Reference(s):
|
||||
* (1) Meeus,Jean."Astronomical Algorithms",
|
||||
* 2nd Edition, Willmann-Bell, Inc.
|
||||
* Chapter 25.
|
||||
*******************************************************************
|
||||
*/
|
||||
#include <math.h>
|
||||
#include "sun_pos.h"
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159264
|
||||
#endif
|
||||
#define DEG_TO_RAD (PI/180.0)
|
||||
#define RAD_TO_DEG (180.0/PI)
|
||||
|
||||
static double norm_mod(double x, double y) {
|
||||
if (x >= 0.0) {
|
||||
x = fmod(x, y);
|
||||
} else {
|
||||
x = fmod(x, y) + y;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the position of the Sun (right ascension and declination )
|
||||
* @param JD Julian Date
|
||||
* @param sun_right_ascension Right ascension of the Sun
|
||||
* @param sun_declination Declination of the Sun
|
||||
*/
|
||||
int sun_pos_at_JD (double JD,
|
||||
double *sun_right_ascension,
|
||||
double *sun_declination ) {
|
||||
|
||||
/* We are ignoring nutation in this calculation. */
|
||||
|
||||
double T;
|
||||
double L_0;
|
||||
double M;
|
||||
double M_rad;
|
||||
double C;
|
||||
double Suns_true_longitude;
|
||||
double epsilon;
|
||||
double tmp_d;
|
||||
double right_ascension;
|
||||
double declination;
|
||||
|
||||
/* Ref(1), (25.1) */
|
||||
T = (JD - 2451545.0) / 36525.0;
|
||||
|
||||
/* Geometric mean longitude of the Sun. Ref(1), (25.2) */
|
||||
L_0 = 280.46646 + T * (36000.76983 + T * 0.0003032 ) ;
|
||||
L_0 = norm_mod(L_0, 360.0);
|
||||
|
||||
/* Mean anomaly of the Sun. Ref(1), (25.3) */
|
||||
M = 357.52911 + T * (35999.05029 + T * 0.0001537 ) ;
|
||||
M = norm_mod(M, 360.0);
|
||||
|
||||
M_rad = M * DEG_TO_RAD;
|
||||
|
||||
C = ( 1.914602 - T * ( 0.004817 - T * 0.000014 ) ) * sin( M_rad )
|
||||
+ ( 0.019993 - T * 0.000101 ) * sin (2 * M_rad)
|
||||
+ 0.000289 * sin (3 * M_rad) ;
|
||||
|
||||
Suns_true_longitude = L_0 + C;
|
||||
|
||||
epsilon = 23.4392911; /* Ref(1), page 92 */
|
||||
|
||||
tmp_d = cos( epsilon * DEG_TO_RAD ) * sin(Suns_true_longitude * DEG_TO_RAD) ;
|
||||
right_ascension = RAD_TO_DEG * atan2( tmp_d, cos(Suns_true_longitude * DEG_TO_RAD) );
|
||||
right_ascension = norm_mod(right_ascension, 360.0);
|
||||
|
||||
tmp_d = sin( epsilon * DEG_TO_RAD ) * sin (Suns_true_longitude * DEG_TO_RAD);
|
||||
declination = RAD_TO_DEG * asin (tmp_d);
|
||||
|
||||
*sun_right_ascension = right_ascension;
|
||||
*sun_declination = declination;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
(Predict the path of the SUN across the sky.)
|
||||
LIBRARY DEPENDENCY:
|
||||
((sun_pos.o)(lh_coords.o)(sidereal.o)
|
||||
PROGRAMMERS:
|
||||
(((John M. Penn) (L-3 Titan) (Oct 8, 2006) (Trick Demo) ))
|
||||
*******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "JD.h"
|
||||
#include "sun_pred.h"
|
||||
#include "sun_pos.h"
|
||||
#include "lh_coords.h"
|
||||
#include "sidereal.h"
|
||||
|
||||
#define HOURS_PER_DAY 24.0
|
||||
#define MINUTES_PER_DAY 1440.0
|
||||
#define SECONDS_PER_DAY 86400.0
|
||||
|
||||
int sun_pred_cyclic(
|
||||
SUN_PRED* S,
|
||||
double current_sim_time )
|
||||
{
|
||||
float dday;
|
||||
double JDL;
|
||||
double tsec;
|
||||
|
||||
/* Update the Julian date by one second. */
|
||||
S->JD = S->JD_start + ( current_sim_time / SECONDS_PER_DAY );
|
||||
|
||||
|
||||
/* Convert the new JD to UTC Calendar date. */
|
||||
JD_to_Calendar_Date (S->JD, &S->utc.year, &S->utc.month, &dday );
|
||||
|
||||
S->utc.day = (int)dday;
|
||||
tsec = (dday - S->utc.day ) * SECONDS_PER_DAY + 0.5;
|
||||
S->utc.hour = (int)( tsec / 3600.0 ); tsec = tsec - ( S->utc.hour * 3600.0 );
|
||||
S->utc.min = (int)( tsec / 60.0 ); tsec = tsec - ( S->utc.min * 60.0 );
|
||||
S->utc.sec = (int)( tsec );
|
||||
|
||||
|
||||
/* Convert the new JD to Local Calendar date. */
|
||||
JDL = S->JD + ( S->observer_offset_from_UTC / HOURS_PER_DAY ) ;
|
||||
|
||||
JD_to_Calendar_Date (JDL, &S->local_time.year, &S->local_time.month, &dday );
|
||||
|
||||
S->local_time.day = (int)dday;
|
||||
tsec = (dday - S->local_time.day ) * SECONDS_PER_DAY + 0.5;
|
||||
S->local_time.hour = (int)( tsec / 3600.0 ); tsec = tsec - ( S->local_time.hour * 3600.0 );
|
||||
S->local_time.min = (int)( tsec / 60.0 ); tsec = tsec - ( S->local_time.min * 60.0 );
|
||||
S->local_time.sec = (int)( tsec );
|
||||
|
||||
/* Calculate the sidereal time at Greenwich. */
|
||||
GST_secs_time( S->JD, &S->sidereal_time_at_Greenwich );
|
||||
|
||||
|
||||
/* Calculate the local sidereal time. */
|
||||
LST_secs_time( S->sidereal_time_at_Greenwich,
|
||||
S->observer_longitude, &S->local_sidereal_time );
|
||||
|
||||
|
||||
/* Calculate the right_ascension and declination of the Sun. */
|
||||
if ( sun_pos_at_JD (S->JD, &S->right_ascension, &S->declination) < 0 ){
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Calculate the local hour angle of the Sun. */
|
||||
S->hour_angle = S->sidereal_time_at_Greenwich * ( 360.0 / 86400.0 ) -
|
||||
S->observer_longitude - S->right_ascension;
|
||||
|
||||
|
||||
/* Calculate the local azimuth and elevation of the Sun. */
|
||||
equatorial_to_local_horiz(S->observer_latitude,
|
||||
S->hour_angle,
|
||||
S->right_ascension,
|
||||
S->declination,
|
||||
&S->solar_azimuth,
|
||||
&S->solar_elevation);
|
||||
|
||||
|
||||
/* The previous function reckons azimuth from south.
|
||||
* We want to reckon it from north.
|
||||
*/
|
||||
S->solar_azimuth += 180.0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
(Predict the path of the SUN across the sky.)
|
||||
LIBRARY DEPENDENCY:
|
||||
((JD.o))
|
||||
PROGRAMMERS:
|
||||
(((John M. Penn) (L-3 Titan) (Oct 8, 2006) (Trick Demo) ))
|
||||
*******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "sun_pred.h"
|
||||
|
||||
#define HOURS_PER_DAY 24.0
|
||||
#define MINUTES_PER_DAY 1440.0
|
||||
#define SECONDS_PER_DAY 86400.0
|
||||
|
||||
#define DEGREE_SIGN 0x00B0
|
||||
#define SUN 0x2609
|
||||
#define CLOCK 0x231A
|
||||
|
||||
#define GREEK_SMALL_LETTER_ALPHA 0x03B1
|
||||
#define GREEK_SMALL_LETTER_BETA 0x03B2
|
||||
#define GREEK_SMALL_LETTER_GAMMA 0x03B3
|
||||
#define GREEK_SMALL_LETTER_DELTA 0x03B4
|
||||
#define GREEK_SMALL_LETTER_EPSILON 0x03B5
|
||||
#define GREEK_SMALL_LETTER_ZETA 0x03B6
|
||||
#define GREEK_SMALL_LETTER_ETA 0x03B7
|
||||
#define GREEK_SMALL_LETTER_THETA 0x03B8
|
||||
#define GREEK_SMALL_LETTER_IOTA 0x03B9
|
||||
#define GREEK_SMALL_LETTER_KAPPA 0x03BA
|
||||
#define GREEK_SMALL_LETTER_LAMBDA 0x03BB
|
||||
#define GREEK_SMALL_LETTER_MU 0x03BC
|
||||
#define GREEK_SMALL_LETTER_NU 0x03BD
|
||||
#define GREEK_SMALL_LETTER_XI 0x03BE
|
||||
#define GREEK_SMALL_LETTER_OMICRON 0x03BF
|
||||
#define GREEK_SMALL_LETTER_PI 0x03C0
|
||||
#define GREEK_SMALL_LETTER_RHO 0x03C1
|
||||
#define GREEK_SMALL_LETTER_SIGMA 0x03C3
|
||||
#define GREEK_SMALL_LETTER_TAU 0x03C4
|
||||
#define GREEK_SMALL_LETTER_UPSILON 0x03C5
|
||||
#define GREEK_SMALL_LETTER_PHI 0x03C6
|
||||
#define GREEK_SMALL_LETTER_CHI 0x03C7
|
||||
#define GREEK_SMALL_LETTER_PSI 0x03C8
|
||||
#define GREEK_SMALL_LETTER_OMEGA 0x03C9
|
||||
|
||||
|
||||
/* Prototype */
|
||||
int send_hs(FILE * fp, char *format, ...);
|
||||
|
||||
int sun_pred_fast_display(
|
||||
SUN_PRED* S )
|
||||
{
|
||||
char tmp_s[20];
|
||||
char message[500];
|
||||
|
||||
message[0] = '\0';
|
||||
sprintf(tmp_s,"%ls %0d:%0d:%02.f",S->label_UTC, S->utc.hour , S->utc.min , S->utc.sec );
|
||||
strcat(message,tmp_s);
|
||||
// sprintf(tmp_s," %ls %.6f",S->label_JD, S->JD);
|
||||
// strcat(message,tmp_s);
|
||||
if ( S->label_Azimuth != NULL ) {
|
||||
sprintf(tmp_s," %ls %.3f%lc",S->label_Azimuth, S->solar_azimuth, DEGREE_SIGN);
|
||||
} else {
|
||||
sprintf(tmp_s," AZIMUTH %.3f%lc", S->solar_azimuth, DEGREE_SIGN);
|
||||
}
|
||||
strcat(message,tmp_s);
|
||||
sprintf(tmp_s," %ls %.3f%lc",S->label_Elevation, S->solar_elevation, DEGREE_SIGN);
|
||||
strcat(message,tmp_s);
|
||||
|
||||
send_hs(stdout,"%s",message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
(Predict the path of the SUN across the sky.)
|
||||
LIBRARY DEPENDENCY:
|
||||
((JD.o))
|
||||
PROGRAMMERS:
|
||||
(((John M. Penn) (L-3 Titan) (Oct 8, 2006) (Trick Demo) ))
|
||||
*******************************************************************************/
|
||||
#include "sun_pred.h"
|
||||
#include "JD.h"
|
||||
|
||||
#define HOURS_PER_DAY 24.0
|
||||
#define MINUTES_PER_DAY 1440.0
|
||||
#define SECONDS_PER_DAY 86400.0
|
||||
|
||||
int sun_pred_init(
|
||||
SUN_PRED* S )
|
||||
{
|
||||
float dday;
|
||||
double JDL;
|
||||
double tsec;
|
||||
|
||||
/* Convert the local time to JD */
|
||||
dday = S->local_time.day +
|
||||
( S->local_time.hour / HOURS_PER_DAY ) +
|
||||
( S->local_time.min / MINUTES_PER_DAY ) +
|
||||
( S->local_time.sec / SECONDS_PER_DAY ) ;
|
||||
|
||||
Calendar_Date_to_JD (S->local_time.year, S->local_time.month, dday, &JDL);
|
||||
|
||||
/* Subtract the local offset from UTC from the JD. */
|
||||
S->JD_start = JDL - ( S->observer_offset_from_UTC / HOURS_PER_DAY ) ;
|
||||
S->JD = S->JD_start;
|
||||
|
||||
/* Convert the new JD back to UTC Calendar date */
|
||||
JD_to_Calendar_Date (S->JD, &S->utc.year, &S->utc.month, &dday );
|
||||
|
||||
S->utc.day = (int)dday;
|
||||
tsec = (dday - S->utc.day ) * SECONDS_PER_DAY + 0.5;
|
||||
S->utc.hour = (int)( tsec / 3600.0 ); tsec = tsec - ( S->utc.hour * 3600.0 );
|
||||
S->utc.min = (int)( tsec / 60.0 ); tsec = tsec - ( S->utc.min * 60.0 );
|
||||
S->utc.sec = (int)( tsec );
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*****************************************************************************
|
||||
PURPOSE: (Shut the thingy down)
|
||||
*****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "sun_pred.h"
|
||||
|
||||
int sun_pred_shutdown(
|
||||
void )
|
||||
{
|
||||
printf("SIM Shutdown.\n");
|
||||
fflush(stdout);
|
||||
return 0 ;
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
(Predict the path of the SUN across the sky.)
|
||||
LIBRARY DEPENDENCY:
|
||||
((JD.o))
|
||||
PROGRAMMERS:
|
||||
(((John M. Penn) (L-3 Titan) (Oct 8, 2006) (Trick Demo) ))
|
||||
*******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "sun_pred.h"
|
||||
|
||||
#define HOURS_PER_DAY 24.0
|
||||
#define MINUTES_PER_DAY 1440.0
|
||||
#define SECONDS_PER_DAY 86400.0
|
||||
|
||||
#define DEGREE_SIGN 0x00B0
|
||||
#define SUN 0x2609
|
||||
#define POSITION_INDICATOR 0x2316
|
||||
#define CLOCK 0x231A
|
||||
|
||||
#define GREEK_SMALL_LETTER_ALPHA 0x03B1
|
||||
#define GREEK_SMALL_LETTER_BETA 0x03B2
|
||||
#define GREEK_SMALL_LETTER_GAMMA 0x03B3
|
||||
#define GREEK_SMALL_LETTER_DELTA 0x03B4
|
||||
#define GREEK_SMALL_LETTER_EPSILON 0x03B5
|
||||
#define GREEK_SMALL_LETTER_ZETA 0x03B6
|
||||
#define GREEK_SMALL_LETTER_ETA 0x03B7
|
||||
#define GREEK_SMALL_LETTER_THETA 0x03B8
|
||||
#define GREEK_SMALL_LETTER_IOTA 0x03B9
|
||||
#define GREEK_SMALL_LETTER_KAPPA 0x03BA
|
||||
#define GREEK_SMALL_LETTER_LAMBDA 0x03BB
|
||||
#define GREEK_SMALL_LETTER_MU 0x03BC
|
||||
#define GREEK_SMALL_LETTER_NU 0x03BD
|
||||
#define GREEK_SMALL_LETTER_XI 0x03BE
|
||||
#define GREEK_SMALL_LETTER_OMICRON 0x03BF
|
||||
#define GREEK_SMALL_LETTER_PI 0x03C0
|
||||
#define GREEK_SMALL_LETTER_RHO 0x03C1
|
||||
#define GREEK_SMALL_LETTER_SIGMA 0x03C3
|
||||
#define GREEK_SMALL_LETTER_TAU 0x03C4
|
||||
#define GREEK_SMALL_LETTER_UPSILON 0x03C5
|
||||
#define GREEK_SMALL_LETTER_PHI 0x03C6
|
||||
#define GREEK_SMALL_LETTER_CHI 0x03C7
|
||||
#define GREEK_SMALL_LETTER_PSI 0x03C8
|
||||
#define GREEK_SMALL_LETTER_OMEGA 0x03C9
|
||||
|
||||
|
||||
/* Prototype */
|
||||
int send_hs(FILE * fp, char *format, ...);
|
||||
|
||||
int sun_pred_slow_display(
|
||||
SUN_PRED* S )
|
||||
{
|
||||
char tmp_s[20];
|
||||
char message[500];
|
||||
|
||||
message[0] = '\0';
|
||||
sprintf(tmp_s,"%lc",POSITION_INDICATOR);
|
||||
strcat(message,tmp_s);
|
||||
sprintf(tmp_s," %lc %5.2f%lc",GREEK_SMALL_LETTER_PHI, S->observer_latitude, DEGREE_SIGN);
|
||||
strcat(message,tmp_s);
|
||||
sprintf(tmp_s," L %5.2f%lc", S->observer_longitude, DEGREE_SIGN);
|
||||
strcat(message,tmp_s);
|
||||
sprintf(tmp_s," %lc %5.2f%lc",GREEK_SMALL_LETTER_ALPHA, S->right_ascension, DEGREE_SIGN);
|
||||
strcat(message,tmp_s);
|
||||
sprintf(tmp_s," %lc %5.2f%lc",GREEK_SMALL_LETTER_DELTA, S->declination, DEGREE_SIGN);
|
||||
strcat(message,tmp_s);
|
||||
send_hs(stdout,"%s",message);
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
53463 4 ./src/dp.c
|
||||
9166 3 ./include/dp.h
|
@ -1,63 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Data products test )
|
||||
REFERENCES: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: dp.h,v $
|
||||
* Revision 7.2 2007-01-08 13:55:09-06 dstrauss
|
||||
* Bugs in parsing new units specs
|
||||
*
|
||||
* Revision 7.1 2006-06-22 14:14:18-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:52-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:23 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:22 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DATA_PRODUCTS_H_
|
||||
#define _DATA_PRODUCTS_H_
|
||||
|
||||
typedef struct {
|
||||
|
||||
short si[3] ; /* ohm -- */
|
||||
int i[3] ; /* M -- */
|
||||
long l[3] ; /* amp -- */
|
||||
float f[3] ; /* M/s2 -- */
|
||||
double d[3] ; /* kg*M/s2 -- */
|
||||
unsigned short us[3] ; /* N -- */
|
||||
unsigned int ui[3] ; /* dB -- */
|
||||
unsigned long ul[3] ; /* v -- */
|
||||
long long ll[3] ; /* K -- */
|
||||
|
||||
} STRUCT_1 ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
STRUCT_1 s1[2][3] ; /* -- */
|
||||
|
||||
} STRUCT_2 ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
STRUCT_2 s2[3][2] ; /* -- */
|
||||
|
||||
} STRUCT_3 ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
STRUCT_3 s3[2] ; /* -- */
|
||||
|
||||
} DP_TEST ;
|
||||
|
||||
|
||||
#endif
|
@ -1,62 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test data products )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( scheduled )
|
||||
LIBRARY DEPENDENCY: ( dp.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: dp.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:18-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:53-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:23 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:22 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/dp.h"
|
||||
|
||||
|
||||
/*
|
||||
* Loads 1,2,3 into the last dim on -all- vars in STRUCT_1
|
||||
*/
|
||||
int dp(
|
||||
/* RETURN: -- Always return zero */
|
||||
DP_TEST *DP ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
|
||||
|
||||
#define LOOP for ( i = 0 ; i < 3 ; i++ ) \
|
||||
for ( j = 0 ; j < 3 ; j++ ) \
|
||||
for ( k = 0 ; k < 2 ; k++ ) \
|
||||
for ( l = 0 ; l < 2 ; l++ ) \
|
||||
for ( m = 0 ; m < 3 ; m++ ) \
|
||||
for ( n = 0 ; n < 2 ; n++ )
|
||||
|
||||
int i,j,k,l,m,n ;
|
||||
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].si[i] = (short) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].i[i] = (int) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].l[i] = (long) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].f[i] = (float) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].d[i] = (double) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].us[i] = (unsigned short) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].ui[i] = (unsigned int) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].ul[i] = (unsigned long) (i+1) ;
|
||||
LOOP DP->s3[n].s2[m][l].s1[k][j].ll[i] = (long long) (i+1) ;
|
||||
|
||||
/* LOOP printf("\"dp.test.s3[%d].s2[%d][%d].s1[%d][%d].d[%d]\" ,\n",
|
||||
n,m,l,k,j,i); */
|
||||
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
64414 2 ./src/export_master.c
|
||||
64733 2 ./src/export_slave.c
|
||||
63364 2 ./src/import_master.c
|
||||
3730 3 ./src/import_slave.c
|
||||
18794 3 ./include/test.h
|
@ -1,56 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
(Trick test)
|
||||
REFERENCES:
|
||||
(((Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
|
||||
(Nov 2001)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((None))
|
||||
PROGRAMMERS:
|
||||
((Keith Vetter) (LinCom) (November 2001))
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: test.h,v $
|
||||
* Revision 7.1 2006-06-22 14:14:17-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:53-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:21 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 3.3 2002/10/07 15:16:24 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TEST_H_
|
||||
#define _TEST_H_
|
||||
|
||||
typedef struct { /* A ------------------------------------------------*/
|
||||
|
||||
double d ; /* -- A double */
|
||||
int i ; /* -- An int */
|
||||
int j ; /* -- An int */
|
||||
|
||||
} A ; /*--------------------------------------------------------------*/
|
||||
|
||||
typedef struct { /* B ------------------------------------------------*/
|
||||
|
||||
double d ; /* -- A double */
|
||||
int i ; /* -- An int */
|
||||
int j ; /* -- An int */
|
||||
|
||||
} B ; /*--------------------------------------------------------------*/
|
||||
|
||||
typedef struct { /* TEST ---------------------------------------------*/
|
||||
|
||||
A a ; /* -- A */
|
||||
B b ; /* -- B */
|
||||
|
||||
} TEST ; /*------------------------------------------------------------*/
|
||||
|
||||
#endif
|
@ -1,48 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
( Testing )
|
||||
REFERENCE:
|
||||
(((Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
|
||||
(March 1997)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((None))
|
||||
CLASS:
|
||||
(scheduled)
|
||||
LIBRARY DEPENDENCY:
|
||||
((export_master.o))
|
||||
PROGRAMMERS:
|
||||
((Keith Vetter) (LinCom) (November 2001))
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: export_master.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:15-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:53-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:20 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 3.2 2002/10/07 15:16:25 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
/* GLOBAL DATA STRUCTURE DECLARATIONS */
|
||||
#include "../include/test.h"
|
||||
|
||||
/* ENTRY POINT */
|
||||
void export_master(
|
||||
/* RETURN: -- NA */
|
||||
TEST *T ) /* INOUT: -- TEST */
|
||||
{
|
||||
|
||||
T->a.i++ ;
|
||||
T->a.d += 0.1 ;
|
||||
|
||||
T->b.i-- ;
|
||||
T->b.d -= 0.1 ;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
( Testing )
|
||||
REFERENCE:
|
||||
(((Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
|
||||
(March 1997)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((None))
|
||||
CLASS:
|
||||
(scheduled)
|
||||
LIBRARY DEPENDENCY:
|
||||
((export_slave.o))
|
||||
PROGRAMMERS:
|
||||
((Keith Vetter) (LinCom) (November 2001))
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: export_slave.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:16-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:54-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:20 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 3.2 2002/10/07 15:16:25 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
/* GLOBAL DATA STRUCTURE DECLARATIONS */
|
||||
#include <stdio.h>
|
||||
#include "../include/test.h"
|
||||
|
||||
/* ENTRY POINT */
|
||||
void export_slave(
|
||||
/* RETURN: -- NA */
|
||||
TEST *T ) /* INOUT: -- TEST */
|
||||
{
|
||||
|
||||
/* Do nothing */
|
||||
T->a.i = T->a.i ;
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
( Testing )
|
||||
REFERENCE:
|
||||
(((Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
|
||||
(March 1997)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((None))
|
||||
CLASS:
|
||||
(scheduled)
|
||||
LIBRARY DEPENDENCY:
|
||||
((import_master.o))
|
||||
PROGRAMMERS:
|
||||
((Keith Vetter) (LinCom) (November 2001))
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: import_master.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:16-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:54-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:20 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 3.2 2002/10/07 15:16:26 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
/* GLOBAL DATA STRUCTURE DECLARATIONS */
|
||||
#include "../include/test.h"
|
||||
|
||||
/* ENTRY POINT */
|
||||
void import_master(
|
||||
/* RETURN: -- NA */
|
||||
TEST *T ) /* INOUT: -- TEST */
|
||||
{
|
||||
/* Do nothing */
|
||||
T->a.i = T->a.i ;
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
( Testing )
|
||||
REFERENCE:
|
||||
(((Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
|
||||
(March 1997)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((None))
|
||||
CLASS:
|
||||
(scheduled)
|
||||
LIBRARY DEPENDENCY:
|
||||
((import_slave.o))
|
||||
PROGRAMMERS:
|
||||
((Keith Vetter) (LinCom) (November 2001))
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: import_slave.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:17-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:54-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:21 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 3.2 2002/10/07 15:16:26 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
/* GLOBAL DATA STRUCTURE DECLARATIONS */
|
||||
#include <stdio.h>
|
||||
#include "../include/test.h"
|
||||
|
||||
/* ENTRY POINT */
|
||||
void import_slave(
|
||||
/* RETURN: -- NA */
|
||||
TEST *T ) /* INOUT: -- TEST */
|
||||
{
|
||||
|
||||
/* Make a saw tooth */
|
||||
if ( T->a.i > 20 ) {
|
||||
T->a.i = 0 ;
|
||||
T->a.d = 0 ;
|
||||
|
||||
T->b.i = 0 ;
|
||||
T->b.d = 0 ;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
20793 12 ./src/ip_test.c
|
||||
8488 10 ./include/ip_c_types.h
|
||||
18178 28 ./include/ip_test.d
|
||||
57882 9 ./include/ip_test.h
|
@ -1,118 +0,0 @@
|
||||
/* TRICK HEADER
|
||||
PURPOSE:
|
||||
(Test all possible C data types recognized by the Interface Code
|
||||
Generator and the executive input processor.)
|
||||
|
||||
REFERENCE:
|
||||
(((Bailey, Robert W.)
|
||||
(User's Guide and Operational Procedures Volume ...
|
||||
of the Trick Simulation Environment) (MDSS-HD TM-6.24.26-04)
|
||||
(McDonnell Douglas Space Systems - Houston Division) (March 1993) (--)))
|
||||
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((Unlimited software array dimensions and sizing)
|
||||
(Unlimited software dynamically allocated array dimensions and sizing)
|
||||
(Excessively large structures may overrun hardware memory)
|
||||
(ICG ignores all compilier directives except '#define')
|
||||
(ICG ignores all typedef declarations other than 'typedef struct'
|
||||
and 'typedef enum'))
|
||||
|
||||
PROGRAMMERS:
|
||||
(((Robert W. Bailey) (LinCom) (10/1/90) (Trick-CR-00000) (Initial Release)))
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ip_c_types.h,v $
|
||||
* Revision 7.1 2006-06-22 14:14:14-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:55-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:19 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2003/05/29 18:57:16 vetter
|
||||
* Add Bitfield Test To IP Test
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:26 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IP_C_TYPES
|
||||
#define _IP_C_TYPES
|
||||
|
||||
#define TWO 2 /* THE Value 2 */
|
||||
|
||||
typedef struct {
|
||||
unsigned int bits_a : 5 ; /* -- Test bits 5 */
|
||||
unsigned int : 2 ; /* -- Test bits 7 */
|
||||
unsigned int bits_b : 9 ; /* -- Test bits 16 */
|
||||
unsigned int bits_c : 16 ; /* -- Test bits 32 */
|
||||
double doub_x ; /* -- Miscellaneous double */
|
||||
unsigned int bits_d : 7 ; /* -- Test bits */
|
||||
} BITS ;
|
||||
|
||||
typedef struct { /* FUNDAMENTAL 'C' DATA TYPES ----------------------------*/
|
||||
|
||||
char c ; /* -- Single character */
|
||||
unsigned char uc ; /* -- Single unsigned character */
|
||||
char * cp ; /* -- Single string */
|
||||
short s ; /* -- Single short integer */
|
||||
unsigned short us ; /* -- Single unsigned short integer */
|
||||
int i ; /* -- Integer */
|
||||
unsigned int ui ; /* -- Single unsigned integer */
|
||||
long l ; /* -- Single long integer */
|
||||
unsigned long ul ; /* -- Single unsigned long integer */
|
||||
float f ; /* -- Single precision floating point value*/
|
||||
double d ; /* -- Double precision floating point value */
|
||||
|
||||
} C_TYPES ; /*----------------------------------------------------------------*/
|
||||
|
||||
typedef struct { /* ARRAYS ------------------------------------------------*/
|
||||
|
||||
char ca[2][2][2] ; /* -- characters (strings) */
|
||||
unsigned char uca[2][2][2] ; /* -- unsigned character s*/
|
||||
short sa[2][2][2] ; /* -- short integers */
|
||||
unsigned short usa[2][2][2] ; /* -- unsigned short integers */
|
||||
int ia[2][2][2] ; /* -- integers */
|
||||
unsigned int uia[2][2][2] ; /* -- unsigned integers */
|
||||
long la[2][2][2] ; /* -- long integers */
|
||||
unsigned long ula[2][2][2] ; /* -- unsigned long integers */
|
||||
float fa[2][2][2] ; /* -- single precision floating point */
|
||||
double da[2][2][2] ; /* -- double precision floating point */
|
||||
|
||||
} C_ARR_TYPES ; /*------------------------------------------------------------*/
|
||||
|
||||
typedef struct { /* POINTERS -- UNCONSTRAINED ARRAYS ----------------------*/
|
||||
|
||||
char **** cpp ; /* -- strings */
|
||||
unsigned char *** ucpp ; /* -- unsigned characters */
|
||||
short *** spp ; /* -- short integers */
|
||||
unsigned short *** uspp ; /* -- unsigned short integers */
|
||||
int *** ipp ; /* -- integers */
|
||||
unsigned int *** uipp ; /* -- unsigned integers */
|
||||
long *** lpp ; /* -- long integers */
|
||||
unsigned long *** ulpp ; /* -- unsigned long integers */
|
||||
float *** fpp ; /* -- single precision floating point */
|
||||
double *** dpp ; /* -- double precision floating point */
|
||||
|
||||
} C_PTR_TYPES ; /*------------------------------------------------------------*/
|
||||
|
||||
typedef struct { /* MIXED POINTERS AND ARRAYS -----------------------------*/
|
||||
|
||||
char *** cpa[TWO] ; /* -- characters (strings) */
|
||||
unsigned char ** ucpa[TWO] ; /* -- unsigned characters */
|
||||
short ** spa[TWO] ; /* -- short integers */
|
||||
unsigned short ** uspa[TWO] ; /* -- unsigned short integers */
|
||||
int ** ipa[TWO] ; /* -- integers */
|
||||
unsigned int ** uipa[TWO] ; /* -- unsigned integers */
|
||||
long ** lpa[TWO] ; /* -- long integers */
|
||||
unsigned long ** ulpa[TWO] ; /* -- unsigned long integers */
|
||||
float ** fpa[TWO] ; /* -- single precision floating points */
|
||||
double ** dpa[TWO] ; /* -- double precision floating points */
|
||||
|
||||
} C_MIX_TYPES ; /*------------------------------------------------------------*/
|
||||
|
||||
#endif
|
@ -1,514 +0,0 @@
|
||||
/*
|
||||
PURPOSE:
|
||||
(Test Trick input processor memory allocation and input field syntax and
|
||||
capabilities.)
|
||||
|
||||
REFERENCE:
|
||||
(((Bailey, R.W)
|
||||
(User's Guide and Operational Procedures Volume ...
|
||||
of the Trick Simulation Environment) (MDSS-HD TM-6.24.26-04)
|
||||
(McDonnell Dougla Space Systems - Houston Division) (March 1993) ()))
|
||||
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((What you see is what you get.))
|
||||
|
||||
PROGRAMMERS:
|
||||
(((Robert W. Bailey) (LinCom) (9/1/90 (Trick-CR-00000) (Initial Release)))
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ip_test.d,v $
|
||||
* Revision 7.3 2007-01-08 11:22:17-06 dstrauss
|
||||
* Bugs in parsing new units specs
|
||||
*
|
||||
* Revision 7.2 2006-08-31 13:59:12-05 hchen
|
||||
* SIM_test_ip error - convert the old style of allocation statements to the new style and update the file due to the variable units changed to units_test
|
||||
*
|
||||
* Revision 7.1 2006-06-22 14:14:14-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.2 2004-09-07 11:48:42-05 lin
|
||||
* New #define handling does not pass SIM_test_ip
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:55-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.3 2004/02/18 21:54:41 lin
|
||||
* remove "STRING" as the special case for "char *"
|
||||
*
|
||||
* Revision 4.2 2004/01/15 22:36:42 lin
|
||||
* test sims do not work
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:19 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.5 2003/06/09 21:03:13 vetter
|
||||
* Forget Fortran For 4
|
||||
*
|
||||
* Revision 1.4 2003/05/29 18:57:21 vetter
|
||||
* Add Bitfield Test To IP Test
|
||||
*
|
||||
* Revision 1.3 2003/03/14 20:16:51 lin
|
||||
* Try and rewrite ip_alloc scheme to remove extra 8 byte requirement
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:27 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#define TWO (2.00000000)
|
||||
#define TWO2 ((4*2.0)-6.00000000)
|
||||
#define THREE 3.00000000
|
||||
#define DTR 0.0174532925199432957
|
||||
|
||||
IP_TEST.strings_good = 1 ;
|
||||
|
||||
IP_TEST.bits[0].bits_a = 1 ;
|
||||
IP_TEST.bits[0].bits_b = 2 ;
|
||||
IP_TEST.bits[0].bits_c = 3 ;
|
||||
IP_TEST.bits[0].bits_d = 4 ;
|
||||
IP_TEST.bits[0].doub_x = 777.0 ;
|
||||
|
||||
IP_TEST.bits[1].bits_a = 5 ;
|
||||
IP_TEST.bits[1].bits_b = 6 ;
|
||||
IP_TEST.bits[1].bits_c = 7 ;
|
||||
IP_TEST.bits[1].bits_d = 8 ;
|
||||
IP_TEST.bits[1].doub_x = 999.0 ;
|
||||
|
||||
/* The following are the old style of allocation statements.
|
||||
IP_TEST.c_pointer_types.cpp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.ucpp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.spp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.uspp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.ipp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.uipp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.lpp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.ulpp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.fpp[ 2 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_pointer_types.dpp[ 2 ][ 2 ][ 2 ] ;
|
||||
|
||||
IP_TEST.c_mixed_types.cpa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.cpa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.ucpa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.ucpa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.spa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.spa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.uspa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.uspa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.ipa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.ipa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.uipa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.uipa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.lpa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.lpa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.ulpa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.ulpa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.fpa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.fpa[ 1 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.dpa[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.c_mixed_types.dpa[ 1 ][ 2 ][ 2 ] ;
|
||||
|
||||
IP_TEST.units_test[ 0 ][ 2 ][ 2 ] ;
|
||||
IP_TEST.units_test[ 1 ][ 2 ][ 2 ] ;*/
|
||||
|
||||
/* NEW ALLOCATION STATEMENTS */
|
||||
int i,j;
|
||||
|
||||
IP_TEST.c_pointer_types.cpp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.cpp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.cpp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.ucpp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.ucpp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.ucpp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.spp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.spp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.spp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.uspp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.uspp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.uspp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.ipp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.ipp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.ipp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.uipp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.uipp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.uipp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.lpp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.lpp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.lpp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.ulpp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.ulpp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.ulpp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.fpp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.fpp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.fpp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_pointer_types.dpp = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_pointer_types.dpp[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_pointer_types.dpp[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.cpa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.cpa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.cpa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.ucpa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.ucpa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.ucpa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.spa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.spa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.spa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.uspa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.uspa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.uspa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.ipa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.ipa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.ipa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.uipa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.uipa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.uipa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.lpa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.lpa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.lpa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.ulpa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.ulpa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.ulpa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.fpa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.fpa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.fpa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
IP_TEST.c_mixed_types.dpa = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.c_mixed_types.dpa[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.c_mixed_types.dpa[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_TEST.units_test = alloc(2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
IP_TEST.units_test[i] = alloc(2);
|
||||
for (j=0; j < 2; j++) {
|
||||
IP_TEST.units_test[i][j] = alloc(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* UNITS CONVERSION */
|
||||
IP_TEST.units_test[0][0][0].second[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].second[1] {s} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].second[2] {min} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].second[3] {hr} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].second[4] {day} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[1] {mm} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[2] {cm} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[3] {M} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[4] {km} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[5] {in} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[6] {ft} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[7] {yd} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[8] {mi} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].meter[9] {n.m.} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].radian[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].radian[1] {r} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].radian[2] {as} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].radian[3] {am} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].radian[4] {d} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].kilogram[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].kilogram[1] {g} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].kilogram[2] {kg} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].kilogram[3] {mt} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].kilogram[4] {sl} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].kilogram[5] {lbm} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].newton[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].newton[1] {N} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].newton[2] {kN} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].newton[3] {oz} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].newton[4] {lbf} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].volt[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].volt[1] {v} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].volt[2] {kv} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].amp[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].amp[1] {amp} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].amp[2] {mamp} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].ohm[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].ohm[1] {ohm} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].celsius[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].celsius[1] {K} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].celsius[2] {R} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].celsius[3] {F} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].fahrenheit[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].fahrenheit[1] {C} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].fahrenheit[2] {K} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].fahrenheit[3] {R} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].temp_rate[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].temp_rate[1] {C/s} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].temp_rate[2] {R/min} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].temp_rate[3] {F/s} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].area[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].area[1] {ft2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].area[2] {cm2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].volume[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].volume[1] {cm3} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].volume[2] {ft3} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].velocity[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].velocity[1] {mi/hr} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].velocity[2] {yd/min} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].velocity_eng[0] {mi/hr} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].velocity_eng[1] {M/s} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].accel[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].accel[1] {ft/s2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].accel[2] {n.m./day2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].inertia[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].inertia[1] {lbm*ft2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].inertia[2] {sl*in2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].torque[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].torque[1] {lbf*ft} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].torque[2] {oz*in} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].pressure[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].pressure[1] {oz/in2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].pressure[2] {lbf/ft2} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].density[0] = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].density[1] {g/cm3} = 1.0 ;
|
||||
IP_TEST.units_test[0][0][0].density[2] {sl/ft3} = 1.0 ;
|
||||
|
||||
|
||||
IP_TEST.units_test[0][0][0].measure = meter ;
|
||||
IP_TEST.units_test[0][0][1].measure = centimeter ;
|
||||
IP_TEST.units_test[0][1][0].measure = millimeter ;
|
||||
IP_TEST.units_test[0][1][1].measure = kilometer ;
|
||||
IP_TEST.units_test[1][0][0].measure = inches ;
|
||||
IP_TEST.units_test[1][0][1].measure = feet ;
|
||||
IP_TEST.units_test[1][1][0].measure = yard ;
|
||||
IP_TEST.units_test[1][1][1].measure = mile ;
|
||||
|
||||
IP_TEST.c_types.c = 'c' ;
|
||||
IP_TEST.c_types.uc = 'u' ;
|
||||
IP_TEST.c_types.cp = "Testing Char Pointers." ;
|
||||
IP_TEST.c_types.s = abs( -1 ) ;
|
||||
IP_TEST.c_types.us = 2 % THREE ;
|
||||
IP_TEST.c_types.i = -3 % TWO ;
|
||||
IP_TEST.c_types.ui = pow ( 4 , TWO ) ;
|
||||
IP_TEST.c_types.l = pow ( -5 , THREE ) ;
|
||||
IP_TEST.c_types.ul = 6 * TWO2 ;
|
||||
IP_TEST.c_types.f = THREE/7.7777777 ;
|
||||
IP_TEST.c_types.d = 8.88888888888888888888888 + TWO ;
|
||||
|
||||
IP_TEST.c_array_types.ca[0][0][0] = 'a' , 'b' ;
|
||||
IP_TEST.c_array_types.ca[0][1][0] = 'c' , 'd' ;
|
||||
IP_TEST.c_array_types.ca[1][0][0] = 'e' , 'f' ;
|
||||
IP_TEST.c_array_types.ca[1][1][0] = 'g' , 'h' ;
|
||||
IP_TEST.c_array_types.uca[0][0][0] = 'i' , 'j' ;
|
||||
IP_TEST.c_array_types.uca[0][1][0] = 'k' , 'l' ;
|
||||
IP_TEST.c_array_types.uca[1][0][0] = 'm' , 'n' ;
|
||||
IP_TEST.c_array_types.uca[1][1][0] = 'o' , 'p' ;
|
||||
IP_TEST.c_array_types.sa[0][0][0] = -1 - THREE , - THREE ;
|
||||
IP_TEST.c_array_types.sa[0][1][0] = TWO2 * { -3 , -4 } ;
|
||||
IP_TEST.c_array_types.sa[1][0][0] = { -5 , -6 } * ( 1.0 / TWO ) ;
|
||||
IP_TEST.c_array_types.sa[1][1][0] = -7 , -8 ;
|
||||
IP_TEST.c_array_types.usa[0][0][0] = 0x0009 , 0x000A ;
|
||||
IP_TEST.c_array_types.usa[0][1][0] = 0x000b , 0x000C ;
|
||||
IP_TEST.c_array_types.usa[1][0][0] = 0x000d , 14 ;
|
||||
IP_TEST.c_array_types.usa[1][1][0] = 15 , 16 ;
|
||||
IP_TEST.c_array_types.ia[0][0][0] = -20 , -21 ;
|
||||
IP_TEST.c_array_types.ia[0][1][0] = -22 , -23 ;
|
||||
IP_TEST.c_array_types.ia[1][0][0] = -24 , -25 ;
|
||||
IP_TEST.c_array_types.ia[1][1][0] = -26 , -27 ;
|
||||
IP_TEST.c_array_types.uia[0][0][0] = 28 , 29 ;
|
||||
IP_TEST.c_array_types.uia[0][1][0] = 30 , 31 ;
|
||||
IP_TEST.c_array_types.uia[1][0][0] = 32 , 33 ;
|
||||
IP_TEST.c_array_types.uia[1][1][0] = 34 , 35 ;
|
||||
IP_TEST.c_array_types.la[0][0][0] = -200001 ,-200002 ;
|
||||
IP_TEST.c_array_types.la[0][1][0] = -200003 ,-200004 ;
|
||||
IP_TEST.c_array_types.la[1][0][0] = -200005 ,-200006 ;
|
||||
IP_TEST.c_array_types.la[1][1][0] = -200007 ,-200008 ;
|
||||
IP_TEST.c_array_types.ula[0][0][0] = 200009 , 200010 ;
|
||||
IP_TEST.c_array_types.ula[0][1][0] = 200011 , 200012 ;
|
||||
IP_TEST.c_array_types.ula[1][0][0] = 200013 , 200014 ;
|
||||
IP_TEST.c_array_types.ula[1][1][0] = 200015 , 200016 ;
|
||||
IP_TEST.c_array_types.fa[0][0][0] = abs( cos( 30.0 * DTR ) ) ;
|
||||
IP_TEST.c_array_types.fa[0][1][0] = pow( 3.33333333 , 4.44444444 ) ;
|
||||
IP_TEST.c_array_types.fa[1][0][0] = exp( 5.55555555 ) ;
|
||||
IP_TEST.c_array_types.fa[1][1][0] = log( 7.77777777 ) ;
|
||||
IP_TEST.c_array_types.da[0][0][0] = cos( 30.0 * DTR ) ;
|
||||
IP_TEST.c_array_types.da[0][1][0] = sin( 30.0 * DTR ) ;
|
||||
IP_TEST.c_array_types.da[1][0][0] = tan( 30.0 * DTR ) ;
|
||||
IP_TEST.c_array_types.da[1][1][0] = acos( 0.5 ) ;
|
||||
|
||||
IP_TEST.c_pointer_types.cpp[0][0][0] = "I'd" , "rather" ;
|
||||
IP_TEST.c_pointer_types.cpp[0][1][0] = "be" , "developing" ;
|
||||
IP_TEST.c_pointer_types.cpp[1][0][0] = "than" , "testing" ;
|
||||
IP_TEST.c_pointer_types.cpp[1][1][0] = "or" , "debugging." ;
|
||||
IP_TEST.c_pointer_types.ucpp[0][0][0] = 'A' , 'B' ;
|
||||
IP_TEST.c_pointer_types.ucpp[0][1][0] = 'C' , 'D' ;
|
||||
IP_TEST.c_pointer_types.ucpp[1][0][0] = 'E' , 'F' ;
|
||||
IP_TEST.c_pointer_types.ucpp[1][1][0] = 'G' , 'H' ;
|
||||
IP_TEST.c_pointer_types.spp[0][0][0] = -1 , -2 ;
|
||||
IP_TEST.c_pointer_types.spp[0][1][0] = -3 , -4 ;
|
||||
IP_TEST.c_pointer_types.spp[1][0][0] = -5 , -6 ;
|
||||
IP_TEST.c_pointer_types.spp[1][1][0] = -7 , -8 ;
|
||||
IP_TEST.c_pointer_types.uspp[0][0][0] = 9 , 10 ;
|
||||
IP_TEST.c_pointer_types.uspp[0][1][0] = 11 , 12 ;
|
||||
IP_TEST.c_pointer_types.uspp[1][0][0] = 13 , 14 ;
|
||||
IP_TEST.c_pointer_types.uspp[1][1][0] = 15 , 16 ;
|
||||
IP_TEST.c_pointer_types.ipp[0][0][0] = -20 , -21 ;
|
||||
IP_TEST.c_pointer_types.ipp[0][1][0] = -22 , -23 ;
|
||||
IP_TEST.c_pointer_types.ipp[1][0][0] = -24 , -25 ;
|
||||
IP_TEST.c_pointer_types.ipp[1][1][0] = -26 , -27 ;
|
||||
IP_TEST.c_pointer_types.uipp[0][0][0] = 28 , 29 ;
|
||||
IP_TEST.c_pointer_types.uipp[0][1][0] = 30 , 31 ;
|
||||
IP_TEST.c_pointer_types.uipp[1][0][0] = 32 , 33 ;
|
||||
IP_TEST.c_pointer_types.uipp[1][1][0] = 34 , 35 ;
|
||||
IP_TEST.c_pointer_types.lpp[0][0][0] = -200001 ,-200002 ;
|
||||
IP_TEST.c_pointer_types.lpp[0][1][0] = -200003 ,-200004 ;
|
||||
IP_TEST.c_pointer_types.lpp[1][0][0] = -200005 ,-200006 ;
|
||||
IP_TEST.c_pointer_types.lpp[1][1][0] = -200007 ,-200008 ;
|
||||
IP_TEST.c_pointer_types.ulpp[0][0][0] = 200009 , 200010 ;
|
||||
IP_TEST.c_pointer_types.ulpp[0][1][0] = 200011 , 200012 ;
|
||||
IP_TEST.c_pointer_types.ulpp[1][0][0] = 200013 , 200014 ;
|
||||
IP_TEST.c_pointer_types.ulpp[1][1][0] = 200015 , 200016 ;
|
||||
IP_TEST.c_pointer_types.fpp[0][0][0] = asin( 0.5 ) ;
|
||||
IP_TEST.c_pointer_types.fpp[0][1][0] = atan( 0.5 ) , atan2( -1.0 , 2.0 ) ;
|
||||
IP_TEST.c_pointer_types.fpp[1][0][0] = sqrt( THREE ) ;
|
||||
IP_TEST.c_pointer_types.fpp[1][1][0] = 7.77777777 , 8.88888888 ;
|
||||
IP_TEST.c_pointer_types.dpp[0][0][0] = -1.1111111111111111, -2.2222222222222222;
|
||||
IP_TEST.c_pointer_types.dpp[0][1][0] = -3.3333333333333333, -4.4444444444444444;
|
||||
IP_TEST.c_pointer_types.dpp[1][0][0] = -5.5555555555555555, -6.6666666666666666;
|
||||
IP_TEST.c_pointer_types.dpp[1][1][0] = -7.777E-03 , -8.888e+003 ;
|
||||
|
||||
#define SURF surfing
|
||||
#define COLOR blue
|
||||
#define BEACH Wakiki
|
||||
|
||||
|
||||
IP_TEST.c_mixed_types.cpa[0][0][0] = "I" , "would" ;
|
||||
IP_TEST.c_mixed_types.cpa[0][1][0] = "rather" , "be" ;
|
||||
IP_TEST.c_mixed_types.cpa[1][0][0] = "#(SURF)" , "today" ;
|
||||
IP_TEST.c_mixed_types.cpa[1][1][0] = "in" , "the #{COLOR} oceans of #(BEACH)." ;
|
||||
IP_TEST.c_mixed_types.ucpa[0][0][0] = 'A' , 'B' ;
|
||||
IP_TEST.c_mixed_types.ucpa[0][1][0] = 'C' , 'D' ;
|
||||
IP_TEST.c_mixed_types.ucpa[1][0][0] = 'E' , 'F' ;
|
||||
IP_TEST.c_mixed_types.ucpa[1][1][0] = 'G' , 'H' ;
|
||||
IP_TEST.c_mixed_types.spa[0][0][0] = -1 , -2 ;
|
||||
IP_TEST.c_mixed_types.spa[0][1][0] = -3 , -4 ;
|
||||
IP_TEST.c_mixed_types.spa[1][0][0] = -5 , -6 ;
|
||||
IP_TEST.c_mixed_types.spa[1][1][0] = -7 , -8 ;
|
||||
IP_TEST.c_mixed_types.uspa[0][0][0] = 9 , 10 ;
|
||||
IP_TEST.c_mixed_types.uspa[0][1][0] = 11 , 12 ;
|
||||
IP_TEST.c_mixed_types.uspa[1][0][0] = 13 , 14 ;
|
||||
IP_TEST.c_mixed_types.uspa[1][1][0] = 15 , 16 ;
|
||||
IP_TEST.c_mixed_types.ipa[0][0][0] = -20 , -21 ;
|
||||
IP_TEST.c_mixed_types.ipa[0][1][0] = -22 , -23 ;
|
||||
IP_TEST.c_mixed_types.ipa[1][0][0] = -24 , -25 ;
|
||||
IP_TEST.c_mixed_types.ipa[1][1][0] = -26 , -27 ;
|
||||
IP_TEST.c_mixed_types.uipa[0][0][0] = 28 , 29 ;
|
||||
IP_TEST.c_mixed_types.uipa[0][1][0] = 30 , 31 ;
|
||||
IP_TEST.c_mixed_types.uipa[1][0][0] = 32 , 33 ;
|
||||
IP_TEST.c_mixed_types.uipa[1][1][0] = 34 , 35 ;
|
||||
IP_TEST.c_mixed_types.lpa[0][0][0] = -200001 ,-200002 ;
|
||||
IP_TEST.c_mixed_types.lpa[0][1][0] = -200003 ,-200004 ;
|
||||
IP_TEST.c_mixed_types.lpa[1][0][0] = -200005 ,-200006 ;
|
||||
IP_TEST.c_mixed_types.lpa[1][1][0] = -200007 ,-200008 ;
|
||||
IP_TEST.c_mixed_types.ulpa[0][0][0] = 200009 , 200010 ;
|
||||
IP_TEST.c_mixed_types.ulpa[0][1][0] = 200011 , 200012 ;
|
||||
IP_TEST.c_mixed_types.ulpa[1][0][0] = 200013 , 200014 ;
|
||||
IP_TEST.c_mixed_types.ulpa[1][1][0] = 200015 , 200016 ;
|
||||
IP_TEST.c_mixed_types.fpa[0][0][0] = 1.11111111 , 2.22222222 ;
|
||||
IP_TEST.c_mixed_types.fpa[0][1][0] = 3.33333333 , 4.44444444 ;
|
||||
IP_TEST.c_mixed_types.fpa[1][0][0] = 5.55555555 , 6.66666666 ;
|
||||
IP_TEST.c_mixed_types.fpa[1][1][0] = -7.777E-03 , -8.888e+03 ;
|
||||
IP_TEST.c_mixed_types.dpa[0][0][0] = -1.1111111111111111 , -2.2222222222222222 ;
|
||||
IP_TEST.c_mixed_types.dpa[0][1][0] = -3.3333333333333333 , -4.4444444444444444 ;
|
||||
IP_TEST.c_mixed_types.dpa[1][0][0] = -5.5555555555555555 , -6.6666666666666666 ;
|
||||
IP_TEST.c_mixed_types.dpa[1][1][0] = -7.7777777777777777 , -8.8888888888888888 ;
|
@ -1,131 +0,0 @@
|
||||
/* TRICK HEADER
|
||||
PURPOSE:
|
||||
(Test all possible data types recognized by the Interface Code
|
||||
Generator and the executive input processor.)
|
||||
|
||||
REFERENCE:
|
||||
(((Bailey, Robert W.)
|
||||
(User's Guide and Operational Procedures Volume ...
|
||||
of the Trick Simulation Environment) (MDSS-HD TM-6.24.26-04)
|
||||
(McDonnell Douglas Space Systems - Houston Division) (March 1993) (--)))
|
||||
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((Unlimited software array dimensions and sizing)
|
||||
(Unlimited software dynamically allocated array dimensions and sizing)
|
||||
(Excessively large structures may overrun hardware memory)
|
||||
(All parameter declarations MUST start in the first column))
|
||||
|
||||
PROGRAMMERS:
|
||||
(((Robert W. Bailey) (LinCom) (10/1/90) (Trick-CR-00000) (Initial Release)))
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ip_test.h,v $
|
||||
* Revision 7.3 2007-01-08 11:22:22-06 dstrauss
|
||||
* Bugs in parsing new units specs
|
||||
*
|
||||
* Revision 7.2 2006-08-31 13:56:38-05 hchen
|
||||
* SIM_test_ip error - change the variable name units to units_test due to sys conflict
|
||||
*
|
||||
* Revision 7.1 2006-06-22 14:14:15-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:55-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:20 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2003/05/29 18:57:23 vetter
|
||||
* Add Bitfield Test To IP Test
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:27 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IP_TEST_H_
|
||||
#define _IP_TEST_H_
|
||||
|
||||
/*=== THESE DEFINES ARE PARSED AND USABLE IN ARRAY DIMENSIONS ===*/
|
||||
#define TWO 2 /* THE Value 2 */
|
||||
#define TWO2 (1+1) /* THE Value 2 */
|
||||
#define TWO3 2*1
|
||||
|
||||
/*=== THESE DEFINES ARE IGNORED ===*/
|
||||
#define DUMMY_MACRO1(A,B) A = B + 1
|
||||
#define DUMMY_MACRO2(A,B) { \
|
||||
A = B + 1 ; \
|
||||
B++ ; \
|
||||
}
|
||||
|
||||
/*==== SYSTEM INCLUDES ARE IGNORED ===*/
|
||||
#include <stdio.h> /* ignored */
|
||||
#include <sys/time.h> /* ignored */
|
||||
|
||||
/*==== USER INCLUDES ARE PARSED AND STORED FOR FUTURE REFERENCE ====*/
|
||||
#include "ip_c_types.h"
|
||||
|
||||
/*==== ALL GLOBAL DECLARATIONS ARE IGNORED ====*/
|
||||
int * int_function() ; /* ignored */
|
||||
float real_function( int bogus1 , double *bogus2[] ) ; /* ignored */
|
||||
|
||||
/*==== THESE TYPEDEFS ARE IGNORED ===*/
|
||||
typedef unsigned int Int_Type ; /* ignored */
|
||||
typedef double* Double_Ptr ;
|
||||
typedef void (*Void_Func)() ; /* ignored */
|
||||
|
||||
typedef enum { /* ENUMERATED TYPES --------------------------------------*/
|
||||
|
||||
meter = -2 , /* Meters */
|
||||
centimeter , /* CentiMeters */
|
||||
millimeter , /* MilliMeters */
|
||||
kilometer , /* KiloMeters */
|
||||
inches = 10 , /* Inches */
|
||||
feet , /* Feet */
|
||||
yard , /* Yards */
|
||||
mile = 5 , /* Miles */
|
||||
nautical_mile /* Nautical Miles */
|
||||
|
||||
} Distance ; /*---------------------------------------------------------------*/
|
||||
|
||||
typedef struct { /* MEASUREMENT UNITS_TEST SPECIFICATION -----------------*/
|
||||
|
||||
double second[5] ; /* s Measurement units */
|
||||
double meter[10] ; /* M Measurement units */
|
||||
double radian[5] ; /* r Measurement units */
|
||||
double kilogram[6] ; /* kg Measurement units */
|
||||
double newton[5] ; /* N Measurement units */
|
||||
double volt[3] ; /* v Measurement units */
|
||||
double amp[3] ; /* amp Measurement units */
|
||||
double ohm[2] ; /* ohm Measurement units */
|
||||
double celsius[4] ; /* C Measurement units */
|
||||
double fahrenheit[4] ; /* F Measurement units */
|
||||
double temp_rate[4] ; /* K/s Measurement units */
|
||||
double area[3] ; /* M2 Measurement units */
|
||||
double volume[1+1+1] ; /* M3 Measurement units */
|
||||
double velocity[4-1] ; /* M/s Measurement units */
|
||||
double velocity_eng[2] ; /* mi/hr Measurement units using non-std units */
|
||||
double accel[TWO+1] ; /* M/s2 Measurement units */
|
||||
double inertia[3*1] ; /* kg*M2 Measurement units */
|
||||
double torque[TWO*2-1] ; /* N*M Measurement units */
|
||||
double pressure[3] ; /* N/M2 Measurement units */
|
||||
double density[3] ; /* kg/M3 Measurement units */
|
||||
Distance measure ; /* -- Distance measurement units */
|
||||
|
||||
} UNITS_TEST ; /*-------------------------------------------------------------*/
|
||||
|
||||
|
||||
typedef struct { /* COMPOSITE DATA STRUCTURES ----------------------------*/
|
||||
|
||||
BITS bits[TWO] ; /* -- Two bits, four bits, six bits, a $ */
|
||||
C_TYPES c_types ; /* -- Standard C types */
|
||||
C_ARR_TYPES c_array_types ; /* -- Arrayed C types */
|
||||
C_PTR_TYPES c_pointer_types ; /* -- Pointered C types */
|
||||
C_MIX_TYPES c_mixed_types ; /* -- Mixed arrays and pointer types */
|
||||
UNITS_TEST **units_test[TWO] ; /* -- Measurement unit test params */
|
||||
int strings_good ; /* -- 1-good 0-bad */
|
||||
|
||||
} IP_TEST ; /*----------------------------------------------------------------*/
|
||||
|
||||
#endif
|
@ -1,223 +0,0 @@
|
||||
/*
|
||||
PURPOSE:
|
||||
(Test the Trick simulation executive 'scheduled' module handling.)
|
||||
REFERENCE:
|
||||
(((Bailey, R.W, and Paddock, E.J.)
|
||||
(Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC / Engineering Directorate / Automation and Robotics Division)
|
||||
(Mar 1996) (--)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((None))
|
||||
CLASS:
|
||||
(scheduled)
|
||||
LIBRARY DEPENDENCY:
|
||||
(ip_test.o)
|
||||
PROGRAMMERS:
|
||||
(((Robert W. Bailey) (LinCom Corp) (9/1/90) (Trick-CR-00000)
|
||||
(Initial Release.)))
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ip_test.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:13-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.2 2005-01-31 15:45:54-06 lin
|
||||
* remove "register" keyword
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:55-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:19 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:28 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../include/ip_test.h"
|
||||
|
||||
int ip_test(
|
||||
/* RETURN: -- 0 - Nominal */
|
||||
IP_TEST * it ) /* INOUT: -- Executive Input/Output test parameters */
|
||||
|
||||
{
|
||||
|
||||
char test_string[128] ;
|
||||
char* trick_home ;
|
||||
|
||||
/* POINTER SHORTHAND ACCESS */
|
||||
C_TYPES * C = &(it->c_types) ;
|
||||
C_ARR_TYPES * CA = &(it->c_array_types) ;
|
||||
C_PTR_TYPES * CP = &(it->c_pointer_types) ;
|
||||
C_MIX_TYPES * CM = &(it->c_mixed_types) ;
|
||||
|
||||
C->i += 1 ;
|
||||
C->d += 1.0 ;
|
||||
|
||||
CA->sa[0][0][1] += 1 ;
|
||||
CA->fa[0][1][0] += 1.0 ;
|
||||
|
||||
CP->ipp[0][1][0] += 1 ;
|
||||
CP->dpp[1][0][1] += 1 ;
|
||||
|
||||
CM->lpa[1][0][0] += 1 ;
|
||||
CM->dpa[1][1][0] += 1 ;
|
||||
|
||||
|
||||
trick_home = getenv("TRICK_HOME");
|
||||
|
||||
/* Characters */
|
||||
sprintf( test_string,"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
|
||||
CA->ca[0][0][0],
|
||||
CA->ca[0][0][1],
|
||||
CA->ca[0][1][0],
|
||||
CA->ca[0][1][1],
|
||||
CA->ca[1][0][0],
|
||||
CA->ca[1][0][1],
|
||||
CA->ca[1][1][0],
|
||||
CA->ca[1][1][1],
|
||||
|
||||
CA->uca[0][0][0],
|
||||
CA->uca[0][0][1],
|
||||
CA->uca[0][1][0],
|
||||
CA->uca[0][1][1],
|
||||
CA->uca[1][0][0],
|
||||
CA->uca[1][0][1],
|
||||
CA->uca[1][1][0],
|
||||
CA->uca[1][1][1],
|
||||
|
||||
CM->ucpa[0][0][0],
|
||||
CM->ucpa[0][0][1],
|
||||
CM->ucpa[0][1][0],
|
||||
CM->ucpa[0][1][1],
|
||||
CM->ucpa[1][0][0],
|
||||
CM->ucpa[1][0][1],
|
||||
CM->ucpa[1][1][0],
|
||||
CM->ucpa[1][1][1] ) ;
|
||||
if ( strcmp( test_string, "abcdefghijklmnopABCDEFGH" ) ) {
|
||||
fprintf(stderr, "Error_characters: %s \n", test_string);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
|
||||
/* The regular string */
|
||||
if ( strcmp( C->cp, "Testing Char Pointers.") ) {
|
||||
if ( strcmp( C->cp, trick_home ) ) {
|
||||
fprintf(stderr, "Error_character_ptr: %s \n", C->cp);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The character pointers
|
||||
*/
|
||||
if ( strcmp( CP->cpp[0][0][0], "I'd" ) ) {
|
||||
if ( strcmp( CP->cpp[0][0][0], trick_home ) ) {
|
||||
if ( strcmp(CP->cpp[0][0][0], "Cat") ) {
|
||||
fprintf(stderr, "Error_p1: %s \n", CP->cpp[0][0][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[0][0][1], "rather" ) ) {
|
||||
if ( strcmp( CP->cpp[0][0][1], trick_home ) ) {
|
||||
if ( strcmp(CP->cpp[0][0][1], "Horse") ) {
|
||||
fprintf(stderr, "Error_p2: %s \n", CP->cpp[0][0][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[0][1][0], "be" ) ) {
|
||||
if ( strcmp( CP->cpp[0][1][0], trick_home ) ) {
|
||||
fprintf(stderr, "Error_p3: %s \n", CP->cpp[0][1][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[0][1][1], "developing" ) ) {
|
||||
if ( strcmp( CP->cpp[0][1][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_p4: %s \n", CP->cpp[0][1][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[1][0][0], "than" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][0], trick_home ) ) {
|
||||
fprintf(stderr, "Error_p5: %s \n", CP->cpp[1][0][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[1][0][1], "testing" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_p6: %s \n", CP->cpp[1][0][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[1][1][0], "or" ) ) {
|
||||
if ( strcmp( CP->cpp[1][1][0], trick_home ) ) {
|
||||
fprintf(stderr, "Error_p7: %s \n", CP->cpp[1][1][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CP->cpp[1][1][1], "debugging." ) ) {
|
||||
if ( strcmp( CP->cpp[1][1][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_p8: %s \n", CP->cpp[1][1][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The character arrays
|
||||
*/
|
||||
if ( strcmp( CM->cpa[0][0][0], "I" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a1: %s \n", CM->cpa[0][0][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[0][0][1], "would" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a2: %s \n", CM->cpa[0][0][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[0][1][0], "rather" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a3: %s \n", CM->cpa[0][1][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[0][1][1], "be" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a4: %s \n", CM->cpa[0][1][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[1][0][0], "surfing" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a5: %s \n", CM->cpa[1][0][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[1][0][1], "today" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a6: %s \n", CM->cpa[1][0][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[1][1][0], "in" ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a7: %s \n", CM->cpa[1][1][0]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
if ( strcmp( CM->cpa[1][1][1], "the blue oceans of Wakiki." ) ) {
|
||||
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
|
||||
fprintf(stderr, "Error_a8: %s \n", CM->cpa[1][1][1]);
|
||||
it->strings_good = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 ) ;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
42171 2 ./src/ip.c
|
||||
2953 4 ./src/ip_test_init.c
|
||||
8526 28 ./include/ip.h
|
@ -1,531 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Test ip)
|
||||
REFERENCES: (None)
|
||||
ASSUMPTIONS AND LIMITATIONS: (Autocreated by trick_ui)
|
||||
PROGRAMMERS: ((lin) (Thu Feb 27 14:57:16 CST 2003))
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: ip.h,v $
|
||||
* Revision 7.1 2006-06-22 14:14:13-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:56-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.2 2004/01/16 21:48:55 lin
|
||||
* Add a log to all files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ip_h_
|
||||
#define _ip_h_
|
||||
|
||||
#include "sim_services/include/Flag.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
char c ; /* -- Test integer */
|
||||
char c2 ; /* -- Test integer */
|
||||
char c3 ; /* -- Test integer */
|
||||
|
||||
char ca[6] ; /* -- Test integer */
|
||||
char ca2[6] ; /* -- Test integer */
|
||||
char ca3[6] ; /* -- Test integer */
|
||||
|
||||
char caa[8][8] ; /* -- Test integer */
|
||||
char caa2[8][8] ; /* -- Test integer */
|
||||
char caa3[8][8] ; /* -- Test integer */
|
||||
|
||||
char *cp ; /* -- Test integer */
|
||||
char *cp2 ; /* -- Test integer */
|
||||
char *cp3 ; /* -- Test integer */
|
||||
|
||||
char **cpp ; /* -- Test integer */
|
||||
char **cpp2 ; /* -- Test integer */
|
||||
char **cpp3 ; /* -- Test integer */
|
||||
|
||||
char ***cppp ; /* -- Test integer */
|
||||
char ***cppp2 ; /* -- Test integer */
|
||||
char ***cppp3 ; /* -- Test integer */
|
||||
|
||||
} CHAR_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char uc ; /* -- Test integer */
|
||||
unsigned char uc2 ; /* -- Test integer */
|
||||
unsigned char uc3 ; /* -- Test integer */
|
||||
|
||||
unsigned char uca[6] ; /* -- Test integer */
|
||||
unsigned char uca2[6] ; /* -- Test integer */
|
||||
unsigned char uca3[6] ; /* -- Test integer */
|
||||
|
||||
unsigned char ucaa[8][8] ; /* -- Test integer */
|
||||
unsigned char ucaa2[8][8] ; /* -- Test integer */
|
||||
unsigned char ucaa3[8][8] ; /* -- Test integer */
|
||||
|
||||
unsigned char *ucp ; /* -- Test integer */
|
||||
unsigned char *ucp2 ; /* -- Test integer */
|
||||
unsigned char *ucp3 ; /* -- Test integer */
|
||||
|
||||
unsigned char **ucpp ; /* -- Test integer */
|
||||
unsigned char **ucpp2 ; /* -- Test integer */
|
||||
unsigned char **ucpp3 ; /* -- Test integer */
|
||||
|
||||
unsigned char ***ucppp ; /* -- Test integer */
|
||||
unsigned char ***ucppp2 ; /* -- Test integer */
|
||||
unsigned char ***ucppp3 ; /* -- Test integer */
|
||||
|
||||
} UCHAR_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
short s ; /* -- Test integer */
|
||||
short s2 ; /* -- Test integer */
|
||||
short s3 ; /* -- Test integer */
|
||||
|
||||
short sa[6] ; /* -- Test integer */
|
||||
short sa2[6] ; /* -- Test integer */
|
||||
short sa3[6] ; /* -- Test integer */
|
||||
|
||||
short saa[8][8] ; /* -- Test integer */
|
||||
short saa2[8][8] ; /* -- Test integer */
|
||||
short saa3[8][8] ; /* -- Test integer */
|
||||
|
||||
short *sp ; /* -- Test integer */
|
||||
short *sp2 ; /* -- Test integer */
|
||||
short *sp3 ; /* -- Test integer */
|
||||
|
||||
short **spp ; /* -- Test integer */
|
||||
short **spp2 ; /* -- Test integer */
|
||||
short **spp3 ; /* -- Test integer */
|
||||
|
||||
short ***sppp ; /* -- Test integer */
|
||||
short ***sppp2 ; /* -- Test integer */
|
||||
short ***sppp3 ; /* -- Test integer */
|
||||
|
||||
} SHORT_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned short us ; /* -- Test integer */
|
||||
unsigned short us2 ; /* -- Test integer */
|
||||
unsigned short us3 ; /* -- Test integer */
|
||||
|
||||
unsigned short usa[6] ; /* -- Test integer */
|
||||
unsigned short usa2[6] ; /* -- Test integer */
|
||||
unsigned short usa3[6] ; /* -- Test integer */
|
||||
|
||||
unsigned short usaa[8][8] ; /* -- Test integer */
|
||||
unsigned short usaa2[8][8] ; /* -- Test integer */
|
||||
unsigned short usaa3[8][8] ; /* -- Test integer */
|
||||
|
||||
unsigned short *usp ; /* -- Test integer */
|
||||
unsigned short *usp2 ; /* -- Test integer */
|
||||
unsigned short *usp3 ; /* -- Test integer */
|
||||
|
||||
unsigned short **uspp ; /* -- Test integer */
|
||||
unsigned short **uspp2 ; /* -- Test integer */
|
||||
unsigned short **uspp3 ; /* -- Test integer */
|
||||
|
||||
unsigned short ***usppp ; /* -- Test integer */
|
||||
unsigned short ***usppp2 ; /* -- Test integer */
|
||||
unsigned short ***usppp3 ; /* -- Test integer */
|
||||
|
||||
} USHORT_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
int i ; /* -- Test integer */
|
||||
int i2 ; /* -- Test integer */
|
||||
int i3 ; /* -- Test integer */
|
||||
|
||||
int ia[6] ; /* -- Test integer */
|
||||
int ia2[6] ; /* -- Test integer */
|
||||
int ia3[6] ; /* -- Test integer */
|
||||
|
||||
int iaa[8][8] ; /* -- Test integer */
|
||||
int iaa2[8][8] ; /* -- Test integer */
|
||||
int iaa3[8][8] ; /* -- Test integer */
|
||||
|
||||
int *ip ; /* -- Test integer */
|
||||
int *ip2 ; /* -- Test integer */
|
||||
int *ip3 ; /* -- Test integer */
|
||||
|
||||
int **ipp ; /* -- Test integer */
|
||||
int **ipp2 ; /* -- Test integer */
|
||||
int **ipp3 ; /* -- Test integer */
|
||||
|
||||
int ***ippp ; /* -- Test integer */
|
||||
int ***ippp2 ; /* -- Test integer */
|
||||
int ***ippp3 ; /* -- Test integer */
|
||||
|
||||
} INT_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned int ui ; /* -- Test integer */
|
||||
unsigned int ui2 ; /* -- Test integer */
|
||||
unsigned int ui3 ; /* -- Test integer */
|
||||
|
||||
unsigned int uia[6] ; /* -- Test integer */
|
||||
unsigned int uia2[6] ; /* -- Test integer */
|
||||
unsigned int uia3[6] ; /* -- Test integer */
|
||||
|
||||
unsigned int uiaa[8][8] ; /* -- Test integer */
|
||||
unsigned int uiaa2[8][8] ; /* -- Test integer */
|
||||
unsigned int uiaa3[8][8] ; /* -- Test integer */
|
||||
|
||||
unsigned int *uip ; /* -- Test integer */
|
||||
unsigned int *uip2 ; /* -- Test integer */
|
||||
unsigned int *uip3 ; /* -- Test integer */
|
||||
|
||||
unsigned int **uipp ; /* -- Test integer */
|
||||
unsigned int **uipp2 ; /* -- Test integer */
|
||||
unsigned int **uipp3 ; /* -- Test integer */
|
||||
|
||||
unsigned int ***uippp ; /* -- Test integer */
|
||||
unsigned int ***uippp2 ; /* -- Test integer */
|
||||
unsigned int ***uippp3 ; /* -- Test integer */
|
||||
|
||||
} UINT_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
long l ; /* -- Test long */
|
||||
long l2 ; /* -- Test long */
|
||||
long l3 ; /* -- Test long */
|
||||
|
||||
long la[6] ; /* -- Test long */
|
||||
long la2[6] ; /* -- Test long */
|
||||
long la3[6] ; /* -- Test long */
|
||||
|
||||
long laa[8][8] ; /* -- Test long */
|
||||
long laa2[8][8] ; /* -- Test long */
|
||||
long laa3[8][8] ; /* -- Test long */
|
||||
|
||||
long *lp ; /* -- Test long */
|
||||
long *lp2 ; /* -- Test long */
|
||||
long *lp3 ; /* -- Test long */
|
||||
|
||||
long **lpp ; /* -- Test long */
|
||||
long **lpp2 ; /* -- Test long */
|
||||
long **lpp3 ; /* -- Test long */
|
||||
|
||||
long ***lppp ; /* -- Test long */
|
||||
long ***lppp2 ; /* -- Test long */
|
||||
long ***lppp3 ; /* -- Test long */
|
||||
|
||||
} LONG_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned long ul ; /* -- Test long */
|
||||
unsigned long ul2 ; /* -- Test long */
|
||||
unsigned long ul3 ; /* -- Test long */
|
||||
|
||||
unsigned long ula[6] ; /* -- Test long */
|
||||
unsigned long ula2[6] ; /* -- Test long */
|
||||
unsigned long ula3[6] ; /* -- Test long */
|
||||
|
||||
unsigned long ulaa[8][8] ; /* -- Test long */
|
||||
unsigned long ulaa2[8][8] ; /* -- Test long */
|
||||
unsigned long ulaa3[8][8] ; /* -- Test long */
|
||||
|
||||
unsigned long *ulp ; /* -- Test long */
|
||||
unsigned long *ulp2 ; /* -- Test long */
|
||||
unsigned long *ulp3 ; /* -- Test long */
|
||||
|
||||
unsigned long **ulpp ; /* -- Test long */
|
||||
unsigned long **ulpp2 ; /* -- Test long */
|
||||
unsigned long **ulpp3 ; /* -- Test long */
|
||||
|
||||
unsigned long ***ulppp ; /* -- Test long */
|
||||
unsigned long ***ulppp2 ; /* -- Test long */
|
||||
unsigned long ***ulppp3 ; /* -- Test long */
|
||||
|
||||
} ULONG_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
long long ll ; /* -- Test long */
|
||||
long long ll2 ; /* -- Test long */
|
||||
long long ll3 ; /* -- Test long */
|
||||
|
||||
long long lla[6] ; /* -- Test long */
|
||||
long long lla2[6] ; /* -- Test long */
|
||||
long long lla3[6] ; /* -- Test long */
|
||||
|
||||
long long llaa[8][8] ; /* -- Test long */
|
||||
long long llaa2[8][8] ; /* -- Test long */
|
||||
long long llaa3[8][8] ; /* -- Test long */
|
||||
|
||||
long long *llp ; /* -- Test long */
|
||||
long long *llp2 ; /* -- Test long */
|
||||
long long *llp3 ; /* -- Test long */
|
||||
|
||||
long long **llpp ; /* -- Test long */
|
||||
long long **llpp2 ; /* -- Test long */
|
||||
long long **llpp3 ; /* -- Test long */
|
||||
|
||||
long long ***llppp ; /* -- Test long */
|
||||
long long ***llppp2 ; /* -- Test long */
|
||||
long long ***llppp3 ; /* -- Test long */
|
||||
|
||||
} LONG_LONG_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned long long ull ; /* -- Test long */
|
||||
unsigned long long ull2 ; /* -- Test long */
|
||||
unsigned long long ull3 ; /* -- Test long */
|
||||
|
||||
unsigned long long ulla[6] ; /* -- Test long */
|
||||
unsigned long long ulla2[6] ; /* -- Test long */
|
||||
unsigned long long ulla3[6] ; /* -- Test long */
|
||||
|
||||
unsigned long long ullaa[8][8] ; /* -- Test long */
|
||||
unsigned long long ullaa2[8][8] ; /* -- Test long */
|
||||
unsigned long long ullaa3[8][8] ; /* -- Test long */
|
||||
|
||||
unsigned long long *ullp ; /* -- Test long */
|
||||
unsigned long long *ullp2 ; /* -- Test long */
|
||||
unsigned long long *ullp3 ; /* -- Test long */
|
||||
|
||||
unsigned long long **ullpp ; /* -- Test long */
|
||||
unsigned long long **ullpp2 ; /* -- Test long */
|
||||
unsigned long long **ullpp3 ; /* -- Test long */
|
||||
|
||||
unsigned long long ***ullppp ; /* -- Test long */
|
||||
unsigned long long ***ullppp2 ; /* -- Test long */
|
||||
unsigned long long ***ullppp3 ; /* -- Test long */
|
||||
|
||||
} ULONG_LONG_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
float f ; /* -- Test integer */
|
||||
float f2 ; /* -- Test integer */
|
||||
float f3 ; /* -- Test integer */
|
||||
|
||||
float fa[6] ; /* -- Test integer */
|
||||
float fa2[6] ; /* -- Test integer */
|
||||
float fa3[6] ; /* -- Test integer */
|
||||
|
||||
float faa[8][8] ; /* -- Test integer */
|
||||
float faa2[8][8] ; /* -- Test integer */
|
||||
float faa3[8][8] ; /* -- Test integer */
|
||||
|
||||
float *fp ; /* -- Test integer */
|
||||
float *fp2 ; /* -- Test integer */
|
||||
float *fp3 ; /* -- Test integer */
|
||||
|
||||
float **fpp ; /* -- Test integer */
|
||||
float **fpp2 ; /* -- Test integer */
|
||||
float **fpp3 ; /* -- Test integer */
|
||||
|
||||
float ***fppp ; /* -- Test integer */
|
||||
float ***fppp2 ; /* -- Test integer */
|
||||
float ***fppp3 ; /* -- Test integer */
|
||||
|
||||
} FLOAT_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
double d ; /* -- Test integer */
|
||||
double d2 ; /* -- Test integer */
|
||||
double d3 ; /* -- Test integer */
|
||||
|
||||
double da[6] ; /* -- Test integer */
|
||||
double da2[6] ; /* -- Test integer */
|
||||
double da3[6] ; /* -- Test integer */
|
||||
|
||||
double daa[8][8] ; /* -- Test integer */
|
||||
double daa2[8][8] ; /* -- Test integer */
|
||||
double daa3[8][8] ; /* -- Test integer */
|
||||
|
||||
double *dp ; /* -- Test integer */
|
||||
double *dp2 ; /* -- Test integer */
|
||||
double *dp3 ; /* -- Test integer */
|
||||
|
||||
double **dpp ; /* -- Test integer */
|
||||
double **dpp2 ; /* -- Test integer */
|
||||
double **dpp3 ; /* -- Test integer */
|
||||
|
||||
double ***dppp ; /* -- Test integer */
|
||||
double ***dppp2 ; /* -- Test integer */
|
||||
double ***dppp3 ; /* -- Test integer */
|
||||
|
||||
} DOUBLE_STR ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
CHAR_STR cs ;
|
||||
CHAR_STR csa[6] ;
|
||||
CHAR_STR csaa[6][6] ;
|
||||
CHAR_STR *csp ;
|
||||
CHAR_STR *csp1 ;
|
||||
CHAR_STR *csp2 ;
|
||||
CHAR_STR **cspp ;
|
||||
CHAR_STR **cspp1 ;
|
||||
CHAR_STR **cspp2 ;
|
||||
CHAR_STR ***csppp ;
|
||||
CHAR_STR ***csppp1 ;
|
||||
CHAR_STR ***csppp2 ;
|
||||
|
||||
UCHAR_STR ucs ;
|
||||
UCHAR_STR ucsa[6] ;
|
||||
UCHAR_STR ucsaa[6][6] ;
|
||||
UCHAR_STR *ucsp ;
|
||||
UCHAR_STR *ucsp1 ;
|
||||
UCHAR_STR *ucsp2 ;
|
||||
UCHAR_STR **ucspp ;
|
||||
UCHAR_STR **ucspp1 ;
|
||||
UCHAR_STR **ucspp2 ;
|
||||
UCHAR_STR ***ucsppp ;
|
||||
UCHAR_STR ***ucsppp1 ;
|
||||
UCHAR_STR ***ucsppp2 ;
|
||||
|
||||
SHORT_STR ss ;
|
||||
SHORT_STR ssa[6] ;
|
||||
SHORT_STR ssaa[6][6] ;
|
||||
SHORT_STR *ssp ;
|
||||
SHORT_STR *ssp1 ;
|
||||
SHORT_STR *ssp2 ;
|
||||
SHORT_STR **sspp ;
|
||||
SHORT_STR **sspp1 ;
|
||||
SHORT_STR **sspp2 ;
|
||||
SHORT_STR ***ssppp ;
|
||||
SHORT_STR ***ssppp1 ;
|
||||
|
||||
USHORT_STR uss ;
|
||||
USHORT_STR ussa[6] ;
|
||||
USHORT_STR ussaa[6][6] ;
|
||||
USHORT_STR *ussp ;
|
||||
USHORT_STR *ussp1 ;
|
||||
USHORT_STR *ussp2 ;
|
||||
USHORT_STR **usspp ;
|
||||
USHORT_STR **usspp1 ;
|
||||
USHORT_STR **usspp2 ;
|
||||
USHORT_STR ***ussppp ;
|
||||
USHORT_STR ***ussppp1 ;
|
||||
|
||||
INT_STR is ;
|
||||
INT_STR isa[6] ;
|
||||
INT_STR isaa[6][6] ;
|
||||
INT_STR *isp ;
|
||||
INT_STR *isp1 ;
|
||||
INT_STR *isp2 ;
|
||||
INT_STR **ispp ;
|
||||
INT_STR **ispp1 ;
|
||||
INT_STR **ispp2 ;
|
||||
INT_STR ***isppp ;
|
||||
INT_STR ***isppp1 ;
|
||||
INT_STR ***isppp2 ;
|
||||
|
||||
UINT_STR uis ;
|
||||
UINT_STR uisa[6] ;
|
||||
UINT_STR uisaa[6][6] ;
|
||||
UINT_STR *uisp ;
|
||||
UINT_STR *uisp1 ;
|
||||
UINT_STR *uisp2 ;
|
||||
UINT_STR **uispp ;
|
||||
UINT_STR **uispp1 ;
|
||||
UINT_STR **uispp2 ;
|
||||
UINT_STR ***uisppp ;
|
||||
UINT_STR ***uisppp1 ;
|
||||
UINT_STR ***uisppp2 ;
|
||||
|
||||
LONG_STR ls ;
|
||||
LONG_STR lsa[6] ;
|
||||
LONG_STR lsaa[6][6] ;
|
||||
LONG_STR *lsp ;
|
||||
LONG_STR *lsp1 ;
|
||||
LONG_STR *lsp2 ;
|
||||
LONG_STR **lspp ;
|
||||
LONG_STR **lspp1 ;
|
||||
LONG_STR **lspp2 ;
|
||||
LONG_STR ***lsppp ;
|
||||
LONG_STR ***lsppp1 ;
|
||||
LONG_STR ***lsppp2 ;
|
||||
|
||||
ULONG_STR uls ;
|
||||
ULONG_STR ulsa[6] ;
|
||||
ULONG_STR ulsaa[6][6] ;
|
||||
ULONG_STR *ulsp ;
|
||||
ULONG_STR *ulsp1 ;
|
||||
ULONG_STR *ulsp2 ;
|
||||
ULONG_STR **ulspp ;
|
||||
ULONG_STR **ulspp1 ;
|
||||
ULONG_STR **ulspp2 ;
|
||||
ULONG_STR ***ulsppp ;
|
||||
ULONG_STR ***ulsppp1 ;
|
||||
ULONG_STR ***ulsppp2 ;
|
||||
|
||||
LONG_LONG_STR lls ;
|
||||
LONG_LONG_STR llsa[6] ;
|
||||
LONG_LONG_STR llsaa[6][6] ;
|
||||
LONG_LONG_STR *llsp ;
|
||||
LONG_LONG_STR *llsp1 ;
|
||||
LONG_LONG_STR *llsp2 ;
|
||||
LONG_LONG_STR **llspp ;
|
||||
LONG_LONG_STR **llspp1 ;
|
||||
LONG_LONG_STR **llspp2 ;
|
||||
LONG_LONG_STR ***llsppp ;
|
||||
LONG_LONG_STR ***llsppp1 ;
|
||||
LONG_LONG_STR ***llsppp2 ;
|
||||
|
||||
ULONG_LONG_STR ulls ;
|
||||
ULONG_LONG_STR ullsa[6] ;
|
||||
ULONG_LONG_STR ullsaa[6][6] ;
|
||||
ULONG_LONG_STR *ullsp ;
|
||||
ULONG_LONG_STR *ullsp1 ;
|
||||
ULONG_LONG_STR *ullsp2 ;
|
||||
ULONG_LONG_STR **ullspp ;
|
||||
ULONG_LONG_STR **ullspp1 ;
|
||||
ULONG_LONG_STR **ullspp2 ;
|
||||
ULONG_LONG_STR ***ullsppp ;
|
||||
ULONG_LONG_STR ***ullsppp1 ;
|
||||
ULONG_LONG_STR ***ullsppp2 ;
|
||||
|
||||
FLOAT_STR fs ;
|
||||
FLOAT_STR fsa[6] ;
|
||||
FLOAT_STR fsaa[6][6] ;
|
||||
FLOAT_STR *fsp ;
|
||||
FLOAT_STR *fsp1 ;
|
||||
FLOAT_STR *fsp2 ;
|
||||
FLOAT_STR **fspp ;
|
||||
FLOAT_STR **fspp1 ;
|
||||
FLOAT_STR **fspp2 ;
|
||||
FLOAT_STR ***fsppp ;
|
||||
FLOAT_STR ***fsppp1 ;
|
||||
FLOAT_STR ***fsppp2 ;
|
||||
|
||||
DOUBLE_STR ds ;
|
||||
DOUBLE_STR dsa[6] ;
|
||||
DOUBLE_STR dsaa[6][6] ;
|
||||
DOUBLE_STR *dsp ;
|
||||
DOUBLE_STR *dsp1 ;
|
||||
DOUBLE_STR *dsp2 ;
|
||||
DOUBLE_STR **dspp ;
|
||||
DOUBLE_STR **dspp1 ;
|
||||
DOUBLE_STR **dspp2 ;
|
||||
DOUBLE_STR ***dsppp ;
|
||||
DOUBLE_STR ***dsppp1 ;
|
||||
DOUBLE_STR ***dsppp2 ;
|
||||
|
||||
Flag fl ;
|
||||
Flag fla[10] ;
|
||||
Flag * flp ;
|
||||
} EVERYTHING ;
|
||||
|
||||
typedef struct LinkedList {
|
||||
|
||||
int i ;
|
||||
struct LinkedList * next ;
|
||||
struct LinkedList * prev ;
|
||||
|
||||
} LINKED_LIST ;
|
||||
|
||||
#endif
|
@ -1,34 +0,0 @@
|
||||
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Test ip)
|
||||
REFERENCES: (none)
|
||||
ASSUMPTIONS AND LIMITATIONS: (Autocreated by trick_ui)
|
||||
CLASS: (scheduled)
|
||||
LIBRARY DEPENDENCY: (ip.o)
|
||||
PROGRAMMERS: ((lin) (Thu Feb 27 14:57:16 CST 2003))
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: ip.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:12-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:56-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.2 2004/01/16 21:48:55 lin
|
||||
* Add a log to all files
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../include/ip.h"
|
||||
|
||||
int ip_test(
|
||||
/* RETURN: -- Always return zero */
|
||||
INT_STR* I) /* INOUT: -- Parameter */
|
||||
|
||||
{
|
||||
|
||||
return ( 0 );
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Test ip)
|
||||
REFERENCES: (none)
|
||||
ASSUMPTIONS AND LIMITATIONS: (Autocreated by trick_ui)
|
||||
CLASS: (initialization)
|
||||
LIBRARY DEPENDENCY: (ip.o)
|
||||
PROGRAMMERS: ((lin) (Thu Feb 27 14:57:16 CST 2003))
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: ip_test_init.c,v $
|
||||
* Revision 7.2 2006-08-15 15:54:44-05 hchen
|
||||
* SIM_ip2_test needs to be updated for new ip_alloc_type interface
|
||||
*
|
||||
* Revision 7.1 2006-06-22 14:14:12-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:56-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.2 2004/01/16 21:48:55 lin
|
||||
* Add a log to all files
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../include/ip.h"
|
||||
#include "sim_services/include/attributes.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
|
||||
extern ATTRIBUTES attrstruct_LinkedList[] ;
|
||||
|
||||
int ip_test_init(
|
||||
/* RETURN: -- Always return zero */
|
||||
LINKED_LIST** L) /* INOUT: -- Parameter */
|
||||
|
||||
{
|
||||
|
||||
LINKED_LIST * new_item ;
|
||||
|
||||
new_item = (LINKED_LIST *)ip_alloc_type( 1 , sizeof(LINKED_LIST), attrstruct_LinkedList, NULL ) ;
|
||||
new_item->i = 1000 ;
|
||||
|
||||
*L = new_item ;
|
||||
|
||||
new_item = (LINKED_LIST *)ip_alloc_type( 1 , sizeof(LINKED_LIST), attrstruct_LinkedList, NULL ) ;
|
||||
new_item->i = 2000 ;
|
||||
|
||||
new_item->prev = *L ;
|
||||
(*L)->next = new_item ;
|
||||
|
||||
new_item = (LINKED_LIST *)ip_alloc_type( 2 , sizeof(LINKED_LIST), attrstruct_LinkedList, NULL ) ;
|
||||
new_item->i = 500 ;
|
||||
new_item[1].i = 501 ;
|
||||
|
||||
new_item = (LINKED_LIST *)ip_realloc( (char *)new_item , 8 , sizeof(LINKED_LIST)) ;
|
||||
new_item->prev = *L ;
|
||||
(*L)->next->next = new_item ;
|
||||
new_item[2].i = 502 ;
|
||||
new_item[3].i = 503 ;
|
||||
new_item[4].i = 504 ;
|
||||
new_item[5].i = 505 ;
|
||||
new_item[6].i = 506 ;
|
||||
|
||||
/*
|
||||
new_item = (LINKED_LIST *)ip_alloc( 1 , sizeof(LINKED_LIST), attrLINKED_LIST ) ;
|
||||
new_item->i = 500 ;
|
||||
|
||||
(*L)->prev = new_item ;
|
||||
|
||||
new_item = (LINKED_LIST *)ip_alloc( 1 , sizeof(LINKED_LIST), attrLINKED_LIST ) ;
|
||||
new_item->i = 4000 ;
|
||||
|
||||
(*L)->next->next = new_item ;
|
||||
*/
|
||||
|
||||
return ( 0 );
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
62466 2 ./src/sched_amf.c
|
||||
56063 2 ./src/sched_async.c
|
||||
58898 2 ./src/sched_deriv.c
|
||||
40625 4 ./src/sched_dyn_event.c
|
||||
1862 3 ./src/sched_effector.c
|
||||
60196 2 ./src/sched_effector_emitter.c
|
||||
60562 2 ./src/sched_effector_receiver.c
|
||||
63000 2 ./src/sched_environment.c
|
||||
49220 2 ./src/sched_init.c
|
||||
23169 3 ./src/sched_integ.c
|
||||
56365 2 ./src/sched_logging.c
|
||||
57176 2 ./src/sched_scheduled.c
|
||||
56062 2 ./src/sched_sensor.c
|
||||
59482 2 ./src/sched_sensor_emitter.c
|
||||
59798 2 ./src/sched_sensor_receiver.c
|
||||
60444 2 ./src/sched_sensor_reflector.c
|
||||
58851 2 ./include/sched.d
|
||||
12435 3 ./include/sched.h
|
||||
32231 3 ./include/sched_integ.d
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* $Log: sched.d,v $
|
||||
* Revision 7.1 2006-06-22 14:14:10-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:56-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:17 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.4 2003/08/26 20:24:13 vetter
|
||||
* Add Dynamic Event Class To SIM_test_sched
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:28 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
SCHEDULE.pos = 5.0 ;
|
||||
SCHEDULE.vel = 0.0 ;
|
||||
SCHEDULE.acc = 0.0 ;
|
||||
SCHEDULE.mass = 1.0 ;
|
||||
SCHEDULE.amf = 1 ;
|
||||
SCHEDULE.amf_error = 0 ;
|
||||
|
||||
#define BIG_TGO 10000
|
||||
SCHEDULE.rf.lower_set = No ;
|
||||
SCHEDULE.rf.upper_set = No ;
|
||||
SCHEDULE.rf.iterations = 0 ;
|
||||
SCHEDULE.rf.fires = 0 ;
|
||||
SCHEDULE.rf.x_lower = BIG_TGO ;
|
||||
SCHEDULE.rf.t_lower = BIG_TGO ;
|
||||
SCHEDULE.rf.x_upper = BIG_TGO ;
|
||||
SCHEDULE.rf.t_upper = BIG_TGO ;
|
||||
SCHEDULE.rf.delta_time = BIG_TGO ;
|
||||
SCHEDULE.rf.error_tol = 1.0e-6 ;
|
||||
SCHEDULE.rf.mode = Increasing ;
|
@ -1,45 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Scheduling test )
|
||||
REFERENCES: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched.h,v $
|
||||
* Revision 7.1 2006-06-22 14:14:10-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:57-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:17 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.4 2003/08/26 20:24:14 vetter
|
||||
* Add Dynamic Event Class To SIM_test_sched
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:28 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SCHEDULE_H_
|
||||
#define _SCHEDULE_H_
|
||||
|
||||
#include "sim_services/include/regula_falsi.h"
|
||||
|
||||
typedef struct { /* SCHEDULE ------------------------------------------------*/
|
||||
|
||||
double pos ; /* M Position */
|
||||
double vel ; /* M/s Velocity */
|
||||
double acc ; /* M/s2 Acceleration */
|
||||
double mass ; /* kg Mass */
|
||||
int amf ; /* -- Just a test variable */
|
||||
int amf_error ; /* -- Order error occured in amf job */
|
||||
REGULA_FALSI rf ; /* -- Dynamic event */
|
||||
|
||||
} SCHEDULE ; /*--------------------------------------------------------------*/
|
||||
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE:
|
||||
(Ball model state integrator default initialization data.)
|
||||
REFERENCE:
|
||||
(((Bailey, R.W, and Paddock, E.J.)
|
||||
(Trick Simulation Environment) (NASA:JSC #37943)
|
||||
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
|
||||
(March 1997)))
|
||||
ASSUMPTIONS AND LIMITATIONS:
|
||||
((2 dimensional space))
|
||||
PROGRAMMERS:
|
||||
(((Your Name) (Company Name) (Date) (Trick tutorial)))
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_integ.d,v $
|
||||
* Revision 7.3 2007-11-06 10:39:22-06 hchen
|
||||
* Change the way of defining a variable in some .d files related to old style allocation and fix some typos
|
||||
*
|
||||
* Revision 7.2 2007-10-23 11:53:06-05 hchen
|
||||
* Convert the old style allocation statements we have in included sims
|
||||
*
|
||||
* Revision 7.1 2006-06-22 14:14:11-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:57-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:18 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.2 2002/10/07 15:16:29 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#define NUM_STEP 12 /* use up to 12 intermediate steps:
|
||||
8th order RK Fehlberg */
|
||||
#define NUM_VARIABLES 4 /* x,y position state and x,y velocity state */
|
||||
|
||||
INTEGRATOR.state = alloc(NUM_VARIABLES) ;
|
||||
INTEGRATOR.deriv = alloc(NUM_STEP) ;
|
||||
INTEGRATOR.state_ws = alloc(NUM_STEP) ;
|
||||
|
||||
for (int kk = 0 ; kk < NUM_STEP ; kk++ ) {
|
||||
INTEGRATOR.deriv[kk] = alloc(NUM_VARIABLES) ;
|
||||
INTEGRATOR.state_ws[kk] = alloc(NUM_VARIABLES) ;
|
||||
}
|
||||
|
||||
INTEGRATOR.num_state = NUM_VARIABLES ;
|
||||
INTEGRATOR.option = Runge_Kutta_4 ; /* 4rth order Runge Kutta */
|
||||
INTEGRATOR.init = True ;
|
||||
INTEGRATOR.first_step_deriv = Yes ;
|
||||
|
||||
#undef NUM_STEP
|
||||
#undef NUM_VARIABLES
|
@ -1,43 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( asynchronous_mustfinish )
|
||||
LIBRARY DEPENDENCY: ( sched_amf.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_amf.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:04-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:57-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:13 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:29 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
int sched_amf(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
if ( S->amf == 2 ) {
|
||||
/* Things are in order */
|
||||
S->amf = 1 ;
|
||||
} else {
|
||||
/* Things are out of order */
|
||||
S->amf = 3 ;
|
||||
S->amf_error = 1 ;
|
||||
}
|
||||
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( asynchronous )
|
||||
LIBRARY DEPENDENCY: ( sched_async.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_async.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:04-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:58-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:13 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.4 2002/10/07 15:16:30 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
int sched_async (
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
|
||||
while ( 1 ) {
|
||||
/* Try and hang the sim... */
|
||||
usleep(1000000) ;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( derivative )
|
||||
LIBRARY DEPENDENCY: ( sched_deriv.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) (Trick tutorial) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_deriv.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:04-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:58-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:13 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:30 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sim_services/include/integrator.h"
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_deriv(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->acc = -1 * S->pos * S->mass ;
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/******************************* TRICK HEADER *******************************
|
||||
PURPOSE: (Test regula falsi )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( A program has to know its limitations,
|
||||
that is my assumption :P )
|
||||
CLASS: (dynamic_event)
|
||||
LIBRARY DEPENDENCY: (sched_dyn_event.o)
|
||||
PROGRAMMERS: ( Keith Vetter a.k.a brillo )
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_dyn_event.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:05-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.2 2006-04-13 14:39:47-05 jkowing
|
||||
* Export functions to header files.
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:58-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.2 2004/01/16 21:48:56 lin
|
||||
* Add a log to all files
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../include/sched.h"
|
||||
#include "sim_services/include/regula_falsi.h"
|
||||
|
||||
double sched_dyn_event(
|
||||
/* RETURN: s Time to go to event */
|
||||
SCHEDULE * S , /* INOUT: -- */
|
||||
double *time , /* IN: s Integrator time from the executive */
|
||||
int *event_evaluate_tgo ) /* IN: -- Event time to go function eval flag,
|
||||
1 = evaluate time to go for event,
|
||||
0 = fire event */
|
||||
{
|
||||
|
||||
double tgo ;
|
||||
|
||||
if( *event_evaluate_tgo ) {
|
||||
|
||||
/* CALCULATE TIME TO GO FOR EVENT */
|
||||
S->rf.error = S->mass - 1.2 ;
|
||||
tgo = regula_falsi( *time , &(S->rf) ) ;
|
||||
|
||||
} else {
|
||||
|
||||
/* FIRE EVENT */
|
||||
reset_regula_falsi( *time , &(S->rf) ) ;
|
||||
tgo = 0.0 ;
|
||||
|
||||
/* Make mass zig zag once it hits 1.2kg */
|
||||
S->mass = S->mass - 0.01 ;
|
||||
}
|
||||
|
||||
return( tgo ) ;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( effector )
|
||||
LIBRARY DEPENDENCY: ( sched_effector.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_effector.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:05-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:58-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:14 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.4 2002/10/07 15:16:30 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_effector(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.0000002 + 0.00000002 ; /* Sensor is collecting dust */
|
||||
|
||||
if ( S->amf == 1 ) {
|
||||
/* Things are good */
|
||||
S->amf = 2 ;
|
||||
} else {
|
||||
/* Things are out of order */
|
||||
S->amf = 3 ;
|
||||
S->amf_error = 1 ;
|
||||
}
|
||||
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( effector_emitter )
|
||||
LIBRARY DEPENDENCY: ( sched_effector_emitter.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_effector_emitter.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:06-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:59-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:14 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:31 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_effector_emitter(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000003 + 0.000003 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( effector_receiver )
|
||||
LIBRARY DEPENDENCY: ( sched_effector_receiver.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_effector_receiver.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:06-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:59-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:14 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:31 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_effector_receiver(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000004 + 0.000004 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( environment )
|
||||
LIBRARY DEPENDENCY: ( sched_environment.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_environment.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:06-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:59-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:15 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:31 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sim_services/include/integrator.h"
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_environment(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000005 + 0.000005 ; /* Mass growing, dust collection :-) */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Test sched_init)
|
||||
REFERENCES: (none)
|
||||
ASSUMPTIONS AND LIMITATIONS: (Autocreated by trick_ui)
|
||||
CLASS: (initialization)
|
||||
LIBRARY DEPENDENCY: (sched_init.o)
|
||||
PROGRAMMERS: ((vetter) (Tue Aug 26 13:22:44 CDT 2003))
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_init.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:07-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:06:59-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.2 2004/01/16 21:48:56 lin
|
||||
* Add a log to all files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
int sched_init(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S) /* INOUT: -- Parameter */
|
||||
|
||||
{
|
||||
S->mass = S->mass*1.0000013 + 0.0000013 ; /* Massive masses */
|
||||
return(0) ;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( integration )
|
||||
LIBRARY DEPENDENCY: ( sched_integ.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) (Trick tutorial) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_integ.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:07-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.2 2006-04-13 14:39:48-05 jkowing
|
||||
* Export functions to header files.
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:00-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:15 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:32 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sim_services/include/integrator.h"
|
||||
#include "../include/sched.h"
|
||||
|
||||
int sched_integ(
|
||||
/* RETURN: -- Always return zero */
|
||||
INTEGRATOR *I , /* INOUT: -- Trick state integration parameters */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
I->state[0] = S->pos ;
|
||||
I->state[1] = S->vel ;
|
||||
|
||||
I->deriv[I->intermediate_step][0] = S->vel ;
|
||||
I->deriv[I->intermediate_step][1] = S->acc ;
|
||||
|
||||
integrate( I ) ;
|
||||
|
||||
S->pos = I->state_ws[I->intermediate_step][0] ;
|
||||
S->vel = I->state_ws[I->intermediate_step][1] ;
|
||||
|
||||
return( I->intermediate_step );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( logging )
|
||||
LIBRARY DEPENDENCY: ( sched_logging.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_logging.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:08-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:00-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:15 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.4 2002/10/07 15:16:32 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
int sched_logging(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000006 + 0.000006 ; /* Sensor is collecting dust */
|
||||
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( scheduled )
|
||||
LIBRARY DEPENDENCY: ( sched_scheduled.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_scheduled.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:08-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:00-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:16 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:33 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_scheduled(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000007 + 0.000007 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( sensor )
|
||||
LIBRARY DEPENDENCY: ( sched_sensor.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_sensor.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:08-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:01-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:16 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:33 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_sensor(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000008 + 0.000008 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( sensor_emitter )
|
||||
LIBRARY DEPENDENCY: ( sched_sensor_emitter.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_sensor_emitter.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:09-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:01-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:16 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:33 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
int sched_sensor_emitter(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.000009 + 0.000009 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( sensor_receiver )
|
||||
LIBRARY DEPENDENCY: ( sched_sensor_receiver.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_sensor_receiver.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:09-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:01-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:17 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:34 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_sensor_receiver(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.00021 + 0.000021 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/********************************* TRICK HEADER *******************************
|
||||
PURPOSE: ( Test scheduling )
|
||||
REFERENCE: ( None )
|
||||
ASSUMPTIONS AND LIMITATIONS: ( None )
|
||||
CLASS: ( sensor_reflector )
|
||||
LIBRARY DEPENDENCY: ( sched_sensor_reflector.o )
|
||||
PROGRAMMERS: ( (Keith Vetter) (Titan) (8-20-2002) )
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: sched_sensor_reflector.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:10-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.1 2004-08-05 13:07:01-05 lin
|
||||
* Bump
|
||||
*
|
||||
* Revision 4.1 2003/10/21 21:49:17 lin
|
||||
* Bump version number for 04
|
||||
*
|
||||
* Revision 1.3 2002/10/07 15:16:34 lin
|
||||
* Add rcs version info to all trick_models files
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/sched.h"
|
||||
|
||||
|
||||
int sched_sensor_reflector(
|
||||
/* RETURN: -- Always return zero */
|
||||
SCHEDULE *S ) /* INOUT: -- Schedule struct */
|
||||
{
|
||||
S->mass = S->mass*1.00000022 + 0.0000022 ; /* Sensor is collecting dust */
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
TEST1.i = 1;
|
||||
TEST1.ui = 2;
|
||||
TEST1.d = 3.0;
|
||||
TEST1.ss.si = 4;
|
||||
TEST1.ip = &TEST1.i5;
|
||||
TEST1.da[0] = 1.0;
|
||||
TEST1.da[1] = 2.0;
|
||||
TEST1.da[2] = 3.0;
|
||||
TEST1.da[3] = 4.0;
|
||||
TEST1.da[4] = 5.0;
|
||||
TEST1.da[0] = 5, 4, 3, 2, 1 ;
|
||||
TEST1.dap = &TEST1.da;
|
||||
TEST1.s[0] = "default";
|
||||
|
||||
TEST1.i5 = 5;
|
||||
TEST1.i55 = 55;
|
||||
TEST1.i555 = 555;
|
@ -1,26 +0,0 @@
|
||||
/******************************************************************************
|
||||
PURPOSE: (Tests requirements: 3.1.2.9, 3.1.2.9.1-5)
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _test1_h_
|
||||
#define _test1_h_
|
||||
|
||||
typedef struct {
|
||||
int si;
|
||||
} SS;
|
||||
|
||||
typedef struct {
|
||||
int i;
|
||||
unsigned int ui;
|
||||
double d;
|
||||
SS ss;
|
||||
int* ip;
|
||||
double da[5];
|
||||
double* dap;
|
||||
char s[15];
|
||||
int i5;
|
||||
int i55;
|
||||
int i555;
|
||||
} TEST1;
|
||||
|
||||
#endif
|
@ -1,14 +0,0 @@
|
||||
/*****************************************************************************
|
||||
PURPOSE: ( TEST 1 )
|
||||
*****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../include/test1.h"
|
||||
|
||||
int test1_cyclic(TEST1* T) {
|
||||
|
||||
fprintf(stdout,"test1_cyclic.\n");
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*******************************************************************************
|
||||
PURPOSE: (Initialize test 1.)
|
||||
*******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../include/test1.h"
|
||||
|
||||
int test1_init(TEST1* T) {
|
||||
printf("*****************Initialization routine*****************\n");
|
||||
printf("Changing i from %d to %d\n", T->i, 11);
|
||||
T->i = 11;
|
||||
printf("Changing ui from %u to %u\n", T->ui, 22);
|
||||
T->ui = 22;
|
||||
printf("Changing d from %f to %f\n", T->d, 33.0);
|
||||
T->d = 33.0;
|
||||
printf("Changing ss.si from %d to %d\n", T->ss.si, 44);
|
||||
T->ss.si = 44;
|
||||
printf("Changing ip from %d to %d\n", *(T->ip), T->i55);
|
||||
T->ip = &T->i55;
|
||||
printf("Changing da from {%f, %f, %f, %f, %f} to {%f, %f, %f, %f, %f}\n",
|
||||
T->da[0], T->da[1], T->da[2], T->da[3], T->da[4],
|
||||
11.0, 22.0, 33.0, 44.0, 55.0);
|
||||
T->da[0] = 11.0;
|
||||
T->da[1] = 22.0;
|
||||
T->da[2] = 33.0;
|
||||
T->da[3] = 44.0;
|
||||
T->da[4] = 55.0;
|
||||
printf("Changing dap from %f to %f\n", *(T->dap), T->da[1]);
|
||||
T->dap = &T->da[1];
|
||||
printf("Changing s from '%s' to '%s'\n", T->s, "initialization");
|
||||
strcpy(T->s, "initialization");
|
||||
return(0);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*******************************************************************************
|
||||
PURPOSE: (Shutdown test 1.)
|
||||
*******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../include/test1.h"
|
||||
|
||||
int test1_shutdown(TEST1* T) {
|
||||
printf("********************Shutdown routine********************\n");
|
||||
printf("Changing i from %d to %d\n", T->i, 111);
|
||||
T->i = 111;
|
||||
printf("Changing ui from %u to %u\n", T->ui, 222);
|
||||
T->ui = 222;
|
||||
printf("Changing d from %f to %f\n", T->d, 333.0);
|
||||
T->d = 333.0;
|
||||
printf("Changing ss.si from %d to %d\n", T->ss.si, 444);
|
||||
T->ss.si = 444;
|
||||
printf("Changing ip from %d to %d\n", *(T->ip), T->i555);
|
||||
T->ip = &T->i555;
|
||||
printf("Changing da from {%f, %f, %f, %f, %f} to {%f, %f, %f, %f, %f}\n",
|
||||
T->da[0], T->da[1], T->da[2], T->da[3], T->da[4],
|
||||
111.0, 222.0, 333.0, 444.0, 555.0);
|
||||
T->da[0] = 111.0;
|
||||
T->da[1] = 222.0;
|
||||
T->da[2] = 333.0;
|
||||
T->da[3] = 444.0;
|
||||
T->da[4] = 555.0;
|
||||
printf("Changing dap from %f to %f\n", *(T->dap), T->da[2]);
|
||||
T->dap = &T->da[2];
|
||||
printf("Changing s from '%s' to '%s'\n", T->s, "shutdown");
|
||||
strcpy(T->s, "shutdown");
|
||||
return(0);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
17061 3 ./src/cannon_collect_forces.c
|
||||
64314 2 ./src/cannon_force_cross.c
|
||||
44875 2 ./src/cannon_force_drag.c
|
||||
28198 1 ./src/cannon_force_gravity.c
|
||||
40698 2 ./src/cannon_force_jet.c
|
||||
60736 4 ./src/cannon_force_lift.c
|
||||
25578 3 ./src/cannon_impact_aero.c
|
||||
25704 3 ./src/cannon_impact_monte.c
|
||||
45188 2 ./src/cannon_init_aero.c
|
||||
42698 4 ./src/cannon_integ_aero.c
|
||||
62286 2 ./src/cannon_jet_control.c
|
||||
64436 2 ./include/cannon_aero.d
|
||||
51825 7 ./include/cannon_aero.h
|
||||
31342 1 ./include/cannon_integ_aero.d
|
@ -1,30 +0,0 @@
|
||||
CANNON_AERO.slave_init = 0;
|
||||
CANNON_AERO.slave_shutdown = 0;
|
||||
CANNON_AERO.master_shutdown = 0;
|
||||
|
||||
|
||||
|
||||
/* Initialize cannon ball shot */
|
||||
CANNON_AERO.lift_method = Smits_Smith ;
|
||||
CANNON_AERO.coefficient_drag = 0.45 ;
|
||||
CANNON_AERO.coefficient_cross = 0.044 ;
|
||||
CANNON_AERO.mass = 0.145 ;
|
||||
CANNON_AERO.air_density = 1.29 ;
|
||||
CANNON_AERO.ball_radius {cm} = 3.63 ;
|
||||
CANNON_AERO.ball_area {cm2} = 41.59 ;
|
||||
CANNON_AERO.g = -9.81 ;
|
||||
CANNON_AERO.force_jet_Z_plus {lbf} = 2.0 ;
|
||||
|
||||
/* Regula Falsi impact critter setup */
|
||||
#define BIG_TGO 10000
|
||||
CANNON_AERO.rf.lower_set = No ;
|
||||
CANNON_AERO.rf.upper_set = No ;
|
||||
CANNON_AERO.rf.iterations = 0 ;
|
||||
CANNON_AERO.rf.fires = 0 ;
|
||||
CANNON_AERO.rf.x_lower = BIG_TGO ;
|
||||
CANNON_AERO.rf.t_lower = BIG_TGO ;
|
||||
CANNON_AERO.rf.x_upper = BIG_TGO ;
|
||||
CANNON_AERO.rf.t_upper = BIG_TGO ;
|
||||
CANNON_AERO.rf.delta_time = BIG_TGO ;
|
||||
CANNON_AERO.rf.error_tol = 1.0e-9 ;
|
||||
CANNON_AERO.rf.mode = Decreasing ;
|
@ -1,76 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Tests requirements: 3.1.2.13.2)
|
||||
***************************************************************************/
|
||||
#ifndef _cannon_aero_h_
|
||||
#define _cannon_aero_h_
|
||||
|
||||
#include "sim_services/include/regula_falsi.h"
|
||||
|
||||
typedef enum {
|
||||
Hard_Coded_Coefficient_Lift, /* You come up with Cl */
|
||||
Smits_Smith, /* Cl ~= 0.54*S^0.4 (S = rw/V) */
|
||||
Adair_Giordano, /* Lift_Force = mass*0.00041*w_cross_V */
|
||||
Tombras /* Cl = 1/(2.022 + 0.981v/w) */
|
||||
} Lift_Estimation_Method ;
|
||||
|
||||
typedef struct {
|
||||
|
||||
int slave_init;
|
||||
int slave_shutdown;
|
||||
int master_shutdown;
|
||||
|
||||
double pos[3] ; /* M position */
|
||||
double vel[3] ; /* M/s velocity */
|
||||
double acc[3] ; /* M/s2 acceleration */
|
||||
double omega[3] ; /* r/s Angular velocity of cannonball */
|
||||
|
||||
double theta ; /* r Angle from x-axis to axis rotation */
|
||||
double phi ; /* r Angle from z-axis to axis rotation */
|
||||
double omega0 ; /* r/s Magnitude of angular velocity about
|
||||
axis of rotation */
|
||||
/* Impact */
|
||||
REGULA_FALSI rf ; /* -- Dynamic event params for impact */
|
||||
int impact ; /* -- Has impact occured */
|
||||
double impact_pos ; /* M How far ball lands in field */
|
||||
|
||||
/* Forces */
|
||||
double force_gravity[3] ; /* N Gravitational force */
|
||||
double force_drag[3] ; /* N Drag force opposite dir of velocity */
|
||||
double force_magnus[3] ; /* N Force due to spin, dir grav cross drag */
|
||||
double force_cross[3] ; /* N Side directional force */
|
||||
double force_total[3] ; /* N Sum of all forces */
|
||||
|
||||
/* Force magnitudes */
|
||||
double mag_force_drag ; /* N Magnitude of drag force */
|
||||
double mag_force_magnus ; /* N Magnitude of magnus force */
|
||||
double mag_force_cross ; /* N Magnitude of cross force */
|
||||
double mag_omega ; /* r/s Magnitude of angular velocity */
|
||||
|
||||
void** force_collect ; /* -- For collect statement */
|
||||
|
||||
/* Environment and Properties */
|
||||
double mass ; /* kg Mass of cannonball */
|
||||
double air_density ; /* kg/M3 Air density at 20C */
|
||||
double ball_radius ; /* M Radius of cannonball */
|
||||
double ball_area ; /* M2 Cross sectional area of ball */
|
||||
double spin_parameter ; /* -- S=r*omega/speed */
|
||||
double g ; /* M/s2 Gravitational acceleration */
|
||||
|
||||
/* Coefficients drag, lift and cross */
|
||||
Lift_Estimation_Method lift_method ; /* -- How to find lift force */
|
||||
double coefficient_drag ; /* -- Drag coefficient */
|
||||
double coefficient_lift ; /* -- Lift coefficient */
|
||||
double coefficient_cross ; /* -- Cross-Force coefficient */
|
||||
|
||||
/* Jet */
|
||||
int jet_on ; /* -- 0|1 */
|
||||
int jet_count ; /* -- How many jet firings? */
|
||||
double force_jet[3] ; /* N Jet force per firing */
|
||||
double force_jet_Z_plus ; /* N Configurable force of jet in Z+ direction */
|
||||
double time_to_fire_jet_1 ; /* s First jet firing time */
|
||||
double time_to_fire_jet_2 ; /* s Second jet firing time */
|
||||
double time_to_fire_jet_3 ; /* s Third jet firing time */
|
||||
double time_to_fire_jet_4 ; /* s Fourth jet firing time */
|
||||
|
||||
} CANNON_AERO ;
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
#define NUM_STEP 12
|
||||
#define NUM_VARIABLES 6
|
||||
|
||||
INTEGRATOR.state = alloc(NUM_VARIABLES) ;
|
||||
INTEGRATOR.deriv = alloc(NUM_STEP) ;
|
||||
INTEGRATOR.state_ws = alloc(NUM_STEP) ;
|
||||
|
||||
for (int kk = 0 ; kk < NUM_STEP ; kk++ ) {
|
||||
INTEGRATOR.deriv[kk] = alloc(NUM_VARIABLES) ;
|
||||
INTEGRATOR.state_ws[kk] = alloc(NUM_VARIABLES) ;
|
||||
}
|
||||
|
||||
INTEGRATOR.stored_data = alloc(8) ;
|
||||
for (int kk = 0 ; kk < 8 ; kk++ ) {
|
||||
INTEGRATOR.stored_data[kk] = alloc(NUM_VARIABLES) ;
|
||||
}
|
||||
|
||||
INTEGRATOR.option = Runge_Kutta_4 ;
|
||||
INTEGRATOR.init = True ;
|
||||
INTEGRATOR.first_step_deriv = Yes ;
|
||||
INTEGRATOR.num_state = NUM_VARIABLES ;
|
||||
|
||||
#undef NUM_STEP
|
||||
#undef NUM_VARIABLES
|
@ -1,31 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Collect all forces and calculate acceleration)
|
||||
***************************************************************************/
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "sim_services/include/collect_macros.h"
|
||||
|
||||
int cannon_collect_forces(
|
||||
CANNON_AERO *C )
|
||||
{
|
||||
double **collected_forces ;
|
||||
int ii ;
|
||||
|
||||
/* Collect external forces on the ball */
|
||||
collected_forces = (double**)(C->force_collect) ;
|
||||
C->force_total[0] = 0.0 ;
|
||||
C->force_total[1] = 0.0 ;
|
||||
C->force_total[2] = 0.0 ;
|
||||
for( ii = 0 ; ii < NUM_COLLECT(collected_forces) ; ii++ ) {
|
||||
C->force_total[0] += collected_forces[ii][0] ;
|
||||
C->force_total[1] += collected_forces[ii][1] ;
|
||||
C->force_total[2] += collected_forces[ii][2] ;
|
||||
}
|
||||
|
||||
/* Solve for xyz acceleration */
|
||||
C->acc[0] = C->force_total[0] / C->mass ;
|
||||
C->acc[1] = C->force_total[1] / C->mass ;
|
||||
C->acc[2] = C->force_total[2] / C->mass ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Cross Force or Side Force )
|
||||
***************************************************************************/
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "trick_utils/math/include/trick_math.h"
|
||||
|
||||
int cannon_force_cross(
|
||||
CANNON_AERO *C )
|
||||
{
|
||||
double magnus_cross_drag[3] ;
|
||||
double norm_magnus_cross_drag[3] ;
|
||||
double k, speed ;
|
||||
|
||||
/* k = 1/2*rho*Cy*A*V^2 */
|
||||
speed = V_MAG( C->vel ) ;
|
||||
k = (-0.5)*C->air_density*C->coefficient_cross*C->ball_area*speed*speed ;
|
||||
|
||||
/* F = k*(M x D)/|M x D| */
|
||||
V_CROSS( magnus_cross_drag, C->force_magnus, C->force_drag ) ;
|
||||
V_NORM( norm_magnus_cross_drag, magnus_cross_drag ) ;
|
||||
V_SCALE( C->force_cross, norm_magnus_cross_drag, k) ;
|
||||
|
||||
C->mag_force_cross = V_MAG( C->force_cross ) ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Drag force)
|
||||
***************************************************************************/
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "trick_utils/math/include/trick_math.h"
|
||||
|
||||
int cannon_force_drag(
|
||||
CANNON_AERO *C )
|
||||
{
|
||||
double k ;
|
||||
double speed ;
|
||||
|
||||
speed = V_MAG( C->vel ) ;
|
||||
|
||||
/* k = -1/2*rho*Cd*A*|V| */
|
||||
k = (-0.5)*C->air_density*C->coefficient_drag*C->ball_area*speed ;
|
||||
|
||||
/* Force_drag = k*V = -1/2*rho*Cd*A*|V|*V */
|
||||
V_SCALE( C->force_drag, C->vel, k ) ;
|
||||
|
||||
C->mag_force_drag = V_MAG( C->force_drag ) ;
|
||||
|
||||
return 0 ;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: ( Gravitational force on cannonball )
|
||||
***************************************************************************/
|
||||
#include "../include/cannon_aero.h"
|
||||
|
||||
int cannon_force_gravity(
|
||||
CANNON_AERO *C )
|
||||
{
|
||||
C->force_gravity[0] = 0.0 ;
|
||||
C->force_gravity[1] = 0.0 ;
|
||||
C->force_gravity[2] = C->mass*C->g ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: ( Jet fire force )
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* $Log: cannon_force_jet.c,v $
|
||||
* Revision 7.1 2006-06-22 14:14:48-05 lin
|
||||
* Bump version number for 07
|
||||
*
|
||||
* Revision 5.2 2004-08-18 10:49:42-05 lin
|
||||
* Cleanup cannon_force_jet() In Tutorial
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/cannon_aero.h"
|
||||
|
||||
int cannon_force_jet(
|
||||
CANNON_AERO *C )
|
||||
{
|
||||
if ( C->jet_on && C->jet_count < 4 ) {
|
||||
C->force_jet[2] = C->force_jet_Z_plus ;
|
||||
C->jet_count++ ;
|
||||
C->jet_on = 0 ;
|
||||
} else {
|
||||
C->force_jet[2] = 0.0 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Lift-Magnus Force)
|
||||
***************************************************************************/
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "trick_utils/math/include/trick_math.h"
|
||||
|
||||
int cannon_force_lift(
|
||||
CANNON_AERO *C )
|
||||
{
|
||||
double w_cross_v[3] ; double norm_w_cross_v[3] ;
|
||||
double k, speed ;
|
||||
|
||||
speed = V_MAG( C->vel ) ;
|
||||
|
||||
if ( speed != 0.0 ) {
|
||||
C->spin_parameter = C->ball_radius*V_MAG( C->omega )/speed ;
|
||||
} else {
|
||||
C->spin_parameter = 0.0000000001 ;
|
||||
}
|
||||
|
||||
if ( C->lift_method == Smits_Smith ) {
|
||||
C->coefficient_lift = (0.54)*pow(C->spin_parameter, 0.4) ;
|
||||
}
|
||||
|
||||
if ( C->lift_method == Tombras ) {
|
||||
C->coefficient_lift = 1/( 2.022 + 0.981*speed/V_MAG( C->omega));
|
||||
}
|
||||
|
||||
switch ( C->lift_method ) {
|
||||
|
||||
case Hard_Coded_Coefficient_Lift:
|
||||
case Smits_Smith:
|
||||
case Tombras:
|
||||
|
||||
/* k = 1/2*rho*Cl*A*V^2 */
|
||||
k = (0.5)*C->air_density*C->coefficient_lift*
|
||||
C->ball_area*speed*speed ;
|
||||
|
||||
/* F = k*(w x V)/|w x V| */
|
||||
V_CROSS( w_cross_v, C->omega, C->vel ) ;
|
||||
V_NORM( norm_w_cross_v, w_cross_v ) ;
|
||||
V_SCALE( C->force_magnus, norm_w_cross_v, k) ;
|
||||
|
||||
break ;
|
||||
|
||||
case Adair_Giordano:
|
||||
|
||||
V_CROSS( w_cross_v, C->omega, C->vel ) ;
|
||||
k = 0.00041*C->mass ;
|
||||
V_SCALE( C->force_magnus, w_cross_v, k) ;
|
||||
|
||||
/* Backwards calculation for Cl */
|
||||
C->coefficient_lift = (2*k*V_MAG(w_cross_v))/
|
||||
(C->air_density*C->ball_area*speed*speed) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
C->mag_force_magnus = V_MAG( C->force_magnus ) ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Kaboom!!!)
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "sim_services/include/executive.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
#include "sim_services/include/regula_falsi.h"
|
||||
#include "sim_services/include/dr_proto.h"
|
||||
|
||||
double cannon_impact_aero(
|
||||
|
||||
CANNON_AERO* C,
|
||||
double* time,
|
||||
int *event_evaluate_tgo )
|
||||
|
||||
{
|
||||
double tgo ;
|
||||
|
||||
EXECUTIVE* E ;
|
||||
E = exec_get_exec();
|
||||
|
||||
if( *event_evaluate_tgo ) {
|
||||
|
||||
/* Calculate time to go before impact */
|
||||
C->rf.error = C->pos[0] ;
|
||||
tgo = regula_falsi( *time , &(C->rf) ) ;
|
||||
|
||||
} else {
|
||||
|
||||
/* Ball impact */
|
||||
|
||||
reset_regula_falsi( *time , &(C->rf) ) ;
|
||||
tgo = 0.0 ;
|
||||
|
||||
C->vel[0] = 0.0 ; C->vel[1] = 0.0 ; C->vel[2] = 0.0 ;
|
||||
C->acc[0] = 0.0 ; C->acc[1] = 0.0 ; C->acc[2] = 0.0 ;
|
||||
C->g = 0.0 ;
|
||||
|
||||
fprintf(stderr, "Impact time, pos : %.9lf %.9lf\n",
|
||||
*time, C->pos[0] );
|
||||
|
||||
dr_record_binary( &E->record, &E->record.group[0], *time);
|
||||
}
|
||||
|
||||
return( tgo ) ;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Kaboom!!!)
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "sim_services/include/executive.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
#include "sim_services/include/regula_falsi.h"
|
||||
#include "sim_services/include/dr_proto.h"
|
||||
|
||||
double cannon_impact_monte(
|
||||
|
||||
CANNON_AERO* C,
|
||||
double* time,
|
||||
int *event_evaluate_tgo )
|
||||
|
||||
{
|
||||
double tgo ;
|
||||
|
||||
EXECUTIVE* E ;
|
||||
E = exec_get_exec();
|
||||
|
||||
if( *event_evaluate_tgo ) {
|
||||
|
||||
/* Calculate time to go before impact */
|
||||
C->rf.error = C->pos[2] ;
|
||||
tgo = regula_falsi( *time , &(C->rf) ) ;
|
||||
|
||||
} else {
|
||||
|
||||
/* Ball impact */
|
||||
|
||||
reset_regula_falsi( *time , &(C->rf) ) ;
|
||||
tgo = 0.0 ;
|
||||
|
||||
C->vel[0] = 0.0 ; C->vel[1] = 0.0 ; C->vel[2] = 0.0 ;
|
||||
C->acc[0] = 0.0 ; C->acc[1] = 0.0 ; C->acc[2] = 0.0 ;
|
||||
C->g = 0.0 ;
|
||||
|
||||
fprintf(stderr, "Impact time, pos : %.9lf %.9lf\n",
|
||||
*time, C->pos[0] );
|
||||
|
||||
dr_record_binary( &E->record.group[0], *time);
|
||||
}
|
||||
|
||||
return( tgo ) ;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: ( Cannon initialization )
|
||||
***************************************************************************/
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "trick_utils/math/include/trick_math.h"
|
||||
|
||||
int cannon_init_aero(
|
||||
CANNON_AERO* C)
|
||||
{
|
||||
/* Convert omega from spherical (almost) to rectangular */
|
||||
C->omega[0] = C->omega0*sin(M_PI/2.0 - C->phi)*cos(C->theta) ;
|
||||
C->omega[1] = C->omega0*sin(M_PI/2.0 - C->phi)*sin(C->theta) ;
|
||||
C->omega[2] = C->omega0*cos(M_PI/2.0 - C->phi) ;
|
||||
|
||||
return ( 0 );
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Cannon integration)
|
||||
***************************************************************************/
|
||||
|
||||
#include "sim_services/include/integrator.h"
|
||||
#include "../include/cannon_aero.h"
|
||||
|
||||
int cannon_integ_aero(
|
||||
|
||||
INTEGRATOR *I,
|
||||
CANNON_AERO* C)
|
||||
{
|
||||
|
||||
/* LOAD STATES (Example Below) */
|
||||
I->state[0] = C->pos[0] ;
|
||||
I->state[1] = C->pos[1] ;
|
||||
I->state[2] = C->pos[2] ;
|
||||
I->state[3] = C->vel[0] ;
|
||||
I->state[4] = C->vel[1] ;
|
||||
I->state[5] = C->vel[2] ;
|
||||
|
||||
/* LOAD DERIVATIVES (Example Below) */
|
||||
I->deriv[I->intermediate_step][0] = C->vel[0] ;
|
||||
I->deriv[I->intermediate_step][1] = C->vel[1] ;
|
||||
I->deriv[I->intermediate_step][2] = C->vel[2] ;
|
||||
I->deriv[I->intermediate_step][3] = C->acc[0] ;
|
||||
I->deriv[I->intermediate_step][4] = C->acc[1] ;
|
||||
I->deriv[I->intermediate_step][5] = C->acc[2] ;
|
||||
|
||||
integrate( I ) ;
|
||||
|
||||
/* UNLOAD NEW STATES (Example Below) */
|
||||
C->pos[0] = I->state_ws[I->intermediate_step][0] ;
|
||||
C->pos[1] = I->state_ws[I->intermediate_step][1] ;
|
||||
C->pos[2] = I->state_ws[I->intermediate_step][2] ;
|
||||
C->vel[0] = I->state_ws[I->intermediate_step][3] ;
|
||||
C->vel[1] = I->state_ws[I->intermediate_step][4] ;
|
||||
C->vel[2] = I->state_ws[I->intermediate_step][5] ;
|
||||
|
||||
|
||||
/* RETURN */
|
||||
return ( I->intermediate_step ) ;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Controls when jets are fired)
|
||||
***************************************************************************/
|
||||
#include "../include/cannon_aero.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
#include "trick_utils/math/include/trick_math.h"
|
||||
|
||||
int cannon_jet_control( CANNON_AERO* C )
|
||||
{
|
||||
double sim_time ;
|
||||
|
||||
#define CANNON_EQUALS(X,Y) ( fabs(X - Y) < 1.0e-9 ) ? 1 : 0
|
||||
|
||||
sim_time = exec_get_sim_time();
|
||||
|
||||
if ( CANNON_EQUALS(sim_time, roundoff(0.1, C->time_to_fire_jet_1)) ||
|
||||
CANNON_EQUALS(sim_time, roundoff(0.1, C->time_to_fire_jet_2)) ||
|
||||
CANNON_EQUALS(sim_time, roundoff(0.1, C->time_to_fire_jet_3)) ||
|
||||
CANNON_EQUALS(sim_time, roundoff(0.1, C->time_to_fire_jet_4)) ) {
|
||||
|
||||
C->jet_on = 1 ;
|
||||
|
||||
}
|
||||
return(0) ;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
3416 35 ./src/amoeba.c
|
||||
29228 1 ./src/cannon_init_amoeba.c
|
||||
14437 3 ./src/cannon_post_master.c
|
||||
47141 2 ./src/cannon_post_slave.c
|
||||
30034 8 ./src/cannon_pre_master.c
|
||||
54259 2 ./src/cannon_pre_slave.c
|
||||
5447 6 ./include/amoeba.h
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Vetter's implementation of the Nelder-Mead "amoeba" algorithm.
|
||||
* Was made strictly for Trick tutorial. Was a whim.
|
||||
* Reference for algorithm (not code):
|
||||
* http://www.research.ibm.com/infoecon/paps/html/amec99_bundle/node8.html
|
||||
*/
|
||||
|
||||
#ifndef __amoeba__
|
||||
#define __amoeba__
|
||||
|
||||
#define AMOEBA_ALPHA 1.0 /* reflection constant */
|
||||
#define AMOEBA_BETA 1.0 /* expansion constant */
|
||||
#define AMOEBA_ZETA 0.5 /* contraction constant */
|
||||
#define AMOEBA_ETA 0.5 /* shrinkage constant */
|
||||
|
||||
typedef enum {
|
||||
|
||||
VERTICES,
|
||||
CALC_CENTROID_POINT,
|
||||
CALC_REFLECTION_POINT,
|
||||
REFLECT,
|
||||
EXPAND,
|
||||
CONTRACT,
|
||||
SHRINK,
|
||||
|
||||
} AMOEBA_STATE ;
|
||||
|
||||
typedef struct {
|
||||
int debug ; /* -- Turn on some printing */
|
||||
int max_steps ; /* -- Even if we don't find solution, break */
|
||||
int num_dims ; /* -- Num dims of each vertice */
|
||||
int num_vertices ; /* -- Num vertices in simplex */
|
||||
double epsilon ; /* -- Bail if max dist simplex < epsilon */
|
||||
double** vertices ; /* -- Rows are vectors of num_dims */
|
||||
double** init_simplex ; /* -- Initial simplex */
|
||||
double* x_cent ; /* -- Center of vertices-exclude worst vertex */
|
||||
double* x_refl ; /* -- Point of reflection */
|
||||
double* x_expa ; /* -- Point of expansion */
|
||||
double* x_cont ; /* -- Point of contraction */
|
||||
double* curr_point ; /* -- Current point of interest for sim use:
|
||||
Simplex vertice, centroid, reflection,
|
||||
expansion or contraction point */
|
||||
int curr_vertex ; /* -- Current vertex for sim state machine */
|
||||
AMOEBA_STATE state ; /* -- For sim's amoeba state machine */
|
||||
} AMOEBA ;
|
||||
|
||||
/* Prototypes */
|
||||
void amoeba_init( AMOEBA* A, int num_dims, double epsilon, int max_steps,
|
||||
double* simplex_point, double simplex_size ) ;
|
||||
void amoeba_print( AMOEBA* A ) ;
|
||||
void amoeba_print_point( int num_dims, double* point ) ;
|
||||
void amoeba_go( AMOEBA* A ) ;
|
||||
double my_func( double* point ) ;
|
||||
void amoeba_quit( AMOEBA* A ) ;
|
||||
void amoeba_order( AMOEBA* A ) ;
|
||||
int amoeba_reflect( AMOEBA* A ) ;
|
||||
void amoeba_calc_reflection_point( AMOEBA* A ) ;
|
||||
int amoeba_expand( AMOEBA* A ) ;
|
||||
void amoeba_calc_expansion_point( AMOEBA* A ) ;
|
||||
int amoeba_contract( AMOEBA* A ) ;
|
||||
void amoeba_calc_contraction_point( AMOEBA* A ) ;
|
||||
void amoeba_shrink( AMOEBA* A ) ;
|
||||
int amoeba_satisfied( AMOEBA* A ) ;
|
||||
double amoeba_distance_between( int num_dims, double* x, double* y) ;
|
||||
int amoeba_compare_vertices( const void* a, const void* b) ;
|
||||
|
||||
#endif
|
@ -1,566 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: ( Amoeba )
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "../include/amoeba.h"
|
||||
|
||||
double my_func( double* point ) {
|
||||
|
||||
/* In the case of the simulation, the function value is
|
||||
* actually stored in the point
|
||||
*/
|
||||
int num_dims = 4 ;
|
||||
|
||||
return( point[num_dims] ) ;
|
||||
}
|
||||
|
||||
void amoeba_go( AMOEBA* A ) {
|
||||
|
||||
int step ;
|
||||
|
||||
step = 1 ;
|
||||
while( ! amoeba_satisfied(A) && step < A->max_steps ) {
|
||||
|
||||
step++ ;
|
||||
|
||||
amoeba_order( A ) ;
|
||||
|
||||
if ( amoeba_reflect( A ) ) {
|
||||
continue ;
|
||||
}
|
||||
if ( amoeba_expand( A ) ) {
|
||||
continue ;
|
||||
}
|
||||
if ( amoeba_contract( A ) ) {
|
||||
continue ;
|
||||
}
|
||||
|
||||
amoeba_shrink( A ) ;
|
||||
}
|
||||
amoeba_order( A ) ;
|
||||
|
||||
fprintf(stderr,"\n\nAmoeba search concluded.\n") ;
|
||||
fprintf(stderr,"Number iterations: %d \n", step) ;
|
||||
fprintf(stderr,"x=(");
|
||||
amoeba_print_point( A->num_dims, A->vertices[0] ) ;
|
||||
fprintf(stderr,")\n");
|
||||
fprintf(stderr,"F(x)=%.6lf\n\n", my_func(A->vertices[0]));
|
||||
}
|
||||
|
||||
void amoeba_shrink( AMOEBA* A ) {
|
||||
|
||||
int ii, jj ;
|
||||
|
||||
double* x ;
|
||||
double* x_0 ;
|
||||
double* x_n ;
|
||||
|
||||
x_0 = A->vertices[0] ;
|
||||
x_n = A->vertices[A->num_dims] ;
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Shrinking simplex...\n");
|
||||
amoeba_print( A ) ;
|
||||
fprintf(stderr,"\n\n");
|
||||
}
|
||||
|
||||
for ( ii = 0 ; ii < A->num_vertices ; ii++ ) {
|
||||
x = A->vertices[ii] ;
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
x[jj] = x_0[jj] + AMOEBA_ETA*( x[jj] - x_0[jj] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Shrank simplex.\n");
|
||||
amoeba_print( A ) ;
|
||||
fprintf(stderr,"\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
void amoeba_calc_contraction_point( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
double* x_c ;
|
||||
double* x_n ;
|
||||
double* x_cont ;
|
||||
|
||||
/* Short hand */
|
||||
x_c = A->x_cent ;
|
||||
x_n = A->vertices[A->num_vertices-1] ;
|
||||
x_cont = A->x_cont ;
|
||||
|
||||
/* Calculate contraction point
|
||||
* x_contract = x_center + zeta*(x_center - x_worst)
|
||||
*/
|
||||
for ( ii = 0 ; ii < A->num_dims ; ii++ ) {
|
||||
x_cont[ii] = x_c[ii] + AMOEBA_ZETA*(x_c[ii] - x_n[ii]) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int amoeba_contract( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
double* x_r ;
|
||||
double* x_n ;
|
||||
double* x_n_1 ;
|
||||
double* x_c ;
|
||||
double* x_cont ;
|
||||
double* x_e ;
|
||||
|
||||
/* Short hand */
|
||||
x_c = A->x_cent ;
|
||||
x_r = A->x_refl ;
|
||||
x_n = A->vertices[A->num_vertices-1] ;
|
||||
x_n_1 = A->vertices[A->num_vertices-2] ;
|
||||
x_cont = A->x_cont ;
|
||||
x_e = A->x_expa ;
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Try contraction.\n");
|
||||
}
|
||||
|
||||
/* Contract if F(x_r) < F(x_n-1) */
|
||||
if ( my_func(x_r) >= my_func(x_n_1) ) {
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Reject contraction.\n");
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
/* Calculate contraction point
|
||||
* x_contract = x_center + zeta*(x_center - x_worst)
|
||||
*/
|
||||
for ( ii = 0 ; ii < A->num_dims ; ii++ ) {
|
||||
x_cont[ii] = x_c[ii] + AMOEBA_ZETA*(x_c[ii] - x_n[ii]) ;
|
||||
}
|
||||
|
||||
if ( my_func(x_cont) >= my_func(x_n) ) {
|
||||
/* Accept contraction point */
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Accept contraction about x_cont(");
|
||||
amoeba_print_point( A->num_dims, x_cont ) ;
|
||||
fprintf(stderr,") F(x_cont)=%.2lf \n",
|
||||
my_func(x_cont) ) ;
|
||||
}
|
||||
|
||||
for ( ii = 0 ; ii < A->num_dims+1 ; ii++ ) {
|
||||
x_n[ii] = x_cont[ii] ;
|
||||
}
|
||||
|
||||
return 1 ;
|
||||
|
||||
} else {
|
||||
/* Reject contraction point */
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Reject contraction about x_cont(");
|
||||
amoeba_print_point( A->num_dims, x_cont ) ;
|
||||
fprintf(stderr,") F(x_cont)=%.2lf \n",
|
||||
my_func(x_cont) ) ;
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void amoeba_calc_expansion_point( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
double* x_r ;
|
||||
double* x_c ;
|
||||
double* x_e ;
|
||||
|
||||
/* Short hand */
|
||||
x_r = A->x_refl ;
|
||||
x_c = A->x_cent ;
|
||||
x_e = A->x_expa ;
|
||||
|
||||
/* Calculate expansion point
|
||||
* x_expa = x_refl + beta*(x_refl - x_cent)
|
||||
*/
|
||||
for ( ii = 0 ; ii < A->num_dims ; ii++ ) {
|
||||
x_e[ii] = x_r[ii] + AMOEBA_BETA*(x_r[ii] - x_c[ii]) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int amoeba_expand( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
double* x_0 ;
|
||||
double* x_r ;
|
||||
double* x_n ;
|
||||
double* x_c ;
|
||||
double* x_e ;
|
||||
|
||||
/* Short hand */
|
||||
x_0 = A->vertices[0] ;
|
||||
x_r = A->x_refl ;
|
||||
x_n = A->vertices[A->num_vertices-1] ;
|
||||
x_c = A->x_cent ;
|
||||
x_e = A->x_expa ;
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Try expansion.\n");
|
||||
}
|
||||
|
||||
/* Expand if F(x_r) > F(x_0) */
|
||||
if ( my_func(x_r) <= my_func(x_0) ) {
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Reject expansion.\n");
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Accept expansion.\n");
|
||||
}
|
||||
|
||||
if ( my_func(x_e) >= my_func(x_r) ) {
|
||||
/* Accept expansion point */
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Accept x_e(");
|
||||
amoeba_print_point( A->num_dims, x_e ) ;
|
||||
fprintf(stderr,") F(x_e)=%.2lf \n", my_func(x_e) ) ;
|
||||
}
|
||||
|
||||
for ( ii = 0 ; ii < A->num_dims+1 ; ii++ ) {
|
||||
x_n[ii] = x_e[ii] ;
|
||||
}
|
||||
} else {
|
||||
/* Accept reflection point */
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Accept x_r(");
|
||||
amoeba_print_point( A->num_dims, x_r ) ;
|
||||
fprintf(stderr,") F(x_r)=%.2lf \n", my_func(x_r) ) ;
|
||||
}
|
||||
for ( ii = 0 ; ii < A->num_dims+1 ; ii++ ) {
|
||||
x_n[ii] = x_r[ii] ;
|
||||
}
|
||||
}
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
double amoeba_distance_between( int num_dims, double* x, double* y ) {
|
||||
|
||||
int ii ;
|
||||
double sum_squares ;
|
||||
|
||||
sum_squares = 0 ;
|
||||
for ( ii = 0 ; ii < num_dims ; ii++ ) {
|
||||
sum_squares += (x[ii] - y[ii])*(x[ii] - y[ii]);
|
||||
}
|
||||
|
||||
return ( sqrt(sum_squares) ) ;
|
||||
}
|
||||
|
||||
int amoeba_satisfied( AMOEBA* A ) {
|
||||
|
||||
/*
|
||||
* Find max distance between points in the simplex
|
||||
* If under epsilon, amoeba satisfied
|
||||
* If this isn't satisfied, see if F(x) satisfied within epsilon
|
||||
*/
|
||||
|
||||
int ii, jj ;
|
||||
double dist, max_dist ;
|
||||
double* x ;
|
||||
double* y ;
|
||||
double f1 ;
|
||||
double f2 ;
|
||||
|
||||
/*
|
||||
* Check max dist between points in simplex
|
||||
* If the amoeba gets too small, no point in shrinking
|
||||
* infintessimally (sp?).
|
||||
*/
|
||||
max_dist = 0.0 ;
|
||||
for ( ii = 0 ; ii < A->num_vertices - 1 ; ii++ ) {
|
||||
x = A->vertices[ii] ;
|
||||
for ( jj = ii+1 ; jj < A->num_vertices ; jj++ ) {
|
||||
y = A->vertices[jj] ;
|
||||
dist = amoeba_distance_between( A->num_dims, x, y ) ;
|
||||
if ( dist > max_dist ) {
|
||||
max_dist = dist ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( max_dist < A->epsilon ) {
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if diff between function vals less than epsilon
|
||||
*/
|
||||
max_dist = 0 ;
|
||||
for ( ii = 0 ; ii < A->num_vertices - 1 ; ii++ ) {
|
||||
f1 = A->vertices[ii][A->num_dims] ;
|
||||
for ( jj = ii+1 ; jj < A->num_vertices ; jj++ ) {
|
||||
f2 = A->vertices[jj][A->num_dims] ;
|
||||
dist = fabs( f1 - f2 ) ;
|
||||
if ( dist > max_dist ) {
|
||||
max_dist = dist ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( max_dist < A->epsilon ) {
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unsatisfied amoeba :-(
|
||||
*/
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
void amoeba_calc_reflection_point( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
double* x_r ;
|
||||
double* x_n ;
|
||||
double* x_c ;
|
||||
|
||||
/* Short hand */
|
||||
x_r = A->x_refl ;
|
||||
x_n = A->vertices[A->num_vertices-1] ;
|
||||
x_c = A->x_cent ;
|
||||
|
||||
/* Calculate reflection point
|
||||
* x_refl = x_cent + alpha*(x_cent - x_worst)
|
||||
*/
|
||||
for ( ii = 0 ; ii < A->num_dims ; ii++ ) {
|
||||
x_r[ii] = x_c[ii] + AMOEBA_ALPHA*(x_c[ii] - x_n[ii]) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int amoeba_reflect( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
double* x_0 ;
|
||||
double* x_r ;
|
||||
double* x_n ;
|
||||
double* x_c ;
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,">> Try reflection.\n");
|
||||
}
|
||||
|
||||
/* Short hand */
|
||||
x_0 = A->vertices[0] ;
|
||||
x_r = A->x_refl ;
|
||||
x_n = A->vertices[A->num_vertices-1] ;
|
||||
x_c = A->x_cent ;
|
||||
|
||||
if ( my_func(x_0) >= my_func(x_r) && my_func(x_r) > my_func(x_n) ) {
|
||||
/* Accept reflection point --- replace worst point with x_r */
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Accept reflection x_r(");
|
||||
amoeba_print_point( A->num_dims, x_r ) ;
|
||||
fprintf(stderr,") F(x_r)=%.2lf \n", my_func(x_r) ) ;
|
||||
}
|
||||
for ( ii = 0 ; ii < A->num_dims+1 ; ii++ ) {
|
||||
x_n[ii] = x_r[ii] ;
|
||||
}
|
||||
return 1 ;
|
||||
} else {
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Reject reflection x_r(");
|
||||
amoeba_print_point( A->num_dims, x_r ) ;
|
||||
fprintf(stderr,") F(x_r)=%.2lf \n", my_func(x_r) ) ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
void amoeba_order( AMOEBA* A ) {
|
||||
|
||||
int ii, jj ;
|
||||
|
||||
/* Order vertices based on function results.
|
||||
* Order from best to worst (i.e. max to min)
|
||||
*/
|
||||
qsort( A->vertices,
|
||||
A->num_vertices, sizeof(double*),
|
||||
amoeba_compare_vertices) ;
|
||||
|
||||
/* Calculate centroid --- excluding worst point */
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
A->x_cent[jj] = 0 ;
|
||||
}
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
for ( ii = 0 ; ii < A->num_vertices - 1 ; ii++ ) {
|
||||
A->x_cent[jj] += A->vertices[ii][jj] ;
|
||||
}
|
||||
A->x_cent[jj] /= (double)(A->num_vertices - 1.0 ) ;
|
||||
}
|
||||
|
||||
if ( A->debug ) {
|
||||
|
||||
fprintf(stderr,"Ordered Amoeba.\n");
|
||||
amoeba_print( A ) ;
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
}
|
||||
|
||||
int amoeba_compare_vertices( const void* ap, const void* bp ) {
|
||||
|
||||
double a, b ;
|
||||
|
||||
a = my_func( *((double**) ap) ) ;
|
||||
b = my_func( *((double**) bp) ) ;
|
||||
|
||||
if ( a > b ) {
|
||||
return -1 ;
|
||||
} else if ( a < b ) {
|
||||
return 1 ;
|
||||
} else {
|
||||
return 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* num_dims: Number of dimensions in domain space.
|
||||
* Example: If the function we are maximizing is F(x,y,z)
|
||||
* The number of dims is 3.
|
||||
*
|
||||
* epsilon: The error tolerance before amoeba algorithm stops
|
||||
* A good number is something like: 1.0e-9
|
||||
*
|
||||
* max_steps: Even if we don't reach a solution by "max_steps", stop.
|
||||
*
|
||||
* We have to create a first simplex to begin amoeba algorithm.
|
||||
* There are two ways to do this.
|
||||
* First : Send simplex_point and simplex_size
|
||||
* This defines a simplex with one vertex at "simplex_point"
|
||||
* All other points are spaced "simplex_size" in the unit vec direction
|
||||
* Second : If "simplex_point" is NULL, it is assumed user setup
|
||||
* A->init_simplex before entering amoeba_init.
|
||||
*/
|
||||
void amoeba_init( AMOEBA* A, int num_dims, double epsilon, int max_steps,
|
||||
double* simplex_point, double simplex_size ) {
|
||||
|
||||
int ii, jj ;
|
||||
|
||||
if ( A->init_simplex == NULL && simplex_point == NULL ) {
|
||||
fprintf(stderr, "Initial simplex undefined by user.\n"
|
||||
"Set A->init_simplex or "
|
||||
"simplex_point and simplex_size\n") ;
|
||||
exit(-1) ;
|
||||
}
|
||||
|
||||
A->state = VERTICES ;
|
||||
A->num_dims = num_dims ;
|
||||
A->num_vertices = num_dims + 1 ;
|
||||
A->curr_vertex = 0 ;
|
||||
A->epsilon = epsilon ;
|
||||
A->max_steps = max_steps ;
|
||||
|
||||
A->vertices = (double**) malloc (A->num_vertices*sizeof(double));
|
||||
for ( ii = 0 ; ii < A->num_vertices ; ii++ ) {
|
||||
A->vertices[ii] = (double*) malloc
|
||||
((A->num_dims+1)*sizeof(double));
|
||||
}
|
||||
|
||||
if ( simplex_point != NULL ) {
|
||||
|
||||
/*
|
||||
* Use "simplex_point" as one vertice of first simplex. Then
|
||||
* move in "simplex_size" along unit vectors to create the
|
||||
* rest of the first guess simplex.
|
||||
*
|
||||
* First_simplex = simplex_point + simplex_size*unit_vecs
|
||||
*/
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
A->vertices[0][jj] = simplex_point[jj] ;
|
||||
}
|
||||
/* Load function vals with zero */
|
||||
A->vertices[0][jj] = 0.0 ;
|
||||
|
||||
for ( ii = 1 ; ii < A->num_vertices ; ii++ ) {
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
if ( jj+1 == ii ) {
|
||||
A->vertices[ii][jj] =
|
||||
simplex_point[jj] - simplex_size ;
|
||||
} else {
|
||||
A->vertices[ii][jj] = simplex_point[jj] ;
|
||||
}
|
||||
}
|
||||
/* Load function vals with zero */
|
||||
A->vertices[ii][jj] = 0.0 ;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* Assume user has defined first simplex */
|
||||
for ( ii = 0 ; ii < A->num_vertices ; ii++ ) {
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
A->vertices[ii][jj] = A->init_simplex[ii][jj] ;
|
||||
}
|
||||
/* Load function vals with zero */
|
||||
A->vertices[ii][jj] = 0.0 ;
|
||||
}
|
||||
}
|
||||
|
||||
A->x_cent = (double*) malloc ( (A->num_dims+1) * sizeof(double) ) ;
|
||||
A->x_refl = (double*) malloc ( (A->num_dims+1) * sizeof(double) ) ;
|
||||
A->x_expa = (double*) malloc ( (A->num_dims+1) * sizeof(double) ) ;
|
||||
A->x_cont = (double*) malloc ( (A->num_dims+1) * sizeof(double) ) ;
|
||||
|
||||
/* Init func results */
|
||||
A->x_cent[A->num_dims] = 0.0 ;
|
||||
A->x_refl[A->num_dims] = 0.0 ;
|
||||
A->x_expa[A->num_dims] = 0.0 ;
|
||||
A->x_cont[A->num_dims] = 0.0 ;
|
||||
|
||||
|
||||
if ( A->debug ) {
|
||||
fprintf(stderr,"Initial simplex with function evals.\n");
|
||||
amoeba_print( A ) ;
|
||||
fprintf(stderr,"\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
void amoeba_quit( AMOEBA* A ) {
|
||||
|
||||
int ii ;
|
||||
|
||||
for ( ii = 0 ; ii < A->num_vertices ; ii++ ) {
|
||||
free( A->vertices[ii] ) ;
|
||||
}
|
||||
free( A->vertices ) ;
|
||||
free( A->x_cent ) ;
|
||||
free( A->x_refl ) ;
|
||||
free( A->x_expa ) ;
|
||||
free( A->x_cont ) ;
|
||||
}
|
||||
|
||||
void amoeba_print_point( int num_dims, double* point ) {
|
||||
|
||||
int ii;
|
||||
|
||||
for ( ii = 0 ; ii < num_dims-1 ; ii++ ) {
|
||||
fprintf(stderr,"%.2lf ", point[ii]);
|
||||
}
|
||||
fprintf(stderr,"%.2lf", point[num_dims-1]);
|
||||
}
|
||||
|
||||
void amoeba_print( AMOEBA* A ) {
|
||||
|
||||
int ii, jj ;
|
||||
|
||||
for ( ii = 0 ; ii < A->num_vertices ; ii++ ) {
|
||||
for ( jj = 0 ; jj < A->num_dims ; jj++ ) {
|
||||
fprintf(stderr,"%.2lf ", A->vertices[ii][jj] ) ;
|
||||
}
|
||||
fprintf(stderr," > %.2lf \n", A->vertices[ii][jj]);
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: ( Init the Amoeba )
|
||||
LIBRARY DEPENDENCY: ((amoeba.o))
|
||||
PROGRAMMERS: (Keith)
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
#include "../include/amoeba.h"
|
||||
|
||||
int cannon_init_amoeba(
|
||||
AMOEBA* A )
|
||||
{
|
||||
amoeba_init( A, 4, 1.0e-3, 100, NULL, 0.0 ) ;
|
||||
return ( 0 );
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
|
||||
int cannon_master_shutdown(CANNON_AERO *C) {
|
||||
C->master_shutdown = 1;
|
||||
printf("cannon_master_shutdown called \n");
|
||||
return 0;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Read slave's sim evaluation)
|
||||
LIBRARY DEPENDENCY: ((amoeba.o))
|
||||
PROGRAMMER: ((keith))
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
#include "../include/amoeba.h"
|
||||
#include "sim_services/include/executive.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
|
||||
int cannon_post_master(
|
||||
CANNON_AERO* C,
|
||||
AMOEBA* A )
|
||||
{
|
||||
CANNON_AERO C_curr ;
|
||||
EXECUTIVE* E ;
|
||||
E = exec_get_exec();
|
||||
|
||||
/* Read slave's results */
|
||||
tc_read( &E->monte.work.data_conn,
|
||||
(char*) &C_curr, sizeof(CANNON_AERO) );
|
||||
|
||||
fprintf(stderr, "%03d> F(", E->monte.work.curr_run);
|
||||
amoeba_print_point(4, A->curr_point) ;
|
||||
fprintf(stderr, ") = %.6lf\n", C_curr.pos[0]);
|
||||
|
||||
/*
|
||||
* Load function result for either:
|
||||
* simplex vertice, centroid, reflection, contraction or expansion point
|
||||
*/
|
||||
A->curr_point[A->num_dims] = C_curr.pos[0] ;
|
||||
|
||||
return(0) ;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Get slave sim's evaluation of x)
|
||||
***************************************************************************/
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
#include "sim_services/include/executive.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
|
||||
int cannon_post_slave(
|
||||
/* RETURN: -- Always return zero */
|
||||
CANNON_AERO* C) /* INOUT: -- Parameter */
|
||||
|
||||
{
|
||||
EXECUTIVE* E ;
|
||||
E = exec_get_exec();
|
||||
|
||||
/* Send slave results */
|
||||
tc_write( &E->monte.work.data_conn, (char*) C, sizeof(CANNON_AERO) );
|
||||
|
||||
return(0) ;
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Master optimization)
|
||||
LIBRARY_DEPENDENCY: (amoeba.o)
|
||||
PROGRAMMER: (keith)
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
#include "../include/amoeba.h"
|
||||
#include "sim_services/include/executive.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
|
||||
int cannon_pre_master(
|
||||
/* RETURN: -- Always return zero */
|
||||
CANNON_AERO* C, /* INOUT: -- Parameter */
|
||||
AMOEBA* A)
|
||||
{
|
||||
|
||||
while ( 1 ) {
|
||||
|
||||
switch ( A->state ) {
|
||||
|
||||
case VERTICES:
|
||||
A->curr_point = A->vertices[A->curr_vertex] ;
|
||||
if ( A->curr_vertex == A->num_vertices ) {
|
||||
A->state = CALC_CENTROID_POINT ;
|
||||
} else {
|
||||
fprintf(stderr, "V[%d] ", A->curr_vertex);
|
||||
}
|
||||
A->curr_vertex++ ;
|
||||
break ;
|
||||
|
||||
case CALC_CENTROID_POINT:
|
||||
fprintf(stderr, "CENT ");
|
||||
amoeba_order( A ) ;
|
||||
A->curr_point = A->x_cent ;
|
||||
A->state = CALC_REFLECTION_POINT ;
|
||||
break ;
|
||||
|
||||
case CALC_REFLECTION_POINT:
|
||||
fprintf(stderr, "REFL ");
|
||||
amoeba_calc_reflection_point( A ) ;
|
||||
A->curr_point = A->x_refl ;
|
||||
A->state = REFLECT ;
|
||||
break ;
|
||||
|
||||
case REFLECT:
|
||||
if ( amoeba_reflect( A ) ) {
|
||||
A->state = CALC_CENTROID_POINT ;
|
||||
} else {
|
||||
fprintf(stderr, "EXPA ");
|
||||
amoeba_calc_expansion_point( A ) ;
|
||||
A->curr_point = A->x_expa ;
|
||||
A->state = EXPAND ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case EXPAND:
|
||||
if ( amoeba_expand( A ) ) {
|
||||
A->state = CALC_CENTROID_POINT ;
|
||||
} else {
|
||||
fprintf(stderr, "CONT ");
|
||||
amoeba_calc_contraction_point( A ) ;
|
||||
A->curr_point = A->x_cont ;
|
||||
A->state = CONTRACT ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case CONTRACT:
|
||||
if ( amoeba_contract( A ) ) {
|
||||
A->state = CALC_CENTROID_POINT ;
|
||||
} else {
|
||||
A->state = SHRINK ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case SHRINK:
|
||||
amoeba_shrink( A ) ;
|
||||
fprintf(stderr, "V[0] ");
|
||||
A->curr_point = A->vertices[0] ;
|
||||
A->curr_vertex = 1 ;
|
||||
A->state = VERTICES ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( amoeba_satisfied( A ) && A->state != VERTICES ) {
|
||||
exec_terminate( "cannon_pre_master",
|
||||
"Amoeba has found a solution." ) ;
|
||||
}
|
||||
|
||||
if ( A->state == CALC_CENTROID_POINT ||
|
||||
A->state == SHRINK ) {
|
||||
continue ;
|
||||
} else {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
C->time_to_fire_jet_1 = A->curr_point[0] ;
|
||||
C->time_to_fire_jet_2 = A->curr_point[1] ;
|
||||
C->time_to_fire_jet_3 = A->curr_point[2] ;
|
||||
C->time_to_fire_jet_4 = A->curr_point[3] ;
|
||||
|
||||
return(0) ;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*********************************** TRICK HEADER **************************
|
||||
PURPOSE: (Slave optimization)
|
||||
LIBRARY_DEPENDENCY: (amoeba.o)
|
||||
PROGRAMMER: (keith)
|
||||
***************************************************************************/
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
#include "sim_services/include/executive.h"
|
||||
#include "sim_services/include/exec_proto.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int cannon_pre_slave(
|
||||
/* RETURN: -- Always return zero */
|
||||
CANNON_AERO* C) /* INOUT: -- Parameter */
|
||||
|
||||
{
|
||||
fprintf(stderr, "SLAVE POINT: (%.6lf %.6lf %.6lf %.6lf)\n",
|
||||
C->time_to_fire_jet_1,
|
||||
C->time_to_fire_jet_2,
|
||||
C->time_to_fire_jet_3,
|
||||
C->time_to_fire_jet_4) ;
|
||||
|
||||
return(0) ;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#include "../../aero/include/cannon_aero.h"
|
||||
|
||||
int cannon_slave_init(CANNON_AERO *C) {
|
||||
C->slave_init = 1;
|
||||
printf("cannon_slave_init called\n");
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user