Avoid error "Hold[Throw[$Failed]]" while using ConnectSystemModelComponents Posted 1 year ago 2665 Views | 4 Replies | 2 Total Likes |  I am just starting to experiment with the system modeling capability in Mathematica. This very simple model gives this for the result "Hold[Throw[$Failed]]" components = { "S" \[Element] "Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow", "R1" \[Element] "Modelica.Thermal.HeatTransfer.Components.ThermalResistor", "T" \[Element] "Modelica.Thermal.HeatTransfer.Sources.FixedTemperature"}; connections = {"S.b" \[UndirectedEdge] "R1.a", "R1.b" \[UndirectedEdge] "R2.a", "R2.b" \[UndirectedEdge] "T.b"}; model = ConnectSystemModelComponents[components, connections] What am I doing wrong?
4 Replies
Sort By:
Posted 1 year ago
 Jeff,Two things are wrong: you forgot a component (you use R2 but don't specify it) components = {"S" \[Element] "Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow", "R1" \[Element] "Modelica.Thermal.HeatTransfer.Components.ThermalResistor", "R2" \[Element] "Modelica.Thermal.HeatTransfer.Components.ThermalResistor", "T" \[Element] "Modelica.Thermal.HeatTransfer.Sources.FixedTemperature"};  and 2. You got the port names wrong for the heat components:  connections = {"S.port" \[UndirectedEdge] "R1.port_a", "R1.port_b" \[UndirectedEdge] "R2.port_a", "R2.port_b" \[UndirectedEdge] "T.port"}; Now it works (although your model has 2 sources connected with resistors so it does not do anything interesting -- I assume you were just trying to get a simple example to work)The error message is not at all helpful so I will report it to Wolfram in Sweden so they can fix it.I found the best way to get started is to go into SystemModeler (WSM) and view the components there -- even create a basic model and then change/update/recreate it in MMA once you have the component names and ports correct. You can also build a simple model in WSM and do this in MMA to get the correct syntax (essentially reversing your process): model = SystemModel["Model1"] comp = foo["Components"] conn = foo["Connections"] This will give you the strings you need for the component names (or just hover your mouse over the output objects) comp //InputForm Regards,Neil
Posted 1 year ago
 Thanks! This helps.