Skip to main content
This page presents example plug-ins that demonstrate common patterns for building PACZ component plug-ins.

Basic plug-in (BasicPaczPlugin)

A minimal plug-in that demonstrates the core plug-in structure: a Runner that multiplies two inputs and a Builder UI with an options menu and variable creation.

Runner — BasicPaczPlugin.cs

Builder UI — BasicPaczPluginBuilderUI.cs

Key patterns demonstrated

  • Runner structure: ConstructAsync for initialization, RunAsync for execution, DisposeAsync for cleanup
  • Nested variables: Using "a1.a2.x1" dot-separated naming to create ModelCenter assemblies automatically
  • Variable descriptions: Passing a description string to the RuntimeVariable constructor (see x3)
  • Options menu: Adding a custom menu item via AddMenuItem that triggers a Windows Form
  • Per-run folders: Setting RunFolderPreference.PerRun for safe parallel execution
  • Removing variables: Helper method _removeOutput to filter and replace the output variable list

FMU v2 import plug-in (FMUv2Import)

An advanced plug-in that imports and runs Functional Mock-up Units (FMUs) conforming to the FMI 2.0 Co-Simulation standard. It demonstrates file-based plug-in setup and dynamic variable creation from an external model.

Runner — FMUv2Import.cs

Builder UI — FMUv2ImportBuilderUI.cs

Key patterns demonstrated

  • File-based setup: Using GetFileLoadProperties to let users select an .fmu file, then dynamically creating variables from the FMU model description
  • Dynamic variable creation: Iterating through FMU model variables and mapping them to PACZ input/output variables with "Inputs." and "Outputs." prefixes
  • Model metadata as variables: Exposing FMUVersion and FMUType as read-only string input variables under ModelDescription
  • Time-stepping simulation: Running a co-simulation loop with startTime, stepTime, and endTime controls
  • External library integration: Using the lib namespace to load, instantiate, and interact with FMU models via native interop
  • Input validation: Checking fmiVersion and fmiType before proceeding, with descriptive error messages