summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmack <dmack@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-03-20 23:11:28 +0000
committerdmack <dmack@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-03-20 23:11:28 +0000
commitceec4fb29ce88b53dfbd6b61a85539ac17de28d7 (patch)
treeb16c0ded81eb2da3ac94156a3ed2a4252001a61c
parent6bca083122bcdffbdb917f7962031c44e688edbd (diff)
downloadATCD-ceec4fb29ce88b53dfbd6b61a85539ac17de28d7.tar.gz
Fri Mar 20 23:10:39 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
-rw-r--r--SA_POP/C2W/Instructions for building SA-POP Federate.txt37
-rw-r--r--SA_POP/C2W/LogGraphOut.cpp245
-rw-r--r--SA_POP/C2W/LogGraphOut.h72
-rw-r--r--SA_POP/ChangeLog32
4 files changed, 58 insertions, 328 deletions
diff --git a/SA_POP/C2W/Instructions for building SA-POP Federate.txt b/SA_POP/C2W/Instructions for building SA-POP Federate.txt
index 4ba642b31a1..d8d10b77ffd 100644
--- a/SA_POP/C2W/Instructions for building SA-POP Federate.txt
+++ b/SA_POP/C2W/Instructions for building SA-POP Federate.txt
@@ -2,6 +2,7 @@ $Id$
Instructions for building SA-POP Federate
03/18/2009 Revision (John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>)
+ 03/20/2009 Revision (Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>)
ACE:
@@ -41,6 +42,9 @@ SA-POP Core:
-Subversion (e.g., 1.4.3-r23084 or later) [install]
-Xerces-C (e.g., 2.7.0-win32-vc8 or 2.8.0-win32-vc8) [install pre-built & set env. vars.]
-ACE [build & set env. vars.]
+ -Graphviz(http://www.graphviz.org/Download..php),
+ -Install latest version (X.YZ) in program files, then set the path for the bin folder like so:
+ -set Path=C:\Program Files\GraphvizX.YZ\Bin;%PATH%
-FIRST TIME
-Checkout SA-POP (can be placed anywhere; example is under C:\C2W so %SAPOP_ROOT% would be C:\C2W\SA_POP)
cd \C2W
@@ -56,5 +60,38 @@ SA-POP Core:
devenv /build "Debug|Win32" SAPOP_Standalone.sln
+inputFed Federate:
+-Run %C2WTROOT%\src\cpp\demoSAPOP\inputFed\inputFed.sln file.
+-Compile release version.
SA-POP Federate:
+
+-Generate the code from demoSAPOP model in %C2WTROOT%\src\models\demoSAPOP
+-Generate the deployment scripts from demoSAPOP model in %C2WTROOT%\src\models\demoSAPOP
+-If you haven't made the environment variables for SA-POP and ACe global, you need to include them at the top of the deployment script in :
+ %C2WTROOT%\generated\scripts\demoSAPOP
+-Generate (or regenerate) MSVC++ projects and solution.
+ cd %C2WTROOT%\src\cpp\demoSAPOP\SAPOP
+ perl %ACE_ROOT%\bin\mpc.pl -type vc8 SAPOPFed.mpc
+
+-Run SAPOPFed.sln file. Compile Debug version.
+
+
+Running the Demo:
+The Demo is a small federation. There is an input federate and then the SA-POP federate. The inputFed takes as input a script. The script is a newline delimited file of time slices, and conditions to activate as either true or false(1 == true, 0 == false). Look in the %C2WTROOT%\src\cpp\demoSAPOP\inputFed for two example scripts. To run one, recompile the federate with the absolute path listed in the string at the top of inputFed.cpp. This will run that script when the federation is running. At each time step, the inputFed finds the condition and passes that to the SAPOPFed through a CondEvent interaction. The SAPOPFed reads from this and updates its SANet. It then replans and each step produces a small graphical visual of what must be accomplished in the environment. The SANet is a modified version of the demo scenario .In it, the UAV's and Ground forces are trying to stop the Vehicle with the IED from reaching the destination. TestScript1 shows the use of ground forces. TestScript2 uses the UAVs to carry out the mission with missiles. The Graph shows the last step that occurred. The Action to be completed next is green. The Conditions to be satisfied next is in orange.
+
+To run:
+From cygwin run the script you either modified for the Environment Variables and Path above or just from:
+ -%C2WTROOT%\generated\scripts\demoSAPOP
+
+When the SAPOPFed comes up, it will ask which goals to plan for in the scenario. This is where the planner wants to know what you want to accomplish
+in the domain. So for the demo, say you want to plan for 2 goals. The first is 2012 with a utility of 10. The second is 2014 with a utility of 10.
+
+
+Then the input fed asks for a character and a return so it can send the next event. The planning is done when the graphic visualization comes up.
+
+
+
+After being satisfied with the current visualization, go back to the inputFed and enter another character. This controls when the next event is sent from the script. Continue until the inputFed says that the script has ended.
+
+ \ No newline at end of file
diff --git a/SA_POP/C2W/LogGraphOut.cpp b/SA_POP/C2W/LogGraphOut.cpp
deleted file mode 100644
index 3cbbb0c0005..00000000000
--- a/SA_POP/C2W/LogGraphOut.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-// -*- C++ -*-
-//
-
-//=============================================================================
-/**
- * @file LogGraphOut.cpp
- *
- * This file contains the LogGraphOut class implementation for the output adapter
- * that displays graph visualizations of the plan.
- *
- * @author Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
- */
-//=============================================================================
-
-//For Spawning a new Thread:
-//#include <windows.h>
-
-
-#include <iostream>
-#include <algorithm>
-#include <time.h>
-#include "SA_POP_Types.h"
-#include "LogGraphOut.h"
-#include "Planner.h"
-#include <fstream>
-#include <vector>
-//#include "gvc.h"
-//#include "mfg_draw_graph.h"
-//#include "mfg_graph_drawer.h"
-
-using namespace SA_POP;
-
-// Constructor.
-LogGraphOut::LogGraphOut (std::ostream &out, int startstep)
-: out_ (out)
-{
- graphn = startstep;
- // Nothing to do.
-}
-
-// Destructor.
-LogGraphOut::~LogGraphOut (void)
-{
- // Nothing to do.
-}
-
-// Notify about task future expected utility changes.
-void LogGraphOut::notify_eu (SA_POP::Planner *planner)
-{
- time_t cur_time = time(0);
- this->out_ << std::endl;
- this->out_ << "EU Changes:" << std::endl;
- this->out_ << ctime (&cur_time) << std::endl;
-
- TaskEUMap eu_changes = planner->get_eu_changes ();
- for (TaskEUMap::iterator iter = eu_changes.begin ();
- iter != eu_changes.end ();
- iter++)
- {
- this->out_ << "Task " << iter->first << " = " << iter->second;
- this->out_ << std::endl;
- }
-}
-
-unsigned long WINAPI SecondThread(PVOID pvParam)
-{
- system("dot -Tgif GViz.dot -o step.gif");
- system("step.gif");
- return 0;
-}
-
-
-// Notify about plan changes.
-void LogGraphOut::notify_plan (SA_POP::Planner *planner)
-{
- Plan plan = planner->get_plan ();
-
- time_t cur_time = time(0);
-
- /*
- GVC_t *gvc;
- graph_t *g;
- FILE *fp;
-
- mfg::DrawGraph * graph;
- */
-
- //gvc = gvContext();
- //This
- this->out_ << std::endl;
- this->out_ << "Plan (" << plan.name << ") Changed at " << std::endl;
- this->out_ << ctime (&cur_time) << std::endl;
- this->out_ << "ID: " << plan.plan_id << std::endl;
-
- this->out_ << "Start Window: [" << plan.start_window.first << ", ";
- this->out_ << plan.start_window.second << "]" << std::endl;
-
- this->out_ << "End Window: [" << plan.end_window.first << ", ";
- this->out_ << plan.end_window.second << "]" << std::endl;
-
- std::vector<int> startimes;
-
- //Find the plan, and find the ealiest time for the latest time step
- //Make sure we don't run out of bounds
- int lastime = 0;
- int plansize = 0;
- if(graphn > 0)
- {
- for (PlanInstSet::iterator inst_iter = plan.task_insts.begin ();
- inst_iter != plan.task_insts.end ();
- inst_iter++)
- {
- PlanTaskInst inst = *inst_iter;
- startimes.push_back(inst.start_window.first);
- }
-
- std::sort(startimes.begin(), startimes.end());
- if(graphn < startimes.size())
- {
- lastime = startimes[graphn];
- }
- else
- {
- lastime = startimes[startimes.size() - 1];
- }
-
- }
-
- //Open File we are going to save to, constant for the moment.
-
- ofstream gfile;
- gfile.open("GViz.dot");
-
-
- gfile << "strict digraph graph" << graphn << " {\n";
- planner->print_graph(gfile);
- if(graphn == 0)
- {
- for (CLSet::iterator cl_iter = plan.causal_links.begin ();
- cl_iter != plan.causal_links.end ();
- cl_iter++)
- {
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << "[shape=box];\n";
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " -> ";
- gfile << planner->get_cond_name (clink.cond.id) << ";\n";
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "[shape=box];\n";
- gfile << "\t" << planner->get_cond_name (clink.cond.id) << " -> ";
- gfile << planner->get_task_name (
- planner->get_task_from_inst (clink.second)) << "\n";
- }
- }
- else
- {
- for (CLSet::iterator cl_iter = plan.causal_links.begin ();
- cl_iter != plan.causal_links.end ();
- cl_iter++)
- {
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
-
- if(planner->get_start_window (clink.first).first <= lastime)
- {
- if(planner->get_start_window (clink.first).first == lastime)
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= green];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- else
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= blue];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = blue];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
-
- if(planner->get_start_window (clink.second).first <= lastime)
- {
- if(planner->get_start_window (clink.second).first == lastime)
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = green];\n";
- //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
- }
- else
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = blue];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = blue];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
-
- }
- }
- }
- }
-
- }
- gfile << "}\n";
-
- gfile.close();
- this->out_ << std::endl;
-
- //Regardless, we turn it into a gif and display it Now with Threading.
- unsigned long dwThreadId;
- // Create a new thread.
- char *imageName = "step.gif";
- HANDLE hThread = CreateThread(NULL, 0, SecondThread, (PVOID) imageName,
- 0, &dwThreadId);
- CloseHandle(hThread);
- //system("dot -Tgif GViz.dot -o step.gif");
- //system("step.gif");
-
- for (SchedLinkSet::iterator sched_iter = plan.sched_links.begin ();
- sched_iter != plan.sched_links.end ();
- sched_iter++)
- {
- SchedLink sched_link = (*sched_iter);
- this->out_ << "Scheduling Link:" << std::endl;
- this->out_ << " " << sched_link.first << " (";
- this->out_ << planner->get_task_name (
- planner->get_task_from_inst (sched_link.first)) << ") -> ";
- this->out_ << sched_link.second << " (";
- this->out_ << planner->get_task_name (
- planner->get_task_from_inst (sched_link.second)) << ")" << std::endl;
-
- }
-
-
- this->out_ << std::endl;
-};
-
-
-void LogGraphOut::moveStep()
-{
- graphn++;
-};
-
-void LogGraphOut::resetStep()
-{
- graphn = 1;
-}; \ No newline at end of file
diff --git a/SA_POP/C2W/LogGraphOut.h b/SA_POP/C2W/LogGraphOut.h
deleted file mode 100644
index 070a8b51d3f..00000000000
--- a/SA_POP/C2W/LogGraphOut.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// -*- C++ -*-
-//
-
-//=============================================================================
-/**
- * @file LogGraphOut.h
- *
- * This file contains the Class Description for LogGraph which is an output adapater
- * that creates graphic visualizations of the output plan.
- *
- * @author Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
- */
-//=============================================================================
-
-#ifndef SA_POP_LOG_GRAPH_OUT_H_
-#define SA_POP_LOG_GRAPH_OUT_H_
-
-#include <iostream>
-#include "OutAdapter.h"
-
-namespace SA_POP {
-
- /**
- * @class LogGraphOut
- *
- * @brief Output adapter that creates a graph visualization of the plan
- * as they occur.
- */
- class LogGraphOut : public OutAdapter {
- public:
- /// Constructor.
- /**
- * @param strm Output stream to log to.
- */
- LogGraphOut (std::ostream &out, int startStep);
-
- /// Destructor.
- virtual ~LogGraphOut (void);
-
- /// Notify about task future expected utility changes.
- /**
- * @param planner Planner for which changes have occurred.
- */
- virtual void notify_eu (SA_POP::Planner *planner);
-
- /// Notify about plan changes.
- /**
- * @param planner Planner for which changes have occurred.
- */
- virtual void notify_plan (SA_POP::Planner *planner);
-
- /// Advance the drawing by one step in the plan
- /**
- *
- */
- void moveStep();
-
- /// Go Back to the Beginning
- /**
- *
- */
- void resetStep();
-
- protected:
- /// Output stream to log to.
- std::ostream &out_;
- int graphn;
- };
-
-}; /* SA_POP namespace */
-
-#endif /* SA_POP_LOG_GRAPH_OUT_H_ */
diff --git a/SA_POP/ChangeLog b/SA_POP/ChangeLog
index 66c6240bfd5..147b38de35d 100644
--- a/SA_POP/ChangeLog
+++ b/SA_POP/ChangeLog
@@ -1,35 +1,45 @@
+Fri Mar 20 23:10:39 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * C2W/Instructions for building SA-POP Federate.txt:
+ Updated for how to run the SA-POP Federate.
+
+ * C2W/LogGraphOut.h:
+ * C2W/LogGraphOut.cpp:
+
+ Removed these files.
+
Fri Mar 20 19:45:41 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
* C2W/C2W_Demo.mpc:
- Removed the LogGraphOut class as part of the project.
+ Removed the LogGraphOut class as part of the project.
* C2W/C2W_Demo.cpp:
- Added the Replan functions into the demo. Also made some changes on keeping track of external conditoon.
+ Added the Replan functions into the demo. Also made some changes on keeping track of external conditoon.
* LogGraphOut.h:
- Added to SA-POP Root and Exported out for the Library
+ Added to SA-POP Root and Exported out for the Library
* LogGraphOut.cpp:
- Added to SA-POP Root
+ Added to SA-POP Root
* LogGraphOut_Export.h:
- Generated to provide accessibility as an outside hook into the Library.
+ Generated to provide accessibility as an outside hook into the Library.
* Planner.h:
- Added function prototype for updating effect link(update_effect) and printing the entire SANet for Visualization(print_graph)
+ Added function prototype for updating effect link(update_effect) and printing the entire SANet for Visualization(print_graph)
* Planner.cpp:
- Implements the functions update_effect and print_graph for the Planner.
+ Implements the functions update_effect and print_graph for the Planner.
* SANet/SANet.h:
- Added function prototype for update_effect_link, which propogates the effect link change to the SANet itself.
- Added function prototype for print_graphviz, which prints the SANet out into the graphviz dot framework.
+ Added function prototype for update_effect_link, which propogates the effect link change to the SANet itself.
+ Added function prototype for print_graphviz, which prints the SANet out into the graphviz dot framework.
* SANet/SANet.cpp:
- Implements the two new prototypes: update_effect_link and print_graphviz
+ Implements the two new prototypes: update_effect_link and print_graphviz
* SAPOP_w_ACE.mpc:
- Added the LogGraphOut as part of the SAPOP project, and allows it to export out the functionality to programs that link to the SAPOP library
+ Added the LogGraphOut as part of the SAPOP project, and allows it to export out the functionality to programs that link to the SAPOP library
Thu Mar 19 21:45:00 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>