Matlab/Simulink: If block error - matlab

Please refer to the image at the following link attached for understanding the question.
Image is at this link: http://www5.picturepush.com/photo/a/12014483/img/12014483.jpg)
here are 2 inputs: 1.Speed_Pulse 2.PreviousSpeedPulse_1_old
The second input is nothing but the first input delayed in time by 1 time instant using the unit delay block. The 'If' block compares the 2 inputs. If the input 'u1' (Speed_Pulse) is less than 'u2'(PreviousSpeedPulse_1_old) then, in the 'if action' block, the value 64 is simply added to u1 (Speed_Pulse) value. Else, the input Speed_Pulse is directly transmitted to the output via the 'else action' block. One of the outputs is transmitted to 'Temp' (depending on the 'if-else') using the 'Merge' block.
Now, please refer to following table of inputs and outputs.
The table is at this link: http://img521.imageshack.us/img521/8684/tablewy.png
In the table, the values are wrong for instant 4 and instant 7.
I could not find a reason for this abrupt wrong output.
Any idea what is going wrong?

Sorry it was my mistake. Actually I was using a Framework below it and it was the error of the Framework. Got it resolved. Thanks for your help.

Related

Failed to expand block containing connect

I´m trying to set a connection with a conditional on the temperature, to represent a temperature-sensible charging pipe that works inside a stratified heat storage tank, with the following for loop reading the several volumes of the tank,
`for i in 2:nSeg loop
if (sensor_T_inflow.T > vol[i].T) and (sensor_T_inflow.T < vol[i-1].T) then
connect(feedPort, vol[i].ports[3])
annotation (Line(points={{-50,-60},{6,-60},{6,
-16},{16,-16}}, color={0,127,255}));
end if;
end for;`
However I get the errors such as this one for the volume 2:
Failed to expand block containing connect:
if (sensor_T_inflow.T > vol[2].T and sensor_T_inflow.T < vol[1].T) then connect(feedPort, vol[2].ports[3]); end if;
The model contained invalid connect statements.
Check aborted.
This might have a silly solution but I checked the names of all my elements and their temperature properties and they match with this code snippet, and I confirmed the error comes specially from the if conditional. Here is my model If you could take a look at it.
I tried commenting out the conditional and the check was succesful, only that I have a misbalance of about 40 variables to equations. If you got any advice on how to solve those misbalances I´d be much grateful as well.
Thanks a lot in advance.
The connect-statements may not depend on time-varying variables.
(The technical statement is first in the list in https://specification.modelica.org/master/connectors-and-connections.html#restrictions-of-connections-and-connectors )
A solution would be to turn that into an array of valve-components, and have them controlled in a similar way.

talend thmap get value of outer loop element

I'm just starting out with thMap.
So far I have successfully mapped an X12 835 message to output structures. That works no problem.
I have also successfully acquired the LoopIndex of the current loop using the LoopIndex() function.
My challenge:
I need to get the value of an element from the enclosing loop.
In the attached image, everything in green is working.
I'm trying to get the value down the red line.
My goal is to do this assignment
gsRecord.parent_id = enclosing loop isaRecord.id
The documentation explains some things but I don't see examples putting it together.
Does anyone have any good examples, videos or suggestions?
Update from 12/9/22
Here is something I have tried. Providing this example in hopes someone recognizes a specific issue to help move me forward. Any input would be appreciated.
Per this screenshot
I am attempting to output in gsRecord.parent_id the loopIndex of the parent loop (isaRecord).
This gives me the following error
"An reference in an LoopIndex/Variable was made to an either an input
map element or an output map element that is not in the context of the
reference. Use an enclosing looping output map element here.(msg #1202)"
Given the reference to 'enclosing looping output map element here' it feels like the gsRecord is not properly defined as a child of the isaRecord.
However the definition of the gsRecord is in reference to the isaRecord as in this screenshot.
It feels like there is some combination of LoopIndex and EnclosedContext that I could use to accomplish this but I'm unable to find any in-depth documentation on the functions.
Any help would be appreciated.

How to setup a condition in anylogic, that will return true, only when specific message is received?

Good day,
I'm trying in AnyLogic to make block "Ped Select Output" (from Pedestrian library) select output based on the received message, using the command in conditions table receive("go");. This block is located in Main, while the message is supposed to be sent from the agent tab (MyAgent) using the command send("go", main.pedSource);. Yet if I try to launch this model I get the error "Type mismatch, cannot convert void to boolean". I believe I have incorrectly selected one of the commands (or maybe both), thus I hope for advice about it. Thanks in advance for the answer.
P.s. check screenshots, for more detailed information.
P.p.s. the model, that is presented on screenshots is just an oversimplified example of the real model (that's why 4 out of 5 outputs of the block are connected to one place).
main
agent
Each condition in the selectoutput should return a boolean... a boolean can be true or false
Some example of booleans are 3==2, 5>4, agent.priority==1, etc
These things are booleand because they are true or false
you are putting in the condition a function that doesn't return anything (receive) and I have absolutely no idea what is in your head that would suggest that this might work in any way...
I suggest you add a variable in your ped agent that defines what the pedestrian should do...

Botium Scripting Memory - Variable value not picked up in the utterance

I have been unsuccessful so far in getting the scripting memory to work and looking for help please.
Utterance in my test excel sheet - How can I get $app-music?
ScriptingMemory tab content:
Expectation is: Botium to send $app-music values in the utterances to the bot
Actual behaviour: Botium sending variable name ($app-music) as opposed to the values.
Please can someone help me in getting this to work? TIA.
I spotted two problems. First of all, variable names with a "-" are not allowed - only characters and numbers - see Botium Wiki - choose another variable name, $appmusic for example.
Furthermore, the Excel area scanned by Botium starts in the second row, according to your configuration, so you will have to move the scripting memory table one to the bottom.

Cannot update one field at a time with VSTO for Word

When fields are nested, there is a problem.
foreach (Word.Field field in this.Application.ActiveDocument.Fields)
{
field.Update();
text = field.Result.Text;
}
The above code does not work.
The process starts, but winds up in an endless loop or some other process that hangs the system.
Thinking about it, I can surmise that when you update a field, it might have an effect on the fields collection - thus, the loop fails.
Does anyone have any ideas on implementing this?
P.S. I know there is a Document.UpdateFields() method to update ALL fields. However, there are reasons why I cannot use this and need to only update specific field types.
My apologies! I was going to give an example of a nested field but was trying to test some more before sending anyone (Jack) on a goose-chase.
I waited and waited and waited, and after a good 2 or 3 minutes, it finished. After the last field, it crashed with this message:
Object has been deleted.
The error was generated from the following line inside the loop:
string text = field.Code.Text;
The template is being tested on mergefields that are not being found because I am testing without database connectivity. It would be odd, but explainable, that it goes through all the fields and then, at the end of the day, the very OUTER IF field's result is "Error! Reference source not found." But I still don't get why this could happen.
Nor do I understand why looping takes 3 minutes while a call to document.Fields.Update() will do the same thing in about 1 second and NOT result in the error described above.
Again, my apologies. I never considered updating inside a loop would be vastly slower that a call to doc.fields.update().