Finally got an update for the project. I managed to make the state machine and all the activity diagrams ready to run the python code and added a buzzer to alert me when some user interaction has to be done.
Here you see the dependencies of the SousVide class to "external" "state machine" and "internal" classes.
One big state machine,... coming up:
and finally for all interested the XMI-Export from my Enterprise Architect model and some example code (generated from the model)
"""
# Model File: file:///C:/Projects/Python/SousVide/SousVide.eap
# Model Path: Model.LCD Menu.SousVide.SousVide
#
# Montag, 7. März 2016 - 09:43:43
"""
from enum import Enum
import time
# Include for relation to classifier Adafruit_CharLCD
import Adafruit_CharLCD as LCD
# Include for relation to classifier FSM
from FSM import *
# Include for relation to classifier time
from time import *
# Include for relation to classifier RPi.GPIO
import RPi.GPIO as GPIO
# Include for relation to classifier os
import os as os
# Include for relation to classifier TempSensor
from TempSensor import *
# Include for relation to classifier sys
import sys as sys
# Include for relation to classifier time_unit
from time_unit import *
# Include for signals
from Signals import *
...
...
"""
# Activity CheckSingleClick of class SousVide
"""
def CheckSingleClick(self, button):
return_1 = False
# start of activity code
if(self.lcd.is_pressed(button)):
while(True):
self.ButtonWaitTime()
if not (self.lcd.is_pressed(button)):
break
return_1 = True
else:
return_1 = False
return return_1
...
...
...
"""
# Handles the state machine
"""
def StateMachineFnc(self, stm, msg):
evConsumed = False
if (stm.mainState.activeSubState == SousVide_StateMachine_States.SousVide_StateMachine_StateMachine_FINAL_1):
""" empty block """
elif (stm.mainState.activeSubState == SousVide_StateMachine_States.SousVide_StateMachine_Running):
if (stm.Running.activeSubState == SousVide_StateMachine_States.SousVide_StateMachine_alert_user_end):
if(FSM.checkTimeEvent(stm.alert_user_end, 500, time_unit.TIME_MILLISECONDS) != False):
evConsumed = True
# transition effect for transition alert user end -> alert user end
self.BuzzerAlert()
# end of transition effect for transition alert user end -> alert user end
# alert user end -> alert user end
stm.Running.activeSubState = SousVide_StateMachine_States.SousVide_StateMachine_alert_user_end
stm.alert_user_end.startTime = FSM.getTime()
elif( self.CheckSingleClick(LCD.SELECT)):
evConsumed = True
# alert user end -> wait for user
stm.Running.activeSubState = SousVide_StateMachine_States.SousVide_StateMachine_wait_for_user
# entry actions for state wait for user
self.EndMessage()
# end of entry actions for state wait for user
elif (stm.Running.activeSubState...
...
...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.