Project was done as a semester teamwork at Object-oriented design and Modeling CTU course.
Present project simulates life in smart home. Residents using devices on their needs and living their happiest life.
main
function."config" : "1" |
Current configuration to load (name of folder) |
"duration" : 30 |
Simulation duration (in days) |
Configuration folder should exist in config
directory and have Home.json
, Creature.json
, Device.json
.
Duration should be integer non-negative value.
"HOME" : [1, 2] |
Floors in home |
"FLOOR" : [[1, 2], [3, 4]] |
Rooms at floor (each floor should have it own pair of brackets) |
"ROOM" : ["KITCHEN", "HALL", "TOILET", "BEDROOM"] |
List of rooms (types) |
Numbers are IDs (integer) and should be unique for floors and rooms. They are connected with values in proper array (1-based).
Room types should match these values.
"FRIDGE" : [1, 2, 3] |
Device type and its instances |
Numbers are room IDs (integer).
Device types should match these values.
"name" : "Jirka" |
Person's name |
"gender" : "MALE" |
Person's gender |
"status" : "ADULT" |
Person's family status |
Gender should match these values.
Family status should match these values.
"name" : "Garfield" |
Pet's name |
"gender" : "CAT" |
Pet's type |
Pet type should match these values.
"author" : "MC Adolfeen" |
Author of song |
"album" : "Je mi to jedno" |
Name of album |
"name" : "Corona Firus" |
Name of song |
"genre" : "HIP_HOP" |
Song genre |
"duration" : 3 |
Duration (in minutes) |
Duration should be integer non-negative value.
Song genre should match these values.
"name" : "Baby Shark Dance" |
Name of video |
"description" : "Baby shark, doo doo doo doo doo doo." |
Short video description |
"platform" : "YOUTUBE" |
Video platform (channel, streaming service, ...) |
"duration" : 2 |
Duration (in minutes) |
Duration should be integer non-negative value.
Video platform should match these values.
"name" : "Mafia: The City of Lost Heaven" |
Name of game |
"description" : "Classic Czech game about italian mafia in USA." |
Short game description |
"genre" : "ACTION" |
Game genre |
Game genre should match these values.
"name" : "Bathhouse" |
Configuration name |
"temperature" : 90 |
Set temperature (in ºC) |
"humidity" : 85 |
Set humidity (in %) |
"brightness" : 20 |
Set brightness (in %) |
"color" : [255, 253, 141] |
Set color of light |
Temperature can be negative and float.
Humidity should be in range 0-100. Can be float.
Brightness should be in range 0-100. Can be float.
Color should have three integers in range 0-255 representing RED
, GREEN
, BLUE
components.
"temperature" : [[-10.2, -11.2, ...], ...] |
Temperature map |
"humidity" : [[69.3, 68.1, ...], ...] |
Humidity map |
"brightness" : [[16.8, 16.9, ...], ...] |
Brightness map |
Temperature can be negative and float.
Humidity should be in range 0-100. Can be float.
Brightness should be in range 0-100. Can be float.
Each map should contain 12 arrays of 24 values representing temperature/humidity/brightness in concrete hour of concrete month (starting from 00:00 and January).
Home <- Information about home Floor_1 <- First floor Room_1 (Hall) <- First room TV_1 <- Device Light_1 <- Device Floor_2 <- Second floor Room_2 (Kitchen) <- Second room Microwave_1 <- Device Light_2 <- Device Room_3 (Toilet) <- Third room WC_1 <- Device Residents <- Information about residents Bob (Male, Adult) <- Resident Bark (Dog) <- Resident
Date |
Device |
Electricity |
Water |
Gas |
Money |
Simulation day | Device_ID | Consumed electricity | Consumed water | Consumed gas | Spent money |
12/01/2024 <- Simulation date Bob (Male, Adult) <- Person Activity <- Information about activity 20:25 - Go to Room_2 (Shower) <- Action 20:26 - Put clothes to Washer_1 <- Action 20:26 - Start Washer_1 with 'Washer Intensive program' <- Action 21:26 - Go to Room_3 (Toilet) <- Action 21:27 - Use WC_1 <- Action Usage <- Information about usage Washer_1 - 2 <- Device usage WC_1 - 1 <- Device usage
Created |
Solved |
Type |
Creator |
Solver |
Date, time of creation | Date, time of solution | Event type | Device_ID | Person name |
Main entities in the project are Street, Home, Room, Person, Pet, Device, Sensor.Entities we work with are house, window (+outside blinds), floor in the house, sensor, device (=appliance), person, car, bike, pet other than farm type, plus any other entities.
Most of the devices have API functions that Person use to interact with them (eg.Each device in the house has an API to control it. Devices have a state that can be changed using the API to control it. Actions from the API are applicable according to the state of the device. Selected devices can also have content.
startWash()
in Dishwasher).State of the device impacts device consumption rate using state multiplier. This multiplier applies to default device rate.Appliances have their consumption in active state, idle state, off state.
Every device is consumer and stores amount of consumed resource in Electricity/Water/Gas meters where can be easily taken from.Each device has an API to collect data about that device. We collect data about devices such as electricity, gas, water consumption and functionality (decreases linearly with time).
Persons and pets are interacting with devices using their API functions. It changes actual state of the device (such as device stateIndividual persons and animals can perform activities (actions) that have an effect on the device or another person.
ON
/OFF
/STANDBY
, occupancy and so on).
Both people and devices can be only in one room at the moment, which is quite physically logic. When person is outside (doing sports, went for a walk etc.) he marked as notIndividual devices and persons are in the one room at any time (unless they are doing sports) and randomly generate events (an event can be important information or an alert).
atHome
, but remember the room he lastly was.Events are taken only by persons who can solve it. Solution (as well as reaction) strategy depends on concrete attributes (in our case gender and family status representing age).Events are picked up and handled by the appropriate person(s) or device(s).
House Configuration Report creates once simulation started.Reports generating
- HouseConfigurationReport:
All configuration data of the house maintaining the hierarchy - house -> floor -> room -> window -> blinds etc. (+ residents)
- EventReport:
Report where we group events by type, event source and event target (what entity handled the event)
- ActivityAndUsageReport:
Report of actions (activities) of each person and animal, how many times which person used which device.
- ConsumptionReport:
How much electricity, gas, water each appliance consumed. Including a finances.
.txt
.tsv
Devices can break, which is absolutely natural. It can happen by several reasons:When a device breaks, the house resident must examine the documentation for the device - find the warranty card, review the repair manual and take corrective action (e.g., do-it-yourself repair, purchase a new one, etc.).
All home residents have sequences of actions they can perform.The family is active and spends their leisure time in roughly the same proportion (50% using appliances in the house and 50% playing sports using bicycles or skis). When there is no free appliance or sports equipment, the person waits.
isOccupied
by other person, he is reasonly not able to do this.accept()
visit()
visit(ElectricityConsumer)
visit(WaterConsumer)
visit(GasConsumer)
visit(ElectricityConsumer)
visit(WaterConsumer)
visit(GasConsumer)
visit(ElectricityConsumer)
visit(WaterConsumer)
visit(GasConsumer)
visit(ElectricityConsumer)
visit(WaterConsumer)
visit(GasConsumer)
saveConfiguration()
loadConfiguration()
saveConfiguration()
loadConfiguration()
copy()
clone()
reset()
getHome()
buildHome()
buildFloor()
buildRoom()
createReport()
createReport()
createReport()
createReport()
createReport()
createConfigurationReport()
createConsumptionReports()
createActivityReports()
createEventReports()
readSimulationConfig()
- (A) readHomeConfig()
- (B) readDeviceConfig()
- (A) readCreatureConfig()
- (A) readRoomConfigurationConfig()
- (C) readContentConfig()
- (D) readWeatherConfig()
- (E) createReports()
createConfigurationReport()
createPerson()
createPet()
createDevice()
createSong()
createVideo()
createGame()
execute()
= throwEvent()
doSomething()
= throwEvent()
setStrategy()
is missing because it is set in the constructor execute()
= react()
doSomething()
is used in Creature routine function setStrategy()
is missing because strategies are set in creatures' constructors templateMethod()
= routine()
_step1()
(abstract) = decreaseFullness()
_step2()
(abstract) = decreaseHunger()
_step3()
(abstract) = chooseActivity()
_step4()
(abstract) = reactMaxFullness()
_step5()
= reactMaxHunger()
_step1()
= decreaseFullness()
_step2()
= decreaseHunger()
_step3()
= chooseActivity()
_step4()
= reactMaxFullness()
_step1()
= decreaseFullness()
_step2()
= decreaseHunger()
_step3()
= chooseActivity()
_step4()
= reactMaxFullness()
_subscribers_
= consumedMap
_subscribe()
= addConsumer()
_unsubscribe()
= deleteConsumer()
_notifySubscribers()
= switchRoom()
_update()
= turnOn()
_update()
= turnOff()
_doThis()
= applyWeather()
_setContext()
because context is Singleton._changeState()
= setWeather()
_doThis()
- context uses applyWeather()
and changeWeather()
of its state.
InitialState is random Weather.