MultiGen is a configuration-driven file generation tool that automates the creation of large numbers of files from a template and a set of parameter combinations.
Instead of manually creating hundreds or thousands of similar files, MultiGen reads an INI configuration file, expands parameter combinations, computes derived values, and generates a structured output directory containing fully populated files.
Typical use cases include:
- Simulation input generation
- Parameter sweep studies
- Engineering workflows
- Scientific computing
- Automated test generation
- Configuration file creation
- Template-based file generation
- INI configuration format
- Cartesian expansion of parameter lists
- Derived parameter calculations
- Multiple generation methods
- Custom run naming
- Configurable output folder hierarchy
- Detailed logging
- Windows launcher script included
- Buildable as a standalone executable
- Cross-platform support through PowerShell 7
MultiGen/
│
├── src/
│ ├── multigen.cmd
│ └── scripts/
│ └── _buildFiles.ps1
│
├── config.ini
├── README.md
└── output/
The main MultiGen engine.
Responsibilities:
- Reading configuration files
- Parsing template definitions
- Expanding parameter loops
- Evaluating derived expressions
- Building output paths
- Generating files
- Logging execution progress
Windows launcher script.
It automatically:
- Locates the repository directory
- Loads
config.ini - Creates files in the
outputdirectory - Executes the PowerShell generator
Example:
@echo off
setlocal EnableExtensions
set "HERE=%~dp0"
set "CONFIG=%HERE%config.ini"
set "OUTDIR=%HERE%output"
powershell -NoProfile -ExecutionPolicy Bypass ^
-File "%HERE%scripts\_buildFiles.ps1" ^
-ConfigFile "%CONFIG%" ^
-OutputRoot "%OUTDIR%"From the repository root:
src\multigen.cmdOr run PowerShell directly:
powershell -ExecutionPolicy Bypass `
-File src\scripts\_buildFiles.ps1 `
-ConfigFile config.ini `
-OutputRoot outputInstall PowerShell 7:
pwsh --versionRun:
pwsh ./src/scripts/_buildFiles.ps1 \
-ConfigFile config.ini \
-OutputRoot output-ConfigFile Path to configuration file
-OutputRoot Output directory
-LogFile Optional custom log path
-Help Display help
Example:
pwsh ./src/scripts/_buildFiles.ps1 `
-ConfigFile config.ini `
-OutputRoot output `
-LogFile logs/multigen.logMultiGen uses a standard INI file.
Example:
[Template]
TemplateFile=main_template.xmf
OutputFileName=main.xmf
PlaceholderPrefix=___
PlaceholderSuffix=___Defines:
- Source template file
- Output filename
- Placeholder delimiters
Example:
[Template]
TemplateFile=main_template.xmf
OutputFileName=main.xmf
PlaceholderPrefix=___
PlaceholderSuffix=___Placeholder example:
___DEG___
Parameters that never change.
[GlobalFixed]
PROBECONFIG=port
RUN=testParameters expanded as Cartesian products.
[GlobalLoops]
DEG=30,45,60
PERIOD=3,4,5Generated combinations:
DEG=30 PERIOD=3
DEG=30 PERIOD=4
DEG=30 PERIOD=5
DEG=45 PERIOD=3
...
Values calculated from existing variables.
[Derived]
DT=PERIOD / DT_DIVExample:
PERIOD = 4
DT_DIV = 2
DT = 2
Defines how a run name is generated.
[NameFormat]
1=angle___DEG___
2=dt___DT___
3=method___METHOD___
NameSeparator=_Generated:
angle30_dt2_methodvbm
Defines generated folder hierarchy.
[OutputStructure]
1=___PROBECONFIG___
2=___METHOD___
3=___RUN_NAME___Generated output:
output/
└── port/
└── vbm/
└── angle30_dt2_methodvbm/
List all generation methods.
[Methods]
List=anysim,vbm[Methods.vbm.Fixed]
WAVEZ=-1e-6Optional method-specific loops.
[Methods.vbm.Loops]
AMPLITUDE=1,2,3[Template]
TemplateFile=main_template.xmf
OutputFileName=main.xmf
PlaceholderPrefix=___
PlaceholderSuffix=___
[GlobalFixed]
PROBECONFIG=port
DT_DIV=2
[GlobalLoops]
DEG=30,45
PERIOD=4,6
[Derived]
DT=PERIOD / DT_DIV
[NameFormat]
1=angle___DEG___
2=dt___DT___
NameSeparator=_
[OutputStructure]
1=___PROBECONFIG___
2=___RUN_NAME___
[Methods]
List=vbm
[Methods.vbm.Fixed]
WAVEZ=-1e-6Template:
<simulation>
<angle>___DEG___</angle>
<period>___PERIOD___</period>
<dt>___DT___</dt>
<method>___METHOD___</method>
</simulation>Generated file:
<simulation>
<angle>30</angle>
<period>4</period>
<dt>2</dt>
<method>vbm</method>
</simulation>By default logs are stored at:
%USERPROFILE%\.multigen\multigen.log
Example:
[2026-01-01 10:00:00] MultiGen started
[2026-01-01 10:00:01] Generated: angle30_dt2
[2026-01-01 10:00:02] MultiGen completed successfully
Custom log file:
pwsh ./src/scripts/_buildFiles.ps1 `
-ConfigFile config.ini `
-OutputRoot output `
-LogFile logs/multigen.logMultiGen can be distributed as a single executable using the PowerShell Pro Tools Packager or PS2EXE.
Install:
Install-Module ps2exe -Scope CurrentUserGenerate executable:
Invoke-PS2EXE `
.\src\scripts\_buildFiles.ps1 `
.\multigen.exeRun:
multigen.exe `
-ConfigFile config.ini `
-OutputRoot outputBecause MultiGen is written in PowerShell, it naturally runs on:
- Windows
- Linux
- macOS
using PowerShell 7.
Create:
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
pwsh "$SCRIPT_DIR/src/scripts/_buildFiles.ps1" \
-ConfigFile "$SCRIPT_DIR/config.ini" \
-OutputRoot "$SCRIPT_DIR/output"Save as:
multigen.sh
Make executable:
chmod +x multigen.shRun:
./multigen.shCreate:
#!/bin/zsh
DIR="$(cd "$(dirname "$0")" && pwd)"
pwsh "$DIR/src/scripts/_buildFiles.ps1" \
-ConfigFile "$DIR/config.ini" \
-OutputRoot "$DIR/output"Run:
chmod +x multigen.sh
./multigen.sh| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error during generation |
Potential roadmap items:
- JSON configuration support
- YAML configuration support
- Parallel generation
- GUI configuration editor
- Containerized Docker distribution
- File generation statistics
- Validation schema for configuration files
Lorenzo Zambelli
Current Version: 1.0.0