Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

How to change the parameter values by using the variables in OMMatlab

How to change the parameter values by using the variables in OMMatlab

Hello,

I try to simulate the medelica model by changing  the values of model parameters. I am doing that in Matlab platform through OMMatlab, which is an interface between openmodelica and Matlab.
In order to cahge the parameter values, I put the new pararemeter value into a varaible and use the command of setParameters() as the followings;

=================================================================================================
New_Tsw = 5e-5;
New_Ind = 1e-5;
New_Cap = 4.7e-6;   

%control signals
omc.setParameters(["booleanPulse1_period = New_Tsw","booleanPulse1_width = Duty"]);
omc.getParameters(["booleanPulse1_period","booleanPulse1_width"])

%passive component setting
omc.setParameters(["inductor1_L = New_Ind","capacitor1_C =New_Cap"]);
omc.getParameters(["inductor1_L","capacitor1_C"])
===================================================================================================

By using the command of getParameters(), I checked whether the parameter setting is done correctly or not.
But, I found that the parameter is set to be the string of the variable name, not the value of the variable. For example, booleanPulse1_period is set to be "New_Tsw", instead of 5e-5, its value. I think that setParameters() deals with the input as a string.

Could you tell me how to fix this problem and simulate the model by changing the model parameter values? 

Re: How to change the parameter values by using the variables in OMMatlab

lhans,

Edited by: lhans - Jun-04-20 14:44:32
There are 0 guests and 0 other users also viewing this topic
You are here: