diff --git a/trick_sims/SIM_waterclock/README.md b/trick_sims/SIM_waterclock/README.md index 6093628d..4470dda2 100644 --- a/trick_sims/SIM_waterclock/README.md +++ b/trick_sims/SIM_waterclock/README.md @@ -14,11 +14,11 @@ Assumptions: * Buckets and spouts are perfectly cylindrical. ### A Brief History -The water clock (or clepsydra to the ancient Greek) is a device used to measure time through the displacement of water. It is not known precisely when the earliest water clocks were developed, but they have been discovered to exist in various parts of the world as early as the 16th century BC. These early designs were relatively simple compared to later designs, consiting of a bowl with markings to indicate time passing as the bowl either filled or drained. +The water clock (or clepsydra to the ancient Greek) is a device used to measure time through the displacement of water. It is not known precisely when the earliest water clocks were developed, but they have been discovered to exist in various parts of the world as early as the 16th century BC. These early designs were relatively simple compared to later designs, consisting of a bowl with markings to indicate time passing as the bowl either filled or drained. -Water clocks remained a prominent timekeeping device until the 17th century when better methods of timekeeping were developed. Over those many centruies, different cultures innovated on the design of the early water clocks. Of particular note were the contributions of the Greek inventor Ctesibius in the 3rd century BC. Ctesibius innovated on the water clock by making it largely automatic. Prior to Ctesibius, water clocks needed to be consistently refilled/emptied by hand. Furthermore, if a water clock had indicators marking the position of the sun, they would need to be manually adjusted for different seasons. Ctesibius automated both these processes. +Water clocks remained a prominent timekeeping device until the 17th century when better methods of timekeeping were developed. Over those many centruies, different cultures innovated on the design of the early water clocks. Of particular note were the contributions of the Greek inventor Κτησιβιος (Ctesibius) in the 3rd century BC. Κτησιβιος innovated on the water clock by making it largely automatic. Prior to Κτησιβιος, water clocks needed to be consistently refilled/emptied by hand. Furthermore, if a water clock had indicators marking the position of the sun, they would need to be manually adjusted for different seasons. Κτησιβιος automated both these processes. -Ctesibius automated the draining process with a siphon akin to a Pythagorean cup. This siphon would empty over a water wheel, which powered a series of gears that would turn a cylinder. The cylinder had a row of irregular rings drawn around it, meant to correlate with the position of the sun throughout the seasons. Each day, as the water clock would fill it would accurately indicate the position of the sun, drain itself at the end of the day, and adjust the cylinder to be accurate for the next day. +Κτησιβιος automated the draining process with a siphon akin to a Pythagorean cup. This siphon would empty over a water wheel, which powered a series of gears that would turn a cylinder. The cylinder had a row of irregular rings drawn around it, meant to correlate with the position of the sun throughout the seasons. Each day, as the water clock would fill it would accurately indicate the position of the sun, drain itself at the end of the day, and adjust the cylinder to be accurate for the next day. ### Building the Simulation After building trick, in the SIM\_waterclock directory run the command **trick-CP** to build the sim. When it's complete, you should see: diff --git a/trick_sims/SIM_waterclock/RUN_test/input.py b/trick_sims/SIM_waterclock/RUN_test/input.py index 0648aca5..b73bf209 100644 --- a/trick_sims/SIM_waterclock/RUN_test/input.py +++ b/trick_sims/SIM_waterclock/RUN_test/input.py @@ -24,8 +24,6 @@ dyn.waterclock.timer_bucket_diam = 45.0 dyn.waterclock.total_ticks = 60 -trick.message_unsubscribe(trick_message.mcout) - # ========================================== # Start the Satellite Graphics Client # ========================================== diff --git a/trick_sims/SIM_waterclock/models/waterclock/include/waterclock_numeric.h b/trick_sims/SIM_waterclock/models/waterclock/include/waterclock_numeric.h index eff39022..9cfa11e5 100644 --- a/trick_sims/SIM_waterclock/models/waterclock/include/waterclock_numeric.h +++ b/trick_sims/SIM_waterclock/models/waterclock/include/waterclock_numeric.h @@ -2,7 +2,7 @@ PURPOSE: ( Water Clock Numeric Model ) **************************************************************************/ -#ifndef WATRERCLOCK_NUMERIC_H +#ifndef WATERCLOCK_NUMERIC_H #define WATERCLOCK_NUMERIC_H #include "waterclock.h" @@ -10,10 +10,10 @@ PURPOSE: ( Water Clock Numeric Model ) #ifdef __cplusplus extern "C" { #endif -int waterclock_integ(WATERCLOCK*); -int waterclock_deriv(WATERCLOCK*); -double waterclock_tick_change(WATERCLOCK*); -double waterclock_overflow_timer(WATERCLOCK*); +int waterclock_integ(WATERCLOCK* WC); +int waterclock_deriv(WATERCLOCK* WC); +double waterclock_tick_change(WATERCLOCK* WC); +double waterclock_overflow_timer(WATERCLOCK* WC); void waterclock_update_water_level(WATERCLOCK* WC); #ifdef __cplusplus } diff --git a/trick_sims/SIM_waterclock/models/waterclock/src/waterclock_numeric.c b/trick_sims/SIM_waterclock/models/waterclock/src/waterclock_numeric.c index f7a2ec7b..0e06fd19 100644 --- a/trick_sims/SIM_waterclock/models/waterclock/src/waterclock_numeric.c +++ b/trick_sims/SIM_waterclock/models/waterclock/src/waterclock_numeric.c @@ -115,7 +115,10 @@ double waterclock_tick_change( WATERCLOCK* WC ) { if( (WC->current_tick < WC->total_ticks) && (WC->current_tick >= 0) ) { WC->current_tick += 1; + void * sub_ptr = message_get_subscriber("cout"); + message_remove_subscriber(sub_ptr); message_publish(MSG_NORMAL, "Tick %d, Sim Time %f, Water Level %f\n", WC->current_tick, exec_get_sim_time(), WC->timer_water_level) ; + message_add_subscriber(sub_ptr); } else fprintf(stderr, "ERROR, SOMETHING WENT VERY WRONG!\n" ) ;