My simulation file doesn't let me adjust sliders to control constants during simulation

조회 수: 6 (최근 30일)
I'm getting the following error when trying to move my sliders during simulation:
"Error:Cannot change parameter 'Value' of 'sSma_ctrl_sim/sPmu_gridLoad_kW' while simulation is running. The block was made virtual as it was optimized for simulation"
Also, when running the simulation, I don't get any values to my signals even when not trying to move the sliders. The signal's output says "not used"
What is also weird is that I have built out 3 simulation files before this one, and they never gave me these issues, they worked fine. I have compared the simulation file that works with the simulation file that is giving me trouble, and everything that I have checked appears to be identical. Which means there's something that I haven't checked.
Here is some screenshots of my sliders and the constants they control:

답변 (1개)

Karan Singh
Karan Singh 2023년 8월 22일
The error message you're encountering indicates that you're attempting to change the value of the parameter 'sPmu_gridLoad_kW ' in the block “sSma_ctrl_sim” while the simulation is running. The block has been marked as virtual, which means it has been optimized for simulation and certain parameters cannot be modified dynamically during the simulation.
To resolve this issue, you have a few options:
1. Stop the simulation: If you need to change the value of the “sPmu_gridLoad_kW” parameter, you should stop the simulation, modify the parameter value, and then restart the simulation.
2. Modify the parameter before starting the simulation: If the value of “sPmu_gridLoad_kW” needs to be changed before the simulation starts, you can modify the parameter value in the block's dialog box or in the corresponding MATLAB code before initiating the simulation.
Regarding the issue where your signals are not providing any values and show "not used" as the output, there could be a few potential causes:
- Check the connections: Ensure that the signals are properly connected between the blocks. Make sure that the input and output ports of the blocks are correctly connected to each other.
- Verify block settings: Double-check the settings and configurations of the blocks involved in the signal flow. Ensure that the parameters are set correctly and that the blocks are configured to produce the desired output signals.
- Examine simulation time: Confirm that the simulation time is sufficient to allow the signals to propagate and produce meaningful output. Adjust the simulation time accordingly if needed.
- Review block documentation: Consult the documentation or user guide of the simulation tool or library you are using. Look for specific requirements or considerations related to signal propagation and output generation.
If the issue persists, consider providing more details about your simulation setup, including the specific blocks and their configurations, to help pinpoint the problem further.


Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by