Class or component cannot be found - modelica

I was trying to create a heat exchanger (liquid-liquid) based on the condensor (AirConditioning.HeatExchangers.Condensor) from the AC library.
And the issue is there is an error telling me "Class or component 'tion' not found in HXCoolant refrigerant".
I checked the ThermoFluidPro.PipesAndVolumes.HXCoolant, but didn't find any component names "tion".
ThermoFluidPro.PipesAndVolumes.HXCoolant refrigerant(
redeclare model HTCoefficient =
ThermoFluidPro.HeatTransfer.HTPipe.KcSimpleTwoPhase
"HTCoefficientRefSide (F_user=CF_RefrigerantSideHeatTransfer)",
redeclare replaceable model FrictionLoss =
ThermoFluidPro.PressureLoss.PLossHexChannel.DensityProfilePressureLossHX
(
p0_in=23.6e5,
p0_out=23.5e5,
h0_in=450e3,
h0_out=270e3,
mdot0=0.02),
tion=geometry.tubeOrientation,
init=coolantChannelInit,
redeclare package Medium = ThermoFluidPro.Media.Technical.R134a)
annotation (Placement(transformation(extent={{-30,-78},{10,
-38}}, rotation=0)))
Is there anyone have this type of error before? And how do you fix it?
Thank you

This is a very late answer, but the solution as implicitly suggested by others is to remove the line in your code that reads:
tion=geometry.tubeOrientation,
It seems as it was just the result of bad copy&paste. I assume it originally was orientation or tubeOrientation, but as far as I can tell ThermoFluidPro.PipesAndVolumes.HXCoolant does not have parameters with such names.

Related

2 problem with minspantree.m in Matlab 2018a

2 problem with minspantree.m in Matlab 2018a
Hi dear all; I want to find a min-span-tree of a matrix. I figured that MATLAB's own minspantree.m may be the most efficient algorithm. So i use
open minspantree.m
And here comes Question:
1.The code in minspantree.m used G.EdgeProperties.Weight and G.Underlying. G is a graph object. But when I use G.EdgeProperties.Weight or G.Underlying in Command window, both returns error: Error using graph/subsref (line 15) No public property 'EdgeProperties' for class 'graph'. Why?
2.minspantree.m line 62:
[pred, edgeind] = primMinSpanningTree(G.Underlying, w, rootNode, restart);
Is primMinSpanningTree a function? But I can not find any: function [ ] = primMinSpanningTree() in minspantree.m, neither can I find primMinSpanningTree.m file in my whole disk. So what is primMinSpanningTree? What is its code? How can I find it and open it?
Thanks all very much.
Both EdgeProperties and Underlying are private properties of the graph class. They can only be accessed from within the class. Take a look at Graph.m. minspantree is a class method, so it has access.
primMinSpanningTree is a built-in method from matlab.internal.graph.MLGraph. You can see that with which primMinSpanningTree. So I believe the code might not be accessible.

ArangoDB "Spring Data Demo" Tutorial outdated?

Like the title says, is it possible the tutorial at https://www.arangodb.com/tutorials/spring-data/ is outdated? I'm having several problems, but don't know how to workaround the last one:
Part 2, "Save and read an entity"
I get an error: method getId() is undefined.
Workaround: I added a getter in class Character.
Also in "Save and read an entity"
final Character foundNed = repository.findOne(nedStark.getId());
The method findOne(Example) in the type QueryByExampleExecutor is not applicable for the arguments (String)
Workaround: I used find by example:
final Optional<Person> foundNed = repository.findOne(Example.of(nedStark));
Part 1, "Create a Configuration class"
public class DemoConfiguration extends AbstractArangoConfiguration {
Gives me an error:
"No constructor with 1 argument defined in class 'com.arangodb.springframework.repository.ArangoRepositoryFactoryBean'"
Workaround: ?
Can anyone point me in the right direction?
I found the demo project on github: https://github.com/arangodb/spring-data-demo
Number 1: They use a getter too.
Number 2: Was my fault, I did try ArangoRepository (of Character, Integer) but forgot that Id is a string.
Number 3: They don't seem use any Configuration (AbstractArangoConfiguration) class in the source at all although it is still mentioned in that tutorial. I think now the config and connection is handled by spring autoconfigure. Though I would like to know how the Arango driver is set, all I could find that may point further is ArangoOperations.
Anyway it works now, maybe this helps somebody else who is having the same problems.

Where is pi defined in mathjs?

I have a custom bundle for mathjs that looks something like so:
var core = require('mathjs/core');
var math = core.create();
math.import(require('mathjs/lib/type'));
math.import(require('mathjs/lib/function/arithmetic'));
math.import(require('mathjs/lib/function/trigonometry'));
math.import(require('mathjs/lib/expression'));
which I then export. If I then try math.eval('pi'), I get an Exception:
Exception: Error: Undefined symbol pi
I don't see this error if I import the entire mathjs library but, then, that rather defeats the purpose of the small custom bundle.
Question: What is the minimal import so that math.eval('pi') returns 3.14...?
var core = require('mathjs/core');
var math = core.create();
math.import(require('mathjs/lib/type'));
math.import(require('mathjs/lib/expression'));
math.import(require('mathjs/lib/constants'));
console.log(math.eval('pi')) // 3.141592653589793
See the constants module in the github repository of mathjs.
The value of PI is taken from the standard, built-in Javascript object Math. See this.

GetExportedValues<MyType> returns nothing, I can see the parts

I have a strange MEF problem, I tested this in a test project and it all seems to work pretty well but for some reason not working in the real project
This is the exporting code
public void RegisterComponents()
{
_registrationBuilder = new RegistrationBuilder();
_registrationBuilder
.ForTypesDerivedFrom(typeof(MyType))
.SetCreationPolicy(CreationPolicy.NonShared)
.Export();
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(typeof(MyType).Assembly, _registrationBuilder));
var directoryCatalog = new DirectoryCatalog(PathToMyTypeDerived, _registrationBuilder);
catalog.Catalogs.Add(directoryCatalog);
_compositionContainer = new CompositionContainer(catalog);
_compositionContainer.ComposeParts();
var exports = _compositionContainer.GetExportedValues<MyType>();
Console.WriteLine("{0} exports in AppDomain {1}", exports.Count(), AppDomain.CurrentDomain.FriendlyName);
}
exports count is 0 :( Any ideas why?
IN the log file I have many of this
System.ComponentModel.Composition Information: 6 : The ComposablePartDefinition 'SomeOthertype' was ignored because it contains no exports.
Though I would think this is ok because I wasn' interested in exporting 'someOtherType'
UPDATE: I found this link but after debuging over it I am not wiser but maybe I m not following up properly.
Thanks for any pointers
Cheers
I just had the same problem and this article helped me a lot.
It describes different reasons why a resolve can fail. One of the more important ones is that the dependency of a dependency of the type you want to resolve is not registered.
What helped me a lot was the the trace output that gets written to the Output window when you debug your application. It describes exactly the reasons why a type couldn't be resolved.
Even with this output. you might need to dig a little bit, because I only got one level deep.
Example:
I wanted to resolve type A and I got a message like this:
System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition 'Namespace.A' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced multiple composition errors, with 1 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.
1) No exports were found that match the constraint:
ContractName Namespace.IB
RequiredTypeIdentity Namespace.IB
Resulting in: Cannot set import 'Namespace.A..ctor (Parameter="b", ContractName="namespace.IB")' on part 'Namespace A'.
Element: Namespace.A..ctor (Parameter="b", ContractName="Namespace.IB") --> Namespace.A --> AssemblyCatalog (Assembly="assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=...")
But I clearly saw a part for Namespace.IB. So, in the debugger, I tried to resolve that one. And I got another trace output. This time it told me that my implementation of Namespace.IB couldn't be resolved because for one of its imports there was a missing export, so basically the same message as above, just with different types. And this time, I didn't find a part for that missing import. Now I knew, which type was the real problem and figure out, why no registration happened for it.

IronPython error, "'TextBox' object has no attribute 'text'" when using a ShowDialog() method created in SharpDevelop

I am trying to call a form designed in SharpDevelop within another IDE. I get the following error message: 'TextBox' object has no attribute 'text'. This happens when I run the script which includes the lines shown below in the other IDE. Is the problem in the script itself or in the Form1 class written in SharpDevelop? How can I resolve this?
import myform
import System
f = myform.Form1()
if f.ShowDialog() == System.Windows.Forms.DialogResult.OK:
dx = f._directionx.text
dy = f._directiony.text
dz = f._directionz.text
nb = f._nbofiterations.text
w = f._width.text
h = f._height.text
Since it appears that you're using IronPython (the System.Windows.Forms gave it away) I'm guessing that your TextBox is a Forms element.
If this is so, you need the .Text property - everything (properties, functions/methods that I know of) in the .NET library starts with an uppercase letter.
change .text to .Text
dx = f._directionx.Text
and so on
C sharp is case sensitive language