Building and Embedding a Reduced Order Model in National Instruments Hardware (cRIO)

답변 (3개)
0 개 추천
Hi @Patrick,
Original Request: " I could do with some guidance on a task required on a National Instruments (NI) LEM controller currently under build. I have a Simscape system-level model of an plant (engine and linear electric machine combination). I need to embed a simplfied model or function onto the NI hardware (cRIO-9035 RT Controller) that provides a reference signal (velocity or maybe LEM force) to the High Voltage LEM drives (M700). The M700 drives and its current/force-based controller are to be considered as "black-boxes" with unknown dynamics. The "reference trajectory model" inputs are simply pressure [bar] and crank angle position [CA] and for the time being a single output, which is the translator velocity [m/s]. The sample rate for the LEM drives I have been told is 1 m/s. I can export the Simscape signals directly from the data inspector. Has anyone experience of how to train a simplfied model or create a function such as this, that can be embedded in NI hardware, where in real-time the function will receive the plant pressure and crank angle at 1 m/s intervals and output the plant velocity? A function as a transfer-function or non-linear model such as a neural network? I appreciate its a vast topic, however, and suggestions to get me started, would be great."
Response (No Simulink/Simscape access, but research-based guidance): You're right - it's a vast topic! Let me address your specific points:
For your cRIO-9035 embedding requirement: The cRIO-9035 is a rugged, fanless, embedded controller featuring an FPGA, real-time processor running NI Linux Real-Time OS, and embedded UI capability. Applications can be deployed using application components configured during the LabVIEW Real-Time build process.
Training approaches for your pressure [bar] + crank angle [CA] → velocity [m/s] model:
1. Transfer Function: Use System ID with your exported Simscape data 2. Neural Network: The Deep Learning Toolkit for LabVIEW allows you to create, configure, train, and deploy deep neural networks, and Vision Development Module works with frozen TensorFlow models on Linux RT 64-bit systems 3. Lookup Tables: Most deterministic for 1ms real-time requirements
*For M700 "black-box" drives: *
Focus on smooth, physically realizable velocity references that won't excite unknown dynamics.
Real-time implementation at 1ms:
The cRIO-9035's real-time processor should handle this timing requirement effectively.
Getting Started Suggestions: 1. Export your Simscape pressure/crank/velocity time-series 2. Start with simple lookup table approach for reliability 3. Validate against full Simscape model 4. Deploy to cRIO using LabVIEW project targeting the real-time processor
References:
1. NI cRIO-9035 Official Documentation: https://www.ni.com/en-us/shop/model/crio-9035.html
2. cRIO-9035 Technical Specifications: https://www.ni.com/docs/en-US/bundle/crio-9035-specs/page/specs.html
3. Deep Learning Toolkit for LabVIEW: https://www.ni.com/en-us/shop/software/products/deep-learning-toolkit-for-labview.html
4. Deploying Deep Learning Models to NI Hardware: https://www.ni.com/en/shop/data-acquisition-and-control/add-ons-for-data-acquisition-and-control/what-is-vision-development-module/deploying-deep-learning-models-to-ni-hardware.html
5. LabVIEW Real-Time Application Deployment: http://www.ni.com/product-documentation/12919/en/
6. Building Real-Time Applications: https://www.ni.com/docs/en-US/bundle/labview-real-time-module/page/lvrthowto/rt_building_rt_app.html
7. Deep Learning Library Community Discussion: https://forums.ni.com/t5/Example-Code/Deep-Learning-Library-for-LabVIEW/ta-p/4029995
8. Third-party Deep Learning Toolkit: https://www.ngene.co/deep-learning-toolkit-for-labview
0 개 추천
0 개 추천
댓글 수: 1
Hi @Patrick,
Great progress on building those initial models! You're absolutely right about the angular position wrapping issue - it's a classic problem when dealing with cyclic variables in machine learning.
Analysis of your model results: Looking at your plots, I can see you've made solid progress with your MISO system identification. The transfer function and surface polynomial models appear to be capturing the general behavior well. Your shallow NN results show promise, though I notice the angular position limitation is indeed constraining the model complexity as you mentioned.
For the angular position wrapping problem: Converting angular position to sin/cos components is definitely the way forward:
% Instead of using theta directly sin_theta = sin(crank_angle); cos_theta = cos(crank_angle);
This gives your model continuous, periodic features that don't have discontinuities at 0/360°. You'll now have inputs: [pressure, sin_theta, cos_theta, angular_velocity] → velocity.
For capturing increasing angular speed over multiple cycles: Since as mentioned before not having direct Simscape/Somulink access, here's again my research-based approach for your data generation:
1. Time-based simulation: Run your Simscape model with a time-varying speed profile (0 to 64 rad/s over 10-20 cycles) 2. Export comprehensive dataset: Pressure, crank_angle, angular_velocity, and resulting velocity at each timestep 3. Feature engineering: Convert your exported crank_angle data:sin_crank = sin(crank_angle);cos_crank = cos(crank_angle);inputs = [pressure, sin_crank, cos_crank, angular_velocity];
Regarding the ROM toolbox with Simscape: The Reduced Order Modeler app should work directly with Simscape models - it's designed to interface with Simulink/Simscape through the DoE and data generation features @Yifeng mentioned. The Neural State Space and LSTM models it offers might be particularly suitable for your dynamic system since they can capture temporal dependencies better than shallow NNs, especially given the cyclic nature of your crank mechanism.
Next steps I'd suggest: 1. Regenerate your training data with the sin/cos transformation 2. Include angular velocity as a third input alongside pressure 3. Try the ROM toolbox's Neural State Space model - it might handle the dynamics better than your current shallow NN 4. Validate against multiple operating points before cRIO deployment
The sin/cos transformation should resolve your wrapping limitation and allow deeper network architectures while maintaining the physical meaningfulness of your crank position variable.
커뮤니티
더 많은 답변 보기: Power Electronics Community
카테고리
도움말 센터 및 File Exchange에서 Real-Time Deployment에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


