Can an SFC run another SFC?

I’m interested in using SFC’s like Unit Procedures and Operations typically found on other batch systems.

Can Ignition’s SFC’s call other SFC’s?
If so, can you drill down into the bottom level SFC and see its state like you can for the top level SFC?

Example of usage: I make an SFC called op_MODE (Mode Operation), which I use as an operation to set a controller mode (Auto, Man, Cascade). I make another SFC called up_INIT (Initialize Unit Procedure), which runs op_MODE 10 times, to set the controller modes on my 10 controllers to Manual 0%.

Thanks!

Yes, in fact this exact use case is being used by other customers.

An SFC may call other SFCs using the Enclosing Step. SFC scopes nest, so that from a charts scope you can walk up the call tree to parent scopes.

I want to monitor the status of an enclosed step. How to I get the chart ID from the enclosed step into the vision portion? Right now when I call the parent, I capture the ID and store it in a memory tag, but I’m not sure how to get the ID of the enclosed step with SFC calling it instead of the HMI calling it.

Anyone figure out how to do this?

What I would do is make a chart variable in the enclosed step a key parameter, then pass a unique value of your choice (could be the parent chart ID or something else) from the parent chart to the key parameter when it creates the enclosed chart. Then anything can call the following (global) function to find the enclosed chart ID using the key parameter value:

def findRunningSFC(chartPath, keyValue):
data = system.sfc.getRunningCharts(chartPath)

for row in range(data.rowCount):
	chartKeyValue = data.getValueAt(row, "keyParamValue")
	if chartKeyValue == keyValue:
		chartId = data.getValueAt(row, "instanceId")
		break
	else:
		continue
else:
	chartId = None
	
return chartId

Thank you very much. That makes sense, and I’ll give it a try later today. Just like you said, I’ll pass the parent id to the enclosed chart and put it in a keyParam and look for the parents id there to find the enclosed chart id.

Should have mentioned that the above function will only work on v7.9.2 and later, since system.sfc.getRunningCharts() was modified to accept the chartPath argument. If you have an earlier version, you will have to add another condition to test for the chartPath, since getRunningCharts will return all running charts.