diff --git a/description.lua b/description.lua index 1f65a62..6dbd996 100644 --- a/description.lua +++ b/description.lua @@ -1,4 +1,4 @@ -version = "0.6.1" +version = "0.6.2" license = "GPL" package = "sysdyn" depends = "terrame (>= 2.0), sci (>= 0.3)" diff --git a/images/coffee.bmp b/images/coffee.bmp new file mode 100644 index 0000000..febd5c8 Binary files /dev/null and b/images/coffee.bmp differ diff --git a/images/coffee.lua b/images/coffee.lua new file mode 100644 index 0000000..087b5a1 --- /dev/null +++ b/images/coffee.lua @@ -0,0 +1,10 @@ + +import("sysdyn") + +c = Coffee{} + +c:run() + +c.chart:save("coffee.bmp") +clean() + diff --git a/log/mac/Coffee-chart-1.bmp b/log/mac/Coffee-chart-1.bmp new file mode 100644 index 0000000..febd5c8 Binary files /dev/null and b/log/mac/Coffee-chart-1.bmp differ diff --git a/log/mac/Daisyworld-chart-1.bmp b/log/mac/Daisyworld-chart-1.bmp new file mode 100644 index 0000000..09f3bc6 Binary files /dev/null and b/log/mac/Daisyworld-chart-1.bmp differ diff --git a/log/mac/Daisyworld-chart-2.bmp b/log/mac/Daisyworld-chart-2.bmp new file mode 100644 index 0000000..5885acf Binary files /dev/null and b/log/mac/Daisyworld-chart-2.bmp differ diff --git a/log/mac/Daisyworld-chart-3.bmp b/log/mac/Daisyworld-chart-3.bmp new file mode 100644 index 0000000..e3de3bd Binary files /dev/null and b/log/mac/Daisyworld-chart-3.bmp differ diff --git a/log/mac/Daisyworld-chart-4.bmp b/log/mac/Daisyworld-chart-4.bmp new file mode 100644 index 0000000..91d60cb Binary files /dev/null and b/log/mac/Daisyworld-chart-4.bmp differ diff --git a/log/mac/SIR-chart-1.bmp b/log/mac/SIR-chart-1.bmp new file mode 100644 index 0000000..1a5598a Binary files /dev/null and b/log/mac/SIR-chart-1.bmp differ diff --git a/log/mac/population-growth.png b/log/mac/population-growth.png index 053d93a..71d28e4 100644 Binary files a/log/mac/population-growth.png and b/log/mac/population-growth.png differ diff --git a/log/mac/predator-prey-1.png b/log/mac/predator-prey-1.png index f5ec9c2..218c5c1 100644 Binary files a/log/mac/predator-prey-1.png and b/log/mac/predator-prey-1.png differ diff --git a/log/mac/predator-prey-2.png b/log/mac/predator-prey-2.png index 4b358e6..4b36cc7 100644 Binary files a/log/mac/predator-prey-2.png and b/log/mac/predator-prey-2.png differ diff --git a/lua/ChaoticGrowth.lua b/lua/ChaoticGrowth.lua index b29af41..daaf563 100644 --- a/lua/ChaoticGrowth.lua +++ b/lua/ChaoticGrowth.lua @@ -1,13 +1,7 @@ --- A Model that describes a chaotic population growth. -- @arg data.pop The initial population. The default value is 0.1. -- @arg data.rate The rate that multiplies the population size in each time step. The degault value is 4. --- @arg data.deltaTime A numeric value with the period to execute the changes of --- the model. The default value is one. --- @arg data.updateTime A numeric value with the period to update the charts. --- The default value is one. -- @arg data.finalTime The final time of the simulation. The default value is 300. --- @arg data.view A table with two boolean elements, timeSeries and cobWeb (default true), --- indicating whether a time series charts should be drawn. -- @image chaotic-growth.bmp ChaoticGrowth = Model{ pop = 0.10, diff --git a/lua/Daisyworld.lua b/lua/Daisyworld.lua index 953676e..dbf7b80 100644 --- a/lua/Daisyworld.lua +++ b/lua/Daisyworld.lua @@ -72,11 +72,15 @@ end -- white according to their reflectivity or albedo. -- @arg data.sunLuminosity Sun luminosity (this is the main variable of the model). -- Values beteween 0.70 and 1.6 support life in Daisyworld. +-- @arg data.daisyArea The initial daisy area, which is the sum of white and +-- black areas. The default value is 0.673. -- @arg data.planetArea The total area of the planet. The sum of the arguments -- whiteArea, blackArea, and emptyArea should be equals to this value. The default value is 1. -- @arg data.whiteArea The initial area of white daisies. The default value is 0.4. -- @arg data.blackArea The initial area of black daisies. The default value is 0.273. -- @arg data.emptyArea The initial empty area. The default value is 0.327. +-- @arg data.planetAlbedo The initial planet albedo, which is a weighted sum +-- based on the areas of daisies and their albedos. -- @arg data.whiteAlbedo The albedo of white area. The default value is 0.75. -- @arg data.blackAlbedo The albedo of black area. The default value is 0.25. -- @arg data.soilAlbedo The albedo of empty area. The default value is 0.5. diff --git a/lua/LimitedGrowth.lua b/lua/LimitedGrowth.lua index 0603f16..b157d4c 100644 --- a/lua/LimitedGrowth.lua +++ b/lua/LimitedGrowth.lua @@ -3,8 +3,6 @@ -- @arg data.rate The growth rate of the population. -- @arg data.capacity The maximum amount of individuals. -- @arg data.finalTime The number of simulation steps. --- @arg data.view A table with a boolean element timeSeries (default true) indicating whether --- a time series chart should be drawn. -- @image limited-growth.bmp LimitedGrowth = Model{ pop = 300, diff --git a/lua/MonoLake.lua b/lua/MonoLake.lua index b6135ff..3e8d783 100644 --- a/lua/MonoLake.lua +++ b/lua/MonoLake.lua @@ -64,8 +64,6 @@ end -- @arg data.evapRate The evaporation rate in feet/year. -- @arg data.otherOut Other output of water from the lake in KAF/year. -- @arg data.finalTime The final time of the simulation. The default value is 50. --- @arg data.view A table with a boolean element timeSeries (default true) indicating whether --- a time series chart should be drawn. -- @image monolake.bmp MonoLake = Model{ waterInLake = 2228.0, -- kiloAcre * feet diff --git a/lua/PredatorPrey.lua b/lua/PredatorPrey.lua index f712ddc..c604faf 100644 --- a/lua/PredatorPrey.lua +++ b/lua/PredatorPrey.lua @@ -43,6 +43,8 @@ PredatorPrey = Model{ xAxis = "prey" } + if model.period == 1 then model.period = nil end + model.timer = Timer{ Event{action = model, period = model.period}, Event{action = model.chart1}, diff --git a/lua/RandomWalk.lua b/lua/RandomWalk.lua index 6026e90..5c715f7 100644 --- a/lua/RandomWalk.lua +++ b/lua/RandomWalk.lua @@ -5,12 +5,6 @@ -- time step. The available values are 0, 0.3, 0.5 (default), 0.7, 0.95, and 1. -- @arg data.finalTime The final time of the simulation. It should be -- at least 10. The default value is 100. --- @arg data.deltaTime A numeric value with the period to execute the changes of --- the model. The default value is one. --- @arg data.updateTime A numeric value with the period to update the charts. --- The default value is one. --- @arg data.view A table with a boolean element timeSeries (default true) indicating whether --- a time series chart should be drawn. -- @image random-walk.bmp RandomWalk = Model{ value = 0, diff --git a/lua/RoomTemperature.lua b/lua/RoomTemperature.lua index 20d9221..8d52f14 100644 --- a/lua/RoomTemperature.lua +++ b/lua/RoomTemperature.lua @@ -1,8 +1,4 @@ --- Simple model that simulates the temperature of three rooms. --- @arg data.temperature1 The initial temperature of the first room. The default value is 80. --- @arg data.temperature2 The initial temperature of the second room. The default value is 20. --- @arg data.temperature3 The initial temperature of the third room. The default value is 5. --- @arg data.exterior The temperature outside the rooms. The default value is 20. -- @arg data.finalTime The final time of the simulation. The default value is 100. -- @arg data.outside The temperature outside the room. The default value is 1. -- @arg data.inside The temperature inside the room. The default initial value is 15. @@ -12,8 +8,6 @@ -- @arg data.thermalInertia The percentage of input heat every time step according to the -- difference between the temperature inside the room and the one selected in the thermostat. -- The default value is 0.3. --- @arg data.view A table with a boolean element timeSeries (default true) indicating whether --- a time series chart should be drawn. -- @image room-temperature.bmp RoomTemperature = Model{ tempSet = 20.0, diff --git a/tests/Coffee.lua b/tests/Coffee.lua new file mode 100644 index 0000000..7402a8e --- /dev/null +++ b/tests/Coffee.lua @@ -0,0 +1,13 @@ +-- Test file for Coffee.lua +-- Author: Gilberto Camara and Pedro R. Andrade + +return{ + Coffee = function(unitTest) + local model = Coffee{} + + model:run() + + unitTest:assertSnapshot(model.chart, "Coffee-chart-1.bmp") + end, +} + diff --git a/tests/Daisyworld.lua b/tests/Daisyworld.lua index e937416..0921e19 100644 --- a/tests/Daisyworld.lua +++ b/tests/Daisyworld.lua @@ -6,7 +6,11 @@ return{ local model = Daisyworld{} model:run() - unitTest:assertSnapshot(model.chart, "daisyworld.png") + + unitTest:assertSnapshot(model.chart1, "Daisyworld-chart-1.bmp") + unitTest:assertSnapshot(model.chart2, "Daisyworld-chart-2.bmp") + unitTest:assertSnapshot(model.chart3, "Daisyworld-chart-3.bmp") + unitTest:assertSnapshot(model.chart4, "Daisyworld-chart-4.bmp") end, } diff --git a/tests/PopulationGrowth.lua b/tests/PopulationGrowth.lua index 24958cc..7e5155b 100644 --- a/tests/PopulationGrowth.lua +++ b/tests/PopulationGrowth.lua @@ -5,7 +5,7 @@ return{ PopulationGrowth = function(unitTest) local p = PopulationGrowth{} p:run() - unitTest:assertEquals(p.growthChange, 0.8, 0.01) + unitTest:assertEquals(p.growthChange, 1, 0.01) unitTest:assertSnapshot(p.chart, "population-growth.png") end, } diff --git a/tests/PredatorPrey.lua b/tests/PredatorPrey.lua index bf2a782..5901d7b 100644 --- a/tests/PredatorPrey.lua +++ b/tests/PredatorPrey.lua @@ -6,7 +6,7 @@ return{ local p = PredatorPrey{} p:run() - unitTest:assertEquals(p.wolves, 41, 0.1) + unitTest:assertEquals(p.predator, 41, 0.1) unitTest:assertSnapshot(p.chart1, "predator-prey-1.png") unitTest:assertSnapshot(p.chart2, "predator-prey-2.png") end, diff --git a/tests/SIR.lua b/tests/SIR.lua new file mode 100644 index 0000000..e823baa --- /dev/null +++ b/tests/SIR.lua @@ -0,0 +1,13 @@ +-- Test file for SIR.lua +-- Author: Gilberto Camara and Pedro R. Andrade + +return{ + SIR = function(unitTest) + local model = SIR{} + + model:run() + + unitTest:assertSnapshot(model.chart, "SIR-chart-1.bmp") + end, +} +