Workflow Management

Workflow Management in Petro-SIM is about giving you and your organisation more control over simulations, making it easier to integrate your own business rules into simulations and to integrate Petro-SIM into complex multi-application flows. Individual workflows can be as basic as firing an alert when a compressor power prediction exceeds a design bound. They can build from these simple starting points into very complex schemes that can run inside or outside Petro-SIM.

Much of the power of workflow in Petro-SIM comes from a tight integration with Microsoft's Workflow Foundation technology that is built into their .Net Framework. Workflows can respond to simulation events like solver start and solver finished as well as more traditional events like case open or case close. Workflows can be built into libraries and shared between cases through Petro-SIM's database publish and subscribe technology so that all users keep up to date with changes, allowing you to apply consistent business rules across all your simulations, cutting the time it can take to audit results.

Creating new workflows

Petro-SIM supports two basic types of workflow:

  • Designed workflows conceptually are equivalent to rules that you can create within programs like Microsoft Outlook. You select an object of group of objects that the workflow applies to, filter the resulting list if necessary and then apply actions to the final filtered list. For example you want to find all compressors where the power requirement exceeds 3 MW and generate a warning to the status window:
    • You select all compressors
    • You filter the list to remove those where power is less than 3 MW
    • You set an action to generate a status warning for each compressor that is left
  • Imported Workflows allow you to build your own custom workflows outside Petro-SIM using the Workflow Foundation framework from Microsoft Visual Studio. These custom workflows can be as simple or as complex as you like involving multiple steps with loops and if logic as necessary. Each step in a workflow is known as an Activity and we supplement the basic set provided with Workflow Foundation with a set specific to Petro-SIM.

Designed workflows allow you to add rules to your simulations without having to know anything about programming. Petro-SIM essentially gives you a template and a set of building blocks. Here you see a designed workflow that implements our compressor power example above. Each of the Select, Filter and Action steps of the workflow can contain multiple items that you insert into the step using the Insert dropdown button below each step list. Petro-SIM comes with the most common items built-in.

Click on the Insert button under Action for example and you will see

Each item in the Select, Filter and Action steps has configuration parameters that you can see and edit by double-clicking on the item and you'll find you can use Petro-SIM's normal variable navigator to select properties you want to set or filter on:

You can get creative here since you can include designed workflows within designed workflows and you can extend the set of built-in steps with your own custom workflow steps. Workflow Foundation itself presents workflows graphically, making it possible for non-programmers to build complex logic and for programmers to extend the available actions further by creating their own activities.

Here you see a custom workflow that modifies compressor adiabatic efficiency based on a power threshold. The power threshold and the high and low efficiency settings form parameters or arguments to the workflow.

Workflow Libraries

Workflows are organised into libraries that can be shared between cases, allowing you to build a universal set that you use in all your cases. You can have as many libraries as you like and each can be shared via the Petro-SIM database or imported and exported between cases using XML. We recommend using the Petro-SIM database because it simplifies maintenance:

  • Build and maintain your library (or libraries) centrally from one case that acts as the publisher
  • Subscribe to the library within another case and have the set of workflows in the library automatically update as changes are made by the publisher

This publish and subscribe technique is used elsewhere in Petro-SIM and gives you full control within the case to decide when updates are applied. The subscription can be set to update automatically every time the case loads or alert you when updates are available or to do nothing and let you check manually. Regardless of your subscription technique, workflows are still available when you are not connected to the database.

Running Workflows

Workflows can be run manually but are at their most powerful when they run automatically behind the scenes. You determine when each runs by setting a trigger on the workflow, which can be one of:

TriggerDescription
Case OpenedFires after the case has been loaded
Case SavedFires after the case has been saved
Case SavingFires at the start of a save before any information gets written out
Date ChangedFires at the start of each step in a Time Series simulation
Date/Time Run FinishedFires at the end of a Time Series simulation
Date/Time Run ResetFires on resetting a Time Series simulation
Date/Time Run StartingFires on starting a Time Series simulation
Historian Read FinishedTriggers after fetching historian data allowing a workflow to validate and potentially change data values before they are used.
ManualWorkflow runs only when you request it
Solver StartingFires at the start of a flowsheet solve
Solver FinishedFires at the end of a flowsheet solve

Workflows run in the order that exist within a library and you can reorder items where you have dependencies. You can also disable individual workflows.