Skip to content

Commit

Permalink
Merged release/0.9.6 into master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
bjax committed Jul 29, 2013
2 parents 76409ba + 4cbeb97 commit e637538
Show file tree
Hide file tree
Showing 53 changed files with 3,794 additions and 2,486 deletions.
54 changes: 1 addition & 53 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,6 @@
CHANGE LOG for DAVEtools

V 0.9.4: Added new utilities: DAVE2POST, to generate POST-II input
decks and code sections; and DAVE2OTIS, to generate OTIS4
input decks. Added FORTRAN and C code snippet writers, to
support these. Added selectionFlag to Block and
selectOutput(), getSelectedBlocks() to Model. Tweaked tests
to run under Windows XP. Upgraded for use with NetBeans 7.1.1
and Java SE 1.6. Fixed DAVE2SL incompatibility with
Matlab/Simulink 2011b. Bug fix for inequality comparison
operator in Simulink block.

V 0.9.3: Added tally of checkcases to DAVE's statistics summary (when
used with the -c option). Added support for UML diagram
generation (with two open-source packages) for DAVEtools
development. Separated this change log from the readme
file. Fixed some annoyances related to missing DTDs and/or
network being unavailable. Added support for MathML 'max',
'min', 'ceiling', and 'floor' elements.

V 0.9.2: Corrected bug in DAVE that didn't recognize use of binary
minus in MathML2 calculations; fixed bug whereby anonymous
tables shared the same matlab setup data; corrected sense of
return codes from DAVE and DAVE2SL. Improved integration test
framework. Corrected bug in ModelSweeper that caused program
to crash if no checkcases were defined.

V 0.9.1: Added support for minValue and maxValue attributes of
variableDef as allowed in DAVE-ML 2.0 RC 4; fixed error
reporting in creation script generation (aborts were returning
exit status 0 but now report 1).

V 0.9.0: Changed to support the default DAVE-ML namespace (xmlns);
added entity refs to make Eclipse IDE happy; changed for using
'build' subdirectories to 'bin' to make Eclipse convention;
fleshed out ant build.xml file to rely less on makefiles (but
a makefile is still needed to run the app_tests of DAVE2SL).

Corrected the inability of dave to parse MathML 'piecewise'
elements with more than one 'piece.'

Distribution format switched to zip from tar to be more PC
friendly.

Build system switched to Ant from Make (but some hybrid make
functionality exists, to some version of make is still
required).

Source code management system now uses 'git' instead of
Subversion.

Now producing a single DAVEtools.jar that includes all
products for convenience, including dave, dave2sl, modelsweeper,
xerces and jdom .jar file contents. Slightly different syntax
used to invoke DAVE2SL (default jar entry point) and DAVE.
Refer to README for changes since 0.8.1a.

Summary of changes since DAVEtools v 0.8.0:

Expand Down
137 changes: 71 additions & 66 deletions DAVE/src/gov/nasa/daveml/dave/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,15 @@ public boolean allInputsReady()
Iterator<Signal> sigIt = this.getInputIterator();

// ask each signal if it's source is ready
while (sigIt.hasNext())
while (sigIt.hasNext()) {
try {
allReady = allReady && sigIt.next().sourceReady();
} catch (DAVEException e) {
System.err.println(e.getMessage());
System.err.println("Wiring error found - missing source block.");
System.exit(0);
}
}

// output is AND of all signal ready results
return allReady;
Expand Down Expand Up @@ -314,8 +315,9 @@ public void selectWithAncestors() {
while (sigIt.hasNext()) {
Signal sig = sigIt.next();
Block ancestor = sig.getSource();
if (ancestor != null)
if (ancestor != null) {
ancestor.selectWithAncestors();
}
}
}

Expand All @@ -335,8 +337,6 @@ public void selectWithAncestors() {

public boolean isSelected() { return selectedFlag; }



/**
*
* Set a pointer to some masking object (like Simulink SLBlock)
Expand All @@ -345,8 +345,6 @@ public void selectWithAncestors() {

public void setMask( Object o ) { this.mask = o; }



/**
*
* Returns the masking object (possibly null).
Expand Down Expand Up @@ -376,12 +374,13 @@ public int addInput(Signal inSignal)

inputs.add(inSignal); // add to end of list
portIndex = inputs.indexOf(inSignal); // find it's position
while (inVarIDs.size() <= portIndex) // increase length of companion list if necessary
while (inVarIDs.size() <= portIndex) { // increase length of companion list if necessary
inVarIDs.add(inSignal.getName());
}
String existingID = inVarIDs.get(portIndex);
if (existingID.equals("")) // don't override existing ID (for FTB)
if (existingID.equals("")) { // don't override existing ID (for FTB)
inVarIDs.set(portIndex, inSignal.getVarID()); // keep in sync with inputs

}
//System.out.println("Adding signal " + inSignal.getName() + " as input " + (portIndex+1) + " to block " + getName());

return portIndex+1;
Expand All @@ -401,17 +400,18 @@ public void addInput(Signal inSignal, int portNum)
{
int portIndex = portNum-1;
//System.out.println("Adding signal " + inSignal.getName() + " as input " + (portIndex+1) + " to block " + getName());
while(inputs.size() <= portIndex) // grow list if necessary to reach offset
while(inputs.size() <= portIndex) { // grow list if necessary to reach offset
inputs.add(inSignal);
}
inputs.set(portIndex, inSignal); // record input signal

while(inVarIDs.size() <= portIndex) // grow ID list with input list
while(inVarIDs.size() <= portIndex){ // grow ID list with input list
inVarIDs.add("");

}
String existingID = inVarIDs.get(portIndex); // see if already set
if (existingID.equals("")) // don't override existing ID (for FTB)
if (existingID.equals("")){ // don't override existing ID (for FTB)
inVarIDs.set(portIndex, inSignal.getVarID()); // keep in sync with inputs

}
//System.out.println(" Block " + myName + " has added upstream signal " + inSignal.getName());
}

Expand All @@ -426,23 +426,23 @@ public void addInput(Signal inSignal, int portNum)

public void addVarID( int portNum, String varID )
{
if (this.isVerbose())
System.out.println("Adding varID '" + varID + "' to port " + portNum
+ " of block '" + this.getName() + "'.");
if (this.isVerbose()) {
System.out.println("Adding varID '" + varID + "' to port " +
portNum + " of block '" + this.getName() + "'.");
}
int portIndex = portNum - 1;
if(portNum < 1)
if(portNum < 1) {
System.err.println("Block '" + getName() + "' asked to hook up varID '" + varID +
"' to port " + portNum + " -- error!");
else
{
while(inVarIDs.size() <= portIndex)
inVarIDs.add("");
inVarIDs.set(portIndex, varID);
} else {
while(inVarIDs.size() <= portIndex)
inVarIDs.add("");
inVarIDs.set(portIndex, varID);

while(inputs.size() <= portIndex) // keep in sync with varID array
inputs.add(null);
inputs.set(portIndex, null);
}
while(inputs.size() <= portIndex) // keep in sync with varID array
inputs.add(null);
inputs.set(portIndex, null);
}
}


Expand Down Expand Up @@ -484,13 +484,14 @@ public void addOutput(Signal outSignal) throws DAVEException

// see if it's variD matches ours, if any.

if (this.outVarID == null)
if (this.outVarID == null) {
this.outVarID = newVarID;
else
if (!this.outVarID.equals( newVarID ))
} else {
if (!this.outVarID.equals( newVarID )) {
throw new DAVEException("Error: specified output signal ID '" + newVarID +
"' doesn't match expected ('" + this.outVarID + "'.");

}
}
this.output = outSignal;
outSignal.addSource( this, 1 ); // tell signal about us
}
Expand Down Expand Up @@ -528,8 +529,8 @@ protected void addInput( Block blk, int inPort ) {
System.err.println(" Unexpected error: couldn't add output signal to " + blk.getName() );
System.exit(0);
}
sig.addSink(this, inPort);
}
sig.addSink(this, inPort);
}


Expand Down Expand Up @@ -673,10 +674,11 @@ public void setNameList( NameList newNameList )

protected void setName( String newName )
{
if (this.nameList != null)
if (this.nameList != null) {
this.myName = this.nameList.addUnique( newName );
else
} else {
this.myName = newName;
}
//System.out.println("Setting block name to " + this.myName);
}

Expand Down Expand Up @@ -708,10 +710,11 @@ public void renameInVarID(Integer portNum) {

public int numInputs()
{
if (this.inputs != null)
if (this.inputs != null) {
return this.inputs.size();
else
} else {
return 0;
}
}

/**
Expand Down Expand Up @@ -769,25 +772,21 @@ protected void hookUpInputs()

Iterator<String> iVarIDIterator = this.inVarIDs.iterator();

while (iVarIDIterator.hasNext())
{
// get independent variable ID
String signalVarID = iVarIDIterator.next();

// look for existing signal from previously built breakpoint block
Signal theSignal = ourModel.getSignals().findByID( signalVarID );
if (theSignal != null)
{
//System.out.println(" found signal with name " + signalVarID + ", connecting...");
while (iVarIDIterator.hasNext()) {

// get independent variable ID
String signalVarID = iVarIDIterator.next();

theSignal.addSink( this, portCount+1 ); // does double link
portCount++; // count # of dimensions
}
else
{
System.err.println(" No signal named " + signalVarID + " found.");
}
// look for existing signal from previously built breakpoint block
Signal theSignal = ourModel.getSignals().findByID( signalVarID );
if (theSignal != null) {
//System.out.println(" found signal with name " + signalVarID + ", connecting...");
theSignal.addSink( this, portCount+1 ); // does double link
portCount++; // count # of dimensions
} else {
System.err.println(" No signal named " + signalVarID + " found.");
}
}
}


Expand All @@ -808,9 +807,9 @@ public void hookUp() throws DAVEException
Signal s;


if (this.isVerbose())
if (this.isVerbose()) {
System.out.println(" hookUp called for block '" + this.getName() + "'");

}
// hook up inputs

it = this.getInputIterator();
Expand All @@ -833,12 +832,14 @@ public void hookUp() throws DAVEException

if (s == null) { // it's not hooked up
// search by varID for missing signal
if (this.outVarID == null)
if (this.outVarID == null) {
throw new DAVEException("Block '" + this.myName + "' has no output signal identified.");
}
s = ourModel.getSignals().findByID( this.outVarID );
// if null returned, generate exception
if (s == null)
if (s == null) {
throw new DAVEException("Unable to find signal '" + this.outVarID + "' for output");
}
this.addOutput( s );
}

Expand Down Expand Up @@ -918,9 +919,9 @@ public boolean verifyOutputs()
Signal s = this.getOutput();
if (s == null) { // output not yet filled
String theOutVarID = this.getOutputVarID();
if (theOutVarID == null) // no output to hook up
if (theOutVarID == null) { // no output to hook up
return false;
else {
} else {
s = ourModel.getSignals().findByID( theOutVarID );
try {
this.addOutput(s);
Expand Down Expand Up @@ -1002,8 +1003,9 @@ public String errorComment( String errMsg ) {

public String endLine() {
String lineEnd = "\n";
if (ourModel.getCodeDialect() == Model.DT_ANSI_C)
if (ourModel.getCodeDialect() == Model.DT_ANSI_C) {
lineEnd = ";\n";
}
return lineEnd;
}

Expand Down Expand Up @@ -1057,7 +1059,7 @@ public void describeSelf( Writer writer ) throws IOException
{
int numInputs = inputs.size();
int numOutputs = 0;
if (this.output != null) numOutputs = 1;
if (this.output != null) { numOutputs = 1; }

writer.write("Block \"" + myName + "\" has ");
switch (numInputs)
Expand Down Expand Up @@ -1102,13 +1104,15 @@ public void describeSelf( Writer writer ) throws IOException
Signal sig = sigIt.next();
if (sig != null) {
String theName = sig.getName();
if (theName == null)
if (theName == null) {
writer.write("Unnamed signal");
else
} else {
writer.write(theName);
}
}
if (sigIt.hasNext())
if (sigIt.hasNext()) {
writer.write(", ");
}
}
writer.write("), ");
}
Expand Down Expand Up @@ -1153,10 +1157,11 @@ public void describeSelf( Writer writer ) throws IOException
Signal sig = this.getOutput();
if (sig != null) {
String theName = sig.getName();
if (theName == null)
if (theName == null) {
writer.write("Unnamed signal");
else
} else {
writer.write(theName);
}
}
writer.write("), ");
}
Expand Down
2 changes: 1 addition & 1 deletion DAVE/src/gov/nasa/daveml/dave/BlockArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
*/

import java.util.Collection;
import java.util.ArrayList;
import java.util.Collection;

/**
*
Expand Down
Loading

0 comments on commit e637538

Please sign in to comment.