- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » OpenModelica Script issue about...
OpenModelica Script issue about setParameterValue
OpenModelica Script issue about setParameterValue
I've been using a script file to do my simulation. Currently working with nightly-build version that is 1.14.0-dev.
Code:
loadModel(Modelica); getErrorString();
loadFile("C:/Users/namcho/Documents/Tez_DAB/Simulation/MachineLearningAlgo/DAB_ideal.mo"); getErrorString();
loadFile("C:/Users/namcho/Documents/Tez_DAB/Simulation/MachineLearningAlgo/uControllerDAB.mo"); getErrorString();
checkModel(DAB_ideal);
Kp := 1.2;
Ti := 5e-5;
Td := 0;
typeOf(Kp);
setParameterValue(DAB_ideal, PID_Kp, Kp); getErrorString();
setParameterValue(DAB_ideal, PID_Ti, Ti); getErrorString();
setParameterValue(DAB_ideal, PID_Td, Td); getErrorString();
instantiateModel(DAB_ideal);
In the code above I want to pass Kp's value to my DAB_ideal model. If I try as above, it gives the following error when run with omc.exe
[C:/Users/namcho/Documents/Tez_DAB/Simulation/MachineLearningAlgo/DAB_ideal.mo:3:3-3:20:writable] Error: Variable Kp not found in scope DAB_ideal. Error: Error occurred while flattening model DAB_ideal
If I try setParameterValue(DAB_ideal, PID_Kp, 1.2); it works.
How can I pass that Kp's value to setParameterValue function? I've tried PowerShell $ symbol(and a couple more different symbols) to pass the Kp's value to the function this didn't work either.
My aim is to read those Kp, Ti and Td parameters from a text file and update my model parameters.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » OpenModelica Script issue about...