How to find the bad start value guess when facing an initialization divergence in Dymola - modelica

I am using an open-source modelica library(ThermoSysPro) to build a simple Rankine cycle model, but it seems there is an issue about initialization.
So I changed the debug setting as follows to check the log file:
In the dslog.txt file, I could see there are a lot of errors in the same type:
As the log file shows, all these errors are caused by iteration divergence and bad start values:
In order to see which iteration variable caused the divergence, I checked the iteration result of all the iteration variables, but they all seem in the right range. So I am not sure what I should do next to find the source of the divergence. The method in the Dymola help manual didn't work in practice.
My question is how should I do to find the bad start values when facing the initialization divergence in Dymola?
Here is the link of the library, the model I built, the log files generated.
github link

Related

Dymola model not initializing with auxiliary variables turned off in output

I am trying to run a model in Dymola 2019 FD01 with auxiliary outputs turned off (to improve simulation speed). I've also set the flag:
Advanced.AutoRemoveAuxiliaries = true;
When I try to run the model, I get:
Error: Integrator failed to start model.
I am able to run the same model with Auxiliary Variable outputs turned on and the flag set to true.
I was wondering if someone else had this issue before and how to go about troubleshooting this problem.
The dymola user manual states this about the flag:
Advanced.AutoRemoveAuxiliaries - Removes code for auxiliary variables that neither influence the simulation state nor the outputs. This improves performance a bit. If the auxiliary code is used to assert correct behaviour or to generate external outputs, that code will not be run.
I am able to run some other models which have assert statements with the same settings (aux outputs off), so it seems like there is something else essential to the model removed during initialization.
I am trying to replicate the issue with a simple model but i have no idea where to even start.

openbugs generating inital values error

I have a model that I can run in winbugs but I get an error in openbugs when loading and generating initial values even when using the same code and the same data.
When loading initial values in both winbugs and openbugs I get the message that the "chain contains uninitalized variables". Then I can successfully generate initial values in winbugs but in openbugs I get the error "error for node Ny[2] of type GraphBinoimial. Node second argument must be integer valued." My initial values for Ny are Ny=c(4,4,4,4,4,4,4,4). These seem like integers to me. Plus these same initial values are accepted in winbugs.
You may be asking yourself, if I can get it work in winbugs why do I care to get it to work in openbugs? I am most interested in running the whole process through R. I've been trying to do this with R2Winbugs or Brugs (openbugs) but I get errors on initialization with both of these and it even crashes R (I'd never seen the r-bomb before but now I can make it happen repeatedly). I think this is probably for the same reason that I can't run the data manually in openbugs.
Being able to run this through R would greatly reduce the frustration of interacting with win/openbugs especially when running a series of models with different data.
Thanks in advance for your insight.
lg

How to update variable in From workspace block during runtime

I have a sample model(shown below) which consist of a from workspace block. It contains a workspace variable variable1(timeseries signal). I am changing the data of variable1 during simulation but model is not updating the current value of variable1. It's update only when I stop and restart the simulation but I want it to update during runtime only. Can anyone help me in handling this problem?
This is not really how Simulink is designed to work, so there's no easy way to do this. Simulink only checks only checks the workspace for values during model initialization at the start of the simulation. The best thing to do is to use set_param, as in:
set_param('untitled/From Workspace',' VariableName','variable1'); % put the correct path to your block
This is not changing anything in how the block is parameterised, but forces Simulink to parameterise the block with the new values of variable1. Because variable1 is a timeseries object, I am not sure how well this will work, but it's worth a try.
For more details, see this discussion on MATLAB Central.

My simple Stateflow model shows error

I'm almost new to Simulink and Stateflow. I am trying to model some simple state machines. But when trying to run the model, it shows errors (on the main Matlab screen).
Warning: Input port 1 of 'sample/If' is not connected.
Warning: Output port 1 of 'sample/If' is not connected.
Parsing failed for machine: "sample"(#90)
1) Is there anything wrong with this?
2) One more question: How can I add a timer on S2? e.g. we can not stay more than 2 minutes on S2. So as soon as we enter S2, a timer starts, and when it reaches 2 minutes, then should transition to S3.
P.S. For some reasons, the stateflow thumbnail on simulink scheme is not showing the updated model; there is no condition and if_outfput variables anymore!
Well, the error message is pretty self-explanatory: you haven't connected the input Condition of your Stateflow chart to anything, hence the error. Connect it to a signal in your Simulink (whatever represents your condition signal). Likewise, you haven't connected the output of the chart to anything either. You say these variables aren't there anymore, but Stateflow doesn't seem to think so. Have you deleted them from the Model Explorer? If not, Stateflow will still think they're part of the chart. See Use the Model Explorer with Stateflow Objects in the documentation for more details.
For the timer, yes it's possible. At the moment, you exit S2 to S3 when input ==1. You can change the transition to be [input == 1] || after(2000,sec) (I think). You may need to enable support for absolute time in the model configuration parameters. See Control Chart Execution Using Temporal Logic in the documentation for more details.

How can I use 5x5filter (Xilinx block), it keeps telling me there is an error in the counter?

I'm trying to apply edge filter to an image using Xilinx blocks,
I used 5x5 buffer then I connected the 5x5filter to it.
But it keeps telling me:
Illegal Period, This blocks attempts to set period that is a non-integer multiple of the system rate
Error occurred during "Block Configuration".'
which I did not understand.
Similar such problem(with solution) is posted in Xilinx Forum. Go through the link given below:
http://forums.xilinx.com/t5/DSP-Tools/Can-any-1-help-me-regarding-FIR-implementation-in-system/m-p/33650#M1463
It means that the sample time of one of the block isn't an integer multiple of the model's minor timestep. Check the configuration parameters for the model and the parameters of your new blocks.
I don't think this has anything to do with the Xilinx blocks specifically.