AtnActorBase
AtnActorBase
This class should not be initialized directly.
- class gwatn.atn_actor_base.AtnActorBase(settings, use_algo=False)
- Parameters:
settings (AtnSettings) –
use_algo (bool) –
- check_for_dispatch_contract()
Upon startup, see if already party of a dispatch contract, and if so start up the dc_client and set the dc_app_id
- hb_to_scada()
Checks that Atn is in Dispatch Contract, sends a HeartbeatB to Scada, and then reports to DispatchContract
- heartbeat_from_scada(ping)
This is the Atn’s half of the DispatchContract Heartbeat pattern. It:
Checks that it has opted into a DispatchContract
Checks the FromGNodeInstanceId to validate Scada credentials
Checks that the scada correctly repeated last sent hex
Updates the last hex received (for use at the top of the next minute) along w time received
[more info](https://gridworks.readthedocs.io/en/latest/dispatch-contract.html)
- Parameters:
payload (HeartbeatB) – The latest heartbeat received from its
partner (SCADA) –
ping (HeartbeatB) –
- Return type:
None
- in_dispatch_contract()
Checks that bootstrap 2 was completed w addition of ta_trading_rights_idx, and also that Scada is opted in
- Return type:
bool
- join_dispatch_contract_from_scada(payload)
Bootstraps the DispatchContract, opts in, and sends back DispatchContractConfirmed
ignores if already opted into a DispatchContract
Until World registry is in place, update g node instance id and write to .env
sets up ApplicationClient using the app_id sent by the scada
Checks that scada bootstrapping is done (contract has ta_alias and scada_cert_idx)
Check that our Atn acct owns the TaTradingRights for this TaAlias
- Parameters:
payload (JoinDispatchContract) –
- Return type:
None
- local_rabbit_startup()
This should be overwritten in derived class for any additional rabbit bindings. DO NOT start queues here
- Return type:
None
- prepare_for_death()
Once the agent is ready for its comms to be shut down it sets actor_main_stopped to True. Write stoic code, with your agents ready for death at all times. However, if there are threads running beyond the two designed for publishing and consuming messages, shut those down in this method.
- Return type:
None
- route_scada_message(from_alias, message)
Routes messages from the SCADA to methods that should be overwritten in derived class
- Parameters:
from_alias (str) –
message (Message) –
- Return type:
None
- property scada_alias
Add scada from the end of the Atn’s’s GNodeAlias
- property ta_alias
Add ta to the and of the Atn’s GNodeAlias
- update_trading_rights()
Look at address to find our trading rights
- Return type:
None