Simulink 3dof block error: initial velocity cannot be set to zero - simulink

New Simulink user here. I am using a 3DOF box to simulate a rocket launch. When I try to modify the block parameters, it does not let me set the initial velocity as 0. It displays an error saying the parameter only supports positive value. (see photo) How can this be corrected?
Cheers

I submitted a ticket to Matlab, apparently it is a bug, and will be fixed tomorrow with the 2022a Matlab release.

Related

Problem with delay block in simulink when trying to set initial value via input port

I have following circuit.
For initial value I would like to hold maximum of the array at the output, as long as the output beta don't go over some defined value (that threshold is defined in the switch). When input beta goes over that value, I would like to update value that is stored.
When I try to generate HDL for this circuit, I get the following error in Check block compatibility:
Error: The initial condition for the Delay block must be specified via Dialog.

OpenModelica "Change" block does not work properly. [Beginner]

I am really new on Modelica in general but I have a project I need to finish really soon. I apologize if something that I say is really basic. I have tried a few tweaks and searched over the internet but I cannot seem to figure out how to do this to work.
I have created a model. Inside there is a block with a boolean output, lets call this output boolean variable Y1.
Connected to that block I use the Modelica.Blocks.Logical.Change or the Modelica.Blocks.MathBoolean.ChangingEdge blocks. I have tried both since if I understand correctly they do the same thing. Y1 is the input of this block.
So basically the moment when Y1 changes from true to false or from false to true the output of the Change block (lets call it Y2) should be true just for that timestep.
This does not happen. Y2 is constantly on false. I have checked and Y1 is changing over time.
I have also tried to run the example Modelica.Blocks.Examples.BooleanNetwork1 but I see the same thing in there also. The desired output does not change to the example either.
For reference I use the OpenModelica 1.17 with Modelica Standard Library 3.2.3. These are the versions I am obligated to use and I cannot use newer or older ones.
Any tip would be highly appreciated! Thank you.
PS If this does not work I would like to use something different. Is there a way I can access all the previous values (history) of Y1 inside an another block and find these changes with an algorithm there? So lets say I am on timestep N and inside a block I want to access Y1 from 0 to N-1 and find the last timestep that Y1 has changed.
How did you check that the output of the change block doesn't fire at the events? You may not be able to see it on a plot since the impulse is 'infinitely' short (at least, that's my experience with Dymola).
You could latch the impulse from the change block by connecting it's output to an SR flipflop.

Setting integrator initial condition basing on the signal in Simulink

I have simple Simulink model and I would like to change the initial condition of integrator based on some signal. This signal can take values 1 or 0 and initial conditions of integrator should be equal to 1.16 or 0.65 respectively.
I tried to set a parameter x_init in Model Workspace (and then use it in Integrator block), but I couldn't access it via function. Then I tried to run MATLAB function inside simulink model with set_param(...), but I got error:
Function 'set_param' is not supported for code generation. Consider adding coder.extrinsic('set_param') at the top of the function to bypass code generation.
This is how the structure of model looks like in Model Explorer. I would like to change the x initial condition.
Using a workspace variable as you are doing is the wrong approach.
Change the Initial Condition Source property of the integrator to external. This will give the block an additional in port. The value of the signal fed into this port when the integrator is reset is taken as the initial condition.

Using if function in MATLAB Simulink

I have created the following block diagram on Matlab Simulink. It should give OUT1=1 OUT2=0 when INPUT>=0 and OUT1=0 OUT2=1 when INPUT<0. But it does not give the expected results. What is the reason for that. Any advice to make it work correctly would be appreciated.
The behaviour you are seeing can be explained by noting the following:
The output from the If Subsystem acts like an enable signal.
By default, the Output Ports of an If Action Subsystem are set to hold their values when the (sub)system is disabled.
This can be changed by going to the parameters dialog of the Output Port (within the If Action Subsystems) and changing the Output when disabled property to reset. You'll also want to change the default value to zero.
In many cases an IF is translated to a switch. You calculate cases and select the one which is intended. Here you could connect a constant [1 0] and a constant [0 1] to the first and third input and the sign block from your solution to the second input.
This if function block thing didn't work. So I come up with a different approach to get the result I wanted using the sign block. Solution is posted below. Thank you for everyone for trying to help.

Control modelica model in dymola, using matlab and command importInitial(dsName="dsfinal.txt")

I want to control from matlab a modelica model implemented in Dymola. At each x-seconds, matlab reads the states values and it calculates the new parameters values of the model and calls dymola to simulate the model with these new parameters values.
I try to initialize the states using the final values of the previous simulation using importInitial(dsName="dsfinal"); and then simulating.
This works if I give the command straight in the simulation log but it doesn't work when I call it from matlab, eventhought exactly the same command appear in the dymola simulation log.
Could any one help?
Thx!
The problem was due to the change of the parameters values.
Using following code solved it:
1) use simulateModel() with all simulation parameters you want for the first simulation
2) use importInitial('dsfinal.txt') to import the final state values
3) use modelName.parameterName = newValue to change parameter value
4) use simulate() to simulate further with the same settings as first simulation.
See also: http://www.claytex.com/how-to-restart-a-simulation/