ApprenticeFoundryMentorModeler 24.0.0
See the version list below for details.
dotnet add package ApprenticeFoundryMentorModeler --version 24.0.0
NuGet\Install-Package ApprenticeFoundryMentorModeler -Version 24.0.0
<PackageReference Include="ApprenticeFoundryMentorModeler" Version="24.0.0" />
<PackageVersion Include="ApprenticeFoundryMentorModeler" Version="24.0.0" />
<PackageReference Include="ApprenticeFoundryMentorModeler" />
paket add ApprenticeFoundryMentorModeler --version 24.0.0
#r "nuget: ApprenticeFoundryMentorModeler, 24.0.0"
#:package ApprenticeFoundryMentorModeler@24.0.0
#addin nuget:?package=ApprenticeFoundryMentorModeler&version=24.0.0
#tool nuget:?package=ApprenticeFoundryMentorModeler&version=24.0.0
Foundry Mentor Modeler
Advanced knowledge modeling framework with intelligent unit system for engineering applications
๐ What is Foundry Mentor Modeler?
Foundry Mentor Modeler is a powerful .NET library that provides intelligent parameter modeling, formula evaluation, and unit-aware calculations for engineering and scientific applications. It enables developers to create sophisticated models with automatic unit handling, dependency tracking, and dynamic formula evaluation.
โจ Key Features
๐งฎ Intelligent Parameter System
- Dynamic Formula Evaluation: Create parameters with complex formulas that automatically resolve dependencies
- Unit-Aware Calculations: Built-in support for 15+ unit families with automatic type safety
- Dependency Tracking: Automatic detection and management of parameter relationships
- Circular Reference Detection: Built-in protection against infinite evaluation loops
๐ Advanced Unit System Integration
- 39+ Unit Families: Length, Distance, Angle, Bearing, Time, Duration, Mass, Force, Temperature, Voltage, and more
- Dual Family Pattern: Scale-optimized families (Length/Distance, Angle/Bearing, Time/Duration)
- Mixed Unit Support: Imperial, Metric, and specialized engineering units across 6 unit systems
- Type-Safe Operations: Prevents invalid unit conversions (e.g., adding angles to lengths)
- Dynamic Unit Detection: Automatically creates correct MeasuredValue types
๐ Knowledge Modeling
- Hierarchical Instances: Create complex models with parent-child relationships
- Component Systems: Build reusable components with subcomponent relationships
- Reference Resolution: Sophisticated reference system for accessing model data
- Persistence Support: Save and load model states
๐ฆ Installation
NuGet Package Manager
Install-Package FoundryMentorModeler
.NET CLI
dotnet add package FoundryMentorModeler
PackageReference
<PackageReference Include="FoundryMentorModeler" Version="1.0.0" />
๐โโ๏ธ Quick Start
Basic Parameter Creation
using FoundryMentorModeler.Model;
// Create a model instance
var robot = new KnInstance("Robot");
// Add parameters with units
var speed = robot.Parameter("maxSpeed", 2.5, "m/s");
var weight = robot.Parameter("weight", 15.0, "kg");
var angle = robot.Parameter("heading", 45.0, "deg");
Formula-Based Parameters
// Create calculated parameters
var distance = robot.Parameter("distance", 0.0, "m");
var time = robot.Parameter("time", 0.0, "s");
// Add formula that references other parameters
var avgSpeed = robot.Parameter("avgSpeed", 0.0, "m/s");
avgSpeed.ApplyFormula("distance / time", UnitSystem.Default);
// Set values and watch automatic calculation
distance.SetValue(100.0); // 100 meters
time.SetValue(40.0); // 40 seconds
// avgSpeed automatically becomes 2.5 m/s
Dual Family Pattern Usage
// Use appropriate family for scale context
var robot = new KnInstance("AutonomousRobot");
// Engineering measurements (Length family - meter base)
var sensorRange = robot.Parameter("sensorRange", 5.0, "m"); // โ Length family
var wheelDiameter = robot.Parameter("wheelDiameter", 15.0, "cm"); // โ Length family
// Navigation measurements (Distance family - kilometer base)
robot.ApplyFormula("missionDistance", "ASDISTANCE(25, 'km')"); // โ Distance family
robot.ApplyFormula("waypointGap", "ASDISTANCE(500, 'm')"); // โ Distance family
// Same input units, different optimized scales:
Console.WriteLine(sensorRange.BaseValue()); // 5.0 (meters - engineering scale)
Console.WriteLine(missionDistance.BaseValue()); // 25.0 (kilometers - geographic scale)
Hierarchical Models
// Create a complex system
var droneSystem = new KnInstance("DroneSystem");
// Add subsystems
var propulsion = droneSystem.AddMember(new KnInstance("Propulsion"));
var navigation = droneSystem.AddMember(new KnInstance("Navigation"));
// Add parameters to subsystems
propulsion.Parameter("thrust", 50.0, "N");
navigation.Parameter("altitude", 100.0, "m");
navigation.Parameter("gpsAccuracy", 2.0, "m");
// Compute all values recursively
droneSystem.ComputeAll<KnInstance>(deep: true);
๐ง Advanced Usage
Custom Formulas
var circle = new KnInstance("Circle");
circle.Parameter("radius", 5.0, "m");
circle.Parameter("area", 0.0, "mยฒ");
// Complex formula with built-in functions
var area = circle.FindParameter("area");
area.ApplyFormula("3.14159 * radius * radius", UnitSystem.Default);
Unit System Integration
// Works with FoundryRulesAndUnits
var unitSystem = new UnitSystem();
unitSystem.Apply(UnitSystemType.SI);
// Parameters automatically use proper unit system
var force = new KnParameter("force", 9.8, "N");
var acceleration = new KnParameter("acceleration", 9.8, "m/sยฒ");
Dependency Management
var circuit = new KnInstance("Circuit");
var voltage = circuit.Parameter("voltage", 12.0, "V");
var current = circuit.Parameter("current", 2.0, "A");
var power = circuit.Parameter("power", 0.0, "W");
power.ApplyFormula("voltage * current", UnitSystem.Default);
// Changing voltage automatically updates power
voltage.SetValue(24.0); // Power becomes 48W automatically
๐ Architecture
Core Components
KnInstance: Base knowledge instance with hierarchical capabilitiesKnParameter: Unit-aware parameter with formula evaluationOperator: Expression evaluation system with unit supportOPResult: Type-safe result container with status tracking
Unit System Integration
Foundry Mentor Modeler integrates seamlessly with FoundryRulesAndUnits to provide:
- Automatic unit family detection
- Type-safe MeasuredValue creation
- Cross-unit conversion prevention
- Engineering-grade precision
๐ Documentation
Comprehensive Guides
- Unit System Documentation - Complete technical reference
- Parameter Unit Preservation - Unit handling best practices
- Migration Guide - Upgrading from older versions
API Reference
- Extension Methods - Helper method documentation
- Mathematical Functions - Built-in formula functions
๐ฏ Use Cases
Engineering Applications
- Robotics: Model robot parameters with unit-aware calculations
- Mechanical Design: Create assemblies with dimensional relationships
- Control Systems: Model feedback loops with parameter dependencies
Scientific Computing
- Physics Simulations: Unit-safe calculations across measurement types
- Data Analysis: Parameter relationships with automatic computation
- Experimental Design: Model experimental setups with validation
Industrial Systems
- Process Control: Model industrial processes with interconnected parameters
- Quality Assurance: Create measurement systems with tolerance checking
- System Integration: Build complex multi-component systems
๐ ๏ธ Requirements
- .NET 8.0 or later
- FoundryRulesAndUnits (automatically included)
- FoundryCore (automatically included)
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
git clone https://github.com/SteveStrong/FoundryMentorModeler.git
cd FoundryMentorModeler
dotnet restore
dotnet build
dotnet test
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Recent Updates (October 2025)
๐๏ธ Dual Family Pattern - Complete Implementation
- โ Distance Family Fix: Resolved critical bug where Distance family couldn't accept 'm' units
- โ Cross-System Support: All 6 unit systems (SI, MKS, CGS, FPS, IPS, mmNs) now support dual families
- โ Scale-Optimized Architecture: Length/Distance, Angle/Bearing, Time/Duration dual families complete
- โ Parser Integration: Made Distance parser-accessible across all unit system specifications
๐ง Unit System Enhancements
- โ Comprehensive Validation: All Distance tests passing (7/7) with robust cross-system validation
- โ Base Unit Optimization: Engineering-scale (meters) vs Geographic-scale (kilometers) mathematics
- โ
AS Function Support:
ASDISTANCE(5, 'm'),ASBEARING(45, 'deg')for explicit family assignment - โ Backward Compatibility: Existing code unchanged, new dual family features available
๐ Implementation Scope
- Distance Family: Now accepts all Length units (m, cm, ft, in, km, mi, etc.) in all 6 systems
- Dual Family Benefits: Context-appropriate base units (Lengthโmeters, Distanceโkilometers)
- Testing Framework: Comprehensive validation ensuring consistent behavior across all specifications
๐ Recent Updates (September 2025)
๐ Major Performance Optimization - 5-10x Faster Expression Evaluation
- โ TokenID-Based Dispatch: Replaced string comparisons with enum switching for 5-10x performance gain
- โ Unified Function Registry: Single source of truth for 50+ functions (Math, String, Date, Engineering)
- โ
Token-Based Architecture: All operators now use consistent
Operator(Token)constructor pattern - โ Pure Evaluation: Clean separation between parsing and evaluation phases
๐๏ธ Architectural Transformation
- โ FunctionOperator Cleanup: Eliminated hundreds of lines of legacy code, removed "hard-to-read" patterns
- โ IUnitSystem Dependency Removal: Pure evaluation operators using static methods
- โ Parser-Evaluator Separation: Dedicated FunctionParser for clean architectural boundaries
- โ
Memory Optimization: Eliminated
Name.ToUpper()calls and string allocations in hot paths
๐ Proven Performance Improvements
- BinaryOperator: 8-10x faster arithmetic dispatch (
+,-,*,/) - CompareOperator: 6-8x faster comparison operations (
==,>,<, etc.) - LogicalBinaryOperator: 5-7x faster logical operations (
AND,OR) - FunctionOperator: 3-5x faster function lookup with unified registry
๐ง Enhanced Unit System
- โ Dimensionless Default Strategy: Safe handling of unknown units
- โ 15+ Unit Families: Complete engineering unit coverage
- โ Cross-Family Protection: Prevents invalid unit conversions
- โ API Consistency: Full integration with FoundryRulesAndUnits
๐ Comprehensive Documentation
- โ Optimization Success Documentation: Complete transformation details
- โ Architecture Quick Reference: Updated usage patterns and guidelines
- โ Token-Based Architecture Plan: Technical implementation details
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- NuGet: Package Page
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- ApprenticeFoundryRulesAndUnits (>= 9.1.0)
- ApprenticeFoundryWorldsAndDrawings (>= 24.1.0)
- Z.Blazor.Diagrams (>= 3.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 24.1.0 | 159 | 10/22/2025 |
| 24.0.0 | 169 | 10/15/2025 |
| 23.4.0 | 168 | 9/25/2025 |
| 23.1.0 | 163 | 9/24/2025 |
| 23.0.0 | 171 | 9/24/2025 |
| 21.3.0 | 150 | 9/13/2025 |
| 21.1.0 | 153 | 9/13/2025 |
| 21.0.0 | 171 | 9/11/2025 |
| 20.3.0 | 167 | 8/11/2025 |
| 20.2.0 | 168 | 8/10/2025 |
| 20.0.0 | 139 | 8/9/2025 |
| 19.0.0 | 145 | 7/28/2025 |
| 18.4.5 | 252 | 4/19/2025 |
| 18.4.4 | 238 | 4/17/2025 |
| 18.4.2 | 256 | 4/14/2025 |
| 18.4.1 | 223 | 4/14/2025 |
| 18.4.0 | 255 | 4/14/2025 |
| 18.3.0 | 139 | 4/4/2025 |
| 18.2.0 | 178 | 3/16/2025 |
| 18.0.0 | 171 | 2/23/2025 |
| 17.2.2 | 157 | 1/28/2025 |
| 17.1.2 | 137 | 1/28/2025 |
| 16.6.0 | 159 | 12/11/2024 |
| 16.5.0 | 132 | 12/8/2024 |
| 16.4.0 | 140 | 12/1/2024 |
| 16.3.0 | 123 | 11/26/2024 |
| 16.2.0 | 141 | 11/21/2024 |
| 15.10.3 | 143 | 10/27/2024 |
| 15.10.2 | 145 | 10/27/2024 |
| 15.10.1 | 162 | 10/11/2024 |
| 15.10.0 | 183 | 10/10/2024 |
| 15.9.0 | 134 | 10/10/2024 |
| 15.7.0 | 155 | 10/5/2024 |
| 15.5.0 | 153 | 9/13/2024 |
| 15.2.1 | 175 | 9/11/2024 |
| 15.2.0 | 169 | 9/11/2024 |
| 14.7.0 | 156 | 8/30/2024 |
| 14.6.0 | 167 | 8/28/2024 |
| 14.5.0 | 183 | 8/25/2024 |
| 14.0.2 | 175 | 8/23/2024 |
| 14.0.1 | 160 | 8/21/2024 |
| 14.0.0 | 158 | 8/21/2024 |
| 13.3.0 | 173 | 8/20/2024 |
| 2.3.0 | 162 | 8/20/2024 |
| 2.2.0 | 135 | 7/25/2024 |
| 1.1.1 | 157 | 6/2/2024 |