Skip to content

Commit

Permalink
added uilabels and reordered for Cycic
Browse files Browse the repository at this point in the history
  • Loading branch information
Meghan McGarry committed Jun 7, 2015
1 parent 5d1c182 commit 7818cba
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 131 deletions.
99 changes: 62 additions & 37 deletions agents/k_facility.h
Expand Up @@ -137,67 +137,92 @@ class KFacility : public cyclus::Facility {

private:
/// This facility has one output commodity and one input commodity
#pragma cyclus var {"tooltip": "input commodity", \
"doc": "commodity that the k-facility consumes", \
"schematype": "token", \
"uitype": "incommodity"}
#pragma cyclus var { \
"tooltip": "input commodity", \
"doc": "commodity that the k-facility consumes", \
"schematype": "token", \
"uilabel": "Input Commodity", \
"uitype": "incommodity" \
}
std::string in_commod;

#pragma cyclus var {"tooltip": "output commodity", \
"doc": "commodity that the k-facility supplies", \
"schematype": "token", \
"uitype": "outcommodity"}
std::string out_commod;

/// Name of the recipe this facility uses.
#pragma cyclus var {"shape": [50], "tooltip": "in-commodity recipe name", \
"doc": "recipe name for the k-facility's in-commodity", \
"schematype": "token", \
"uitype": "recipe"}
#pragma cyclus var { \
"shape": [50], \
"tooltip": "in-commodity recipe name", \
"doc": "recipe name for the k-facility's in-commodity", \
"schematype": "token", \
"uilabel": "Input Recipe", \
"uitype": "recipe" \
}
std::string recipe_name;

#pragma cyclus var { \
"tooltip": "output commodity", \
"doc": "commodity that the k-facility supplies", \
"schematype": "token", \
"uilabel": "Output Commodity", \
"uitype": "outcommodity" \
}
std::string out_commod;

/// The capacity is defined in terms of the number of units of the
/// recipe that can be provided each time step. A very large number
/// can be provided to represent infinte capacity.
/// In and out commodity capacities are defined.
#pragma cyclus var {"tooltip": "input commodity capacity", \
"doc": "number of commodity units that can be taken " \
"at each time step (infinite capacity can be " \
"represented by a very large number"}
#pragma cyclus var { \
"tooltip": "input commodity capacity", \
"doc": "number of commodity units that can be taken at each timestep " \
"(infinite capacity can be represented by a very large number)", \
"uilabel": "Incoming Throughput" \
}
double in_capacity;

#pragma cyclus var {"tooltip": "output commodity capacity", \
"doc": "number of commodity units that can be " \
"supplied at each time step (infinite " \
"capacity can be represented by a very large " \
"number"}
#pragma cyclus var { \
"tooltip": "output commodity capacity", \
"doc": "number of commodity units that can be supplied at each timestep " \
"(infinite capacity can be represented by a very large number)", \
"uilabel": "Outgoing Throughput" \
}
double out_capacity;

/// The output capacity at the current time step.
#pragma cyclus var {"default": 0, "tooltip": "current output capacity", \
"doc": "number of output commodity units that can be " \
"supplied at the current time step (infinite " \
"capacity can be represented by a very large " \
"number"}
#pragma cyclus var { \
"default": 0, \
"tooltip": "current output capacity", \
"doc": "number of output commodity units that can be supplied at " \
"the current time step (infinite " \
"capacity can be represented by a very large number )", \
"uilabel": "Current Capacity" \
}
double current_capacity;

#pragma cyclus var {"default": 1e299, "tooltip": "k-facility maximum " \
"inventory size", \
"doc": "total maximum inventory size of the k-facility"}
#pragma cyclus var { \
"default": 1e299, \
"tooltip": "k-facility maximum inventory size", \
"doc": "total maximum inventory size of the k-facility", \
"uilabel": "Maximum Inventory" \
}
double max_inv_size;

#pragma cyclus var {'capacity': 'max_inv_size'}
cyclus::toolkit::ResourceBuff inventory;

/// Conversion factors for input and output amounts.
#pragma cyclus var {"tooltip": "input k-factor", \
"doc": "conversion factor that governs the behavior " \
"of the k-facility's input commodity capacity"}
#pragma cyclus var { \
"tooltip": "input k-factor", \
"doc": "conversion factor that governs the behavior " \
"of the k-facility's input commodity capacity", \
"uilabel": "Input K-Factor" \
}
double k_factor_in;

#pragma cyclus var {"tooltip": "output k-factor", \
"doc": "conversion factor that governs the behavior " \
"of the k-facility's output commodity capacity"}
#pragma cyclus var { \
"tooltip": "output k-factor", \
"doc": "conversion factor that governs the behavior " \
"of the k-facility's output commodity capacity", \
"uilabel": "Output K-Factor" \
}
double k_factor_out;
};

Expand Down
138 changes: 91 additions & 47 deletions agents/predator.h
Expand Up @@ -53,78 +53,122 @@ class Predator : public cyclus::Facility {
void GiveBirth();

private:
#pragma cyclus var {"tooltip": "predator commodity", \
"doc": "commodity that the predator supplies", \
"schematype": "token", \
"uitype": "outcommodity"}
#pragma cyclus var { \
"tooltip": "predator commodity", \
"doc": "commodity that the predator supplies", \
"schematype": "token", \
"uilabel": "Predator Commodity", \
"uitype": "outcommodity" \
}
std::string commod;

#pragma cyclus var {"tooltip": "predator's prey", \
"doc": "prey that the predator hunts", \
"schematype": "token", \
"uitype": "incommodity"}
#pragma cyclus var { \
"tooltip": "predator's prey", \
"doc": "prey that the predator hunts", \
"schematype": "token", \
"uilabel": "Prey Commodity", \
"uitype": "incommodity" \
}
std::string prey;

/// How many prey until we're full
#pragma cyclus var {'default': 1, "tooltip": "feast size", \
"doc": "how many units of prey a predator " \
"consumes until it is satisfied"}
#pragma cyclus var { \
'default': 1, \
"tooltip": "feast size", \
"doc": "how many units of prey a predator consumes until it is satisfied",\
"uilabel": "Feast Size" \
}
double full;

/// How many prey we can catch on the hunt
#pragma cyclus var {'default': 1, "tooltip": "hunting yield", \
"doc": "how many units of prey a predator " \
"can catch during a hunt"}
double hunt_cap;

/// How often we hunt
#pragma cyclus var {'default': 1, "tooltip": "hunting frequency", \
"doc": "how often a predator needs to hunt"}
#pragma cyclus var {\
'default': 1, \
"tooltip": "hunting frequency", \
"doc": "how often a predator needs to hunt", \
"uilabel": "Hunting Frequency" \
}
int hunt_freq;

/// How many prey we can catch on the hunt
#pragma cyclus var { \
'default': 1, \
"tooltip": "hunting yield", \
"doc": "how many units of prey a predator can catch during a hunt", \
"uilabel": "Hunting Yield" \
}
double hunt_cap;

/// Hunting success on a scale from 0 to 1
#pragma cyclus var {'default': 1, "tooltip": "hunting success fraction", \
"doc": "fraction of hunting success on a scale " \
"from 0 to 1"}
#pragma cyclus var {\
'default': 1, \
"tooltip": "hunting success fraction", \
"doc": "fraction of hunting success on a scale from 0 to 1", \
"uilabel": "Hunting Success Fraction" \
}
double success;

#pragma cyclus var {'default': 1, "tooltip": "number of children", \
"doc": "number of predator children born at " \
"each birthing instance"}
double nchildren;
/// Consumption this time step
#pragma cyclus var {\
'default': 0, \
"tooltip": "prey consumed", \
"doc": "how many units of prey consumed per time step", \
"uilabel": "Prey Consumed" \
}
double consumed;

/// Whether or not to base hunt succes on relative prey/predator populations
#pragma cyclus var { \
'default': 0, \
"tooltip": "hunting success factor", \
"doc": "whether or not to base hunting success on " \
"relative predator/prey populations", \
"uilabel": "Hunting Success Factor" \
} // false
bool hunt_factor;

/// Age of a predator
#pragma cyclus var {'default': 0, "tooltip": "predator age", \
"doc": "age of predator at beginning of simulation"}
#pragma cyclus var {\
'default': 0, \
"tooltip": "predator age", \
"doc": "age of predator at beginning of simulation", \
"uilabel": "Predator Age" \
}
int age;

#pragma cyclus var {'default': 1, "tooltip": "predator lifespan", \
"doc": "how long a predator lives"}
#pragma cyclus var { \
'default': 1, \
"tooltip": "predator lifespan", \
"doc": "how long a predator lives", \
"uilabel": "Predator Lifespan" \
}
int lifespan;

#pragma cyclus var {'default': 0, "tooltip": "dead?", \
"doc": "flag for whether predator is currently dead"}
#pragma cyclus var { \
'default': 0, \
"tooltip": "dead?", \
"doc": "flag for whether predator is currently dead", \
"uilabel": "Predator Dead?" \
}
bool dead;

/// Whether or not to base hunt succes on relative prey/predator populations
#pragma cyclus var {'default': 0, "tooltip": "hunting success factor", \
"doc": "whether or not to base hunting success on " \
"relative predator/prey populations"} // false
bool hunt_factor;
#pragma cyclus var { \
'default': 1, \
"tooltip": "number of children", \
"doc": "number of predator children born at each birthing instance", \
"uilabel": "Number Predator Children" \
}
double nchildren;

/// Whether or not an agent can give birth and die in the same timestep
#pragma cyclus var {'default': 0, "tooltip": "simultaneous birth " \
"and death?", \
"doc": "whether or not simultaneous birth and " \
"and death are allowed (i.e., can a " \
"facility give birth and die in the " \
"same time step?)"} // false
#pragma cyclus var { \
'default': 0, \
"tooltip": "simultaneous birth and death?", \
"doc": "whether or not simultaneous birth and death are allowed " \
"(i.e., can a facility give birth and die in the same time step?)", \
"uilabel": "Simultaneous Birth and Death?" \
} // false
bool birth_and_death;

/// Consumption this time step
#pragma cyclus var {'default': 0, "tooltip": "prey consumed", \
"doc": "how many units of prey consumed per time step"}
double consumed;
};

} // namespace cyclus
Expand Down
66 changes: 42 additions & 24 deletions agents/prey.h
Expand Up @@ -55,38 +55,56 @@ class Prey : public cyclus::Facility {
void GiveBirth();

private:
#pragma cyclus var {"schematype": "token", \
"uitype": "outcommodity"}
#pragma cyclus var { \
"schematype": "token", \
"uilabel": "Prey Commodity", \
"uitype": "outcommodity" \
}
std::string commod;

/// Number of timsteps between having children
#pragma cyclus var {'default': 1, "tooltip": "birth frequency", \
"doc": "number of time steps between birth " \
"of children"}
int birth_freq;
/// Age of a prey
#pragma cyclus var { \
'default': 0, \
"tooltip": "prey age", \
"doc": "age of prey at start of simulation", \
"uilabel": "Prey Age" \
}
int age;

#pragma cyclus var { \
'default': 0, \
"tooltip": "dead?", \
"doc": "flag for whether prey is currently dead", \
"uilabel": "Dead?" \
}
bool dead;

// Number of children
#pragma cyclus var {'default': 1, "tooltip": "number of children", \
"doc": "number of children born at each " \
"birthing instance"}
#pragma cyclus var { \
'default': 1, \
"tooltip": "number of children", \
"doc": "number of children born at each birthing instance", \
"uilabel": "Number of Children" \
}
int nchildren;

/// Age of a prey
#pragma cyclus var {'default': 0, "tooltip": "prey age", \
"doc": "age of prey at start of simulation"}
int age;

#pragma cyclus var {'default': 0, "tooltip": "dead?", \
"doc": "flag for whether prey is currently dead"}
bool dead;
/// Number of timsteps between having children
#pragma cyclus var { \
'default': 1, \
"tooltip": "birth frequency", \
"doc": "number of time steps between birth of children", \
"uilabel": "Birth Frequency" \
}
int birth_freq;

/// Whether or not an agent can give birth and die in the same timestep
#pragma cyclus var {'default': 1, "tooltip": "simultaneous birth " \
"and death?", \
"doc": "whether or not simultaneous birth and " \
"and death are allowed (i.e., can a " \
"facility give birth and die in the " \
"same time step?)"} // true
#pragma cyclus var { \
'default': 1, \
"tooltip": "simultaneous birth and death?", \
"doc": "whether or not simultaneous birth and death are allowed (i.e., " \
"can a facility give birth and die in the same time step?)", \
"uilabel": "Simultaneous Birth and Death?" \
} // true
bool birth_and_death;
};

Expand Down

0 comments on commit 7818cba

Please sign in to comment.