ApprenticeFoundryMentorModeler 23.4.0
dotnet add package ApprenticeFoundryMentorModeler --version 23.4.0
NuGet\Install-Package ApprenticeFoundryMentorModeler -Version 23.4.0
<PackageReference Include="ApprenticeFoundryMentorModeler" Version="23.4.0" />
<PackageVersion Include="ApprenticeFoundryMentorModeler" Version="23.4.0" />
<PackageReference Include="ApprenticeFoundryMentorModeler" />
paket add ApprenticeFoundryMentorModeler --version 23.4.0
#r "nuget: ApprenticeFoundryMentorModeler, 23.4.0"
#:package ApprenticeFoundryMentorModeler@23.4.0
#addin nuget:?package=ApprenticeFoundryMentorModeler&version=23.4.0
#tool nuget:?package=ApprenticeFoundryMentorModeler&version=23.4.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
- 15+ Unit Families: Angle, Length, Mass, Time, Force, Temperature, Voltage, Current, Power, and more
- Mixed Unit Support: Imperial, Metric, and specialized engineering units
- 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
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 (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
- ApprenticeFoundryBlazor (>= 23.4.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 |
---|---|---|
23.4.0 | 25 | 9/25/2025 |
23.1.0 | 34 | 9/24/2025 |
23.0.0 | 35 | 9/24/2025 |
21.3.0 | 127 | 9/13/2025 |
21.1.0 | 133 | 9/13/2025 |
21.0.0 | 150 | 9/11/2025 |
20.3.0 | 151 | 8/11/2025 |
20.2.0 | 140 | 8/10/2025 |
20.0.0 | 122 | 8/9/2025 |
19.0.0 | 124 | 7/28/2025 |
18.4.5 | 221 | 4/19/2025 |
18.4.4 | 212 | 4/17/2025 |
18.4.2 | 233 | 4/14/2025 |
18.4.1 | 205 | 4/14/2025 |
18.4.0 | 219 | 4/14/2025 |
18.3.0 | 126 | 4/4/2025 |
18.2.0 | 163 | 3/16/2025 |
18.0.0 | 156 | 2/23/2025 |
17.2.2 | 134 | 1/28/2025 |
17.1.2 | 124 | 1/28/2025 |
16.6.0 | 146 | 12/11/2024 |
16.5.0 | 130 | 12/8/2024 |
16.4.0 | 118 | 12/1/2024 |
16.3.0 | 119 | 11/26/2024 |
16.2.0 | 128 | 11/21/2024 |
15.10.3 | 131 | 10/27/2024 |
15.10.2 | 131 | 10/27/2024 |
15.10.1 | 148 | 10/11/2024 |
15.10.0 | 180 | 10/10/2024 |
15.9.0 | 131 | 10/10/2024 |
15.7.0 | 142 | 10/5/2024 |
15.5.0 | 150 | 9/13/2024 |
15.2.1 | 150 | 9/11/2024 |
15.2.0 | 157 | 9/11/2024 |
14.7.0 | 145 | 8/30/2024 |
14.6.0 | 155 | 8/28/2024 |
14.5.0 | 170 | 8/25/2024 |
14.0.2 | 162 | 8/23/2024 |
14.0.1 | 157 | 8/21/2024 |
14.0.0 | 143 | 8/21/2024 |
13.3.0 | 162 | 8/20/2024 |
2.3.0 | 159 | 8/20/2024 |
2.2.0 | 123 | 7/25/2024 |
1.1.1 | 144 | 6/2/2024 |