In previous versions of cadCAD, when you wanted to access the previous state’s value in a mechanism or behavior, you could use the sL[‘stateName’] to access the last timestep’s state value. In the most recent version of cadCAD, the UI has changed somewhat to include a special utility that lets you define what individual partial state update block you would like to retrieve a value from. The official documentation shows how to use this powerful feature: https://github.com/BlockScience/cadCAD/blob/master/documentation/Historically_State_Access.md but for the sake of simplicity, if you don’t need a specific partial state update block and just want the last timestep value (after the last partial state update has been completed) the code snippet below can be used:
from cadCAD.configuration.utils import access_block
access_block(sL, “last_x”, -1)[-1][‘stateOfInterest’]