[docs]classSMIAAppAgent(SMIAAgent):""" This is the SMIA Agent for logical resource assets. It extends the generic class AASManagerAgent. """
[docs]asyncdefsetup(self):""" This method performs the setup of logical resource type of Managers. It defines the Finite State Machine (FSM) of the SMIA Agent. """# TODO PENSAR SI EN ESTE CASO TENDRIA OTROS BEHAVIOURS ASOCIADOS EN CADA ESTADO# First, the FSMBehaviour is instantiatedfsm_behaviour=AASFSMBehaviour()# A common SMIA has three statesfsm_behaviour.add_state(name=SMIAGeneralInfo.BOOTING_STATE_NAME,state=StateBooting(),initial=True)fsm_behaviour.add_state(name=SMIAGeneralInfo.RUNNING_STATE_NAME,state=StateRunning())fsm_behaviour.add_state(name=SMIAGeneralInfo.STOPPING_STATE_NAME,state=StateStopping())# Transitions are defined to determine from which state to which other state you are allowed to move to.fsm_behaviour.add_transition(source=SMIAGeneralInfo.BOOTING_STATE_NAME,dest=SMIAGeneralInfo.RUNNING_STATE_NAME)fsm_behaviour.add_transition(source=SMIAGeneralInfo.RUNNING_STATE_NAME,dest=SMIAGeneralInfo.STOPPING_STATE_NAME)# The FSM behaviour is added to the agentself.add_behaviour(fsm_behaviour)_logger.info(f"{self.jid} setup finished correctly.")