OMNotebook Error: Class dev not found in scope (looking for a function or record) - openmodelica

I have modified the van der Pol example from DrModelica with the following changes:
model FPStirling "Free Piston Stirling engine model"
Real x(start = 1,fixed = true);
Real v(start = 1,fixed = true);
Real T(start = 1,fixed = true);
equation
der(x) = v;
dev(v) = T/x-1;
dev(T) = 1 - x;
end FPStirling;
It evaluates and returns: {FPStirling}
Then I run: simulate(FPStirling, startTime=0, stopTime=25 )
But I get the output:
record SimulationResult
resultFile = "",
messages = "Failed to build model: FPStirling"
end SimulationResult;
OMC-ERROR:
"[7:3-7:17] Error: Class dev not found in scope FPStirling (looking for a function or record).
Error: Error occurred while flattening model FPStirling
"
Could it be a path problem?

Do you really have a function dev defined somewhere? Or maybe its a typo for der.
Adeel.

Related

Argument to dynamic structure reference must evaluate to a valid field name (helperBluetoothChannelClassification)

Hi im doing a bluetooth project using bluetooth toolbox in matlab, and encountered a problem. So I have been following one of the example from https://www.mathworks.com/help/bluetooth/ug/noncollaborative-bluetooth-le-coexistence-with-wlan-signal-interference.html this error occurred.
ble_wlan_interference
Argument to dynamic structure reference must evaluate to a valid field
name.
Error in helperBluetoothChannelClassification (line 102)
obj.(varargin{idx}) = varargin{idx+1};
Error in ble_wlan_interference (line 58)
classifierObj = helperBluetoothChannelClassification(centralNode,peripheralNode,PERThreshold=50);
At line 102 of helperBluetoothChannelClassification.m is as follows,
methods
% Constructor
function obj = helperBluetoothChannelClassification(varargin)
% Set name-value pairs
for idx = 1:2:nargin
obj.(varargin{idx}) = varargin{idx+1};
end
At line 58 of main code is as follows,
%enable channel classification
enableChannelClassification = true;
if enableChannelClassification
classifierObj = helperBluetoothChannelClassification(centralNode,peripheralNode,PERThreshold=50);
classifyFcn = #(varargin) classifierObj.classifyChannels;
userData = []; % User data needed to be passed to the callback function
callAt = 0; % Absolute simulation time, in seconds
periodicity = 125e-3; % In seconds
scheduleAction(networkSimulator,classifyFcn,userData,callAt,periodicity); % Schedule channel classification
end
I think the centralNode and peripheralNode parameter is not recognizable in helperBluetoothChannelClassification function, but don't know what is a problem.. Thanks :)

UPDATING an IMAGE column in Sybase with PREPARED statement fails

This is with ASE 15.7 and ESQL/C. Updating a row in a CURSOR with a prepared statement:
EXEC SQL BEGIN DECLARE SECTION;
CS_IMAGE image[512];
EXEC SQL END DECLARE SECTION;
strcpy(image, "foo");
EXEC SQL PREPARE updt FROM "UPDATE image_test SET nettodaten = ? WHERE CURRENT OF hc_image_test";
EXEC SQL EXECUTE updt USING :image;
fails with the message from ASE:
** SQLCODE=(-201)
** ASE Error
** Procedure *sq1625128094_1900377684ss* expects parameter
Invalid pointer param number 4, pointer value 0x(nil)
, which was not supplied.
What could be the reason for this?
Update 1
I modified the ESQL/C code a bit so it looks like this:
strcpy(anweisung, "UPDATE image_test SET katkey = ?, nettodaten = ? WHERE CURRENT OF hc_image_test");
EXEC SQL PREPARE updt FROM :anweisung;
EXEC SQL EXECUTE updt USING :key, :blobfld;
EXEC SQL CLOSE hc_image_test;
The error remains the same as above. But a look into the produced C-code by CPRE shows an interesting detail:
/*
** SQL STATEMENT: 17
** EXEC SQL EXECUTE updt USING :key, :blobfld;
*/
{
_SQL_CT_HANDLES * _sql;
_sqlinitctx(&_sql, CS_CURRENT_VERSION, CS_TRUE, &sqlca, (long
*)NULL, (CS_CHAR *)NULL);
if (_sql != (_SQL_CT_HANDLES *) NULL)
{
_sql->stmtData.persistent = CS_FALSE;
_sql->stmttype = SQL_EXECUTE;
_sql->connName.lnlen = CS_UNUSED;
_sql->stmtName.fnlen = 4;
strcpy(_sql->stmtName.first_name, "updt");
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
{
_sql->retcode = ct_dynamic(_sql->conn.command,
CS_EXECUTE, "updt", 4, NULL, CS_UNUSED);
if (_sql->retcode == CS_SUCCEED)
{
_sql->dfmtCS_INT_TYPE.count = 0;
_sql->dfmtCS_INT_TYPE.status = CS_INPUTVALUE;
_sql->retcode = ct_param(_sql->conn.command,
&_sql->dfmtCS_INT_TYPE, &key, (CS_INT)
CS_UNUSED, (CS_SMALLINT) 0);
_sql->dfmtCS_INT_TYPE.status = 0;
}
_sql->retcode = ct_send(_sql->conn.command);
_sql->hastate = (_sql->retcode == CS_RET_HAFAILOVER);
_sql->retcode = _sqlResults(_sql);
_sql->retcode = _sqlepilog(_sql);
}
if (sqlca.sqlcode < 0)
{
error_handler();
}
As one can see above, a pointer to the host variable CS_INT :key is placed with a call to ct_param() into the internal structures, but not any reference to the host variable CS_IMAGE :blobfld. And that's why ASE is complaining with a missing param value because it sees two question marks ? in the prepared UPDATE statement. This looks to me somehow as a bug in the CPRE compiler and not in ASE itself.
I have contacted through our maintenance contract the company SAP (the issue number there is 390674 / 2018) and some engineer is looking into this CPRE issue...
For the moment, I'm adding to the C-code produce by CPRE, short before the ct_send() call, the following lines of code to add the missing reference to the IMAGE column:
/* additional code for host var :blobfld */
if (_sql->retcode == CS_SUCCEED)
{
_sql->dfmtCS_IMAGE_TYPE.count = 0;
_sql->dfmtCS_IMAGE_TYPE.maxlength = (CS_INT) 65535;
_sql->dfmtCS_IMAGE_TYPE.format = CS_FMT_UNUSED;
_sql->dfmtCS_IMAGE_TYPE.status = CS_INPUTVALUE;
_sql->retcode = ct_param(_sql->conn.command,
&_sql->dfmtCS_IMAGE_TYPE, blobfld, (CS_INT) ImageLengthField,
(CS_SMALLINT) 0);
_sql->dfmtCS_IMAGE_TYPE.status = 0;
}
/* end of additional code for host var :blobfld */
_sql->retcode = ct_send(_sql->conn.command);
...
And all works fine.

I am facing End of file reached error

I am newbie to python and was trying following code
class Arm(object):
def __init__(self, SNo, ActivityDate, RequesterTeam, RequesterSignumId, RequesterEmailId,Circle,Customer,Technology,WOType,ProblemTitle,ActivityTypeorEqType,SiteID,BSCFACID,EngineerName,EngineerSignum,DetailDescriptionOfActivityToBePerformed,TimelineforActivityCompletion,WOIDbyWFM ):
self.SNo= SNo
self.ActivityDate=ActivityDate
self.RequesterTeam=RequesterTeam
self.RequesterSignumId=RequesterSignumId
self.RequesterEmailId=RequesterEmailId
self.Circle=Circle
self.Customer=Customer
self.Technology=Technology
self.WOType=WOType
self.ProblemTitle=ProblemTitle
self.ActivityTypeorEqType=ActivityTypeorEqType
self.SiteID=SiteID
self.BSCFACID=BSCFACID
self.EngineerName=EngineerName
self.EngineerSignum=EngineerSignum
self.DetailDescriptionOfActivityToBePerformed=DetailDescriptionOfActivityToBePerformed
self.TimelineforActivityCompletion=TimelineforActivityCompletion
self.WOIDbyWFM=WOIDbyWFM
def __str__(self):
return("Arm object:\n"
"SNo = {0}\n"
"ActivityDate = {1}\n"
"RequesterTeam = {2}\n"
"RequesterSignumId = {3}\n"
"RequesterEmailId = {4}\n"
"Circle = {5}\n"
"Customer = {6}\n"
"Technology = {7}\n"
"WOType = {8}\n"
"ProblemTitle = {9}\n"
"ActivityTypeorEqType = {10}\n"
"SiteID = {11}\n"
"BSCFACID = {12}\n"
"EngineerName = {13}\n"
"EngineerSignum = {14}\n"
"DetailDescriptionOfActivityToBePerformed = {15}\n"
"TimelineforActivityCompletion= {16}\n"
"WOIDbyWFM = {17}\n"
.format(self.SNo,
self.ActivityDate,
self.RequesterTeam,
self.RequesterSignumId,
self.RequesterEmailId,
self.Circle,
self.Customer,
self.Technology,
self.WOType,
self.ProblemTitle,
self.ActivityTypeorEqType,
self.SiteID,
self.BSCFACID,
self.EngineerName,
self.EngineerSignum,
self.DetailDescriptionOfActivityToBePerformed,
self.TimelineforActivityCompletion,
self.WOIDbyWFM)
I am getting
File
"C:\Users\OpenSource\eclipse-workspace\PythonWorkSpace\DataHiding\src\Hiding.py", line 26 ^ SyntaxError:unexpected EOF while parsing error
while running the code. please suggest me where i am making errors.
You should have "WOIDbyWFM = {17}\n"..format(self.SNo, .......
You are missing a closing right parentheses at the end of your return statement.
Please use the PyCharm editor and it will show you all errors like eclipse does and then you can correctly indent your code to make it bug free.

Groovy ALM HpQC - Groovy exception - How to fill ST_ACTUAL design step field

I am trying to update HpQC result from SOAP-UI groovy script
but I'm currently unable to modify ST_ACTUAL field of design step,
only to read the current value.
each try conduct to groovy exception ("designStep.item(c).Field(ST_ACTUAL)" is a method call expression, but it should be a variable expression" for exemple)
For my try, I have two steps under a test. Could you help to solve my issue and tell me where I'm wrong? In advance, thanks a lot for your help and answers.
//############# Connexion a HpQC ###############
def tdc = new ActiveXObject ('TDApiOle80.TDConnection')
tdc.InitConnectionEx(addresse_qc)
tdc.Login(login_qc, psw_qc)
tdc.Connect(domain_qc, project_qc)
log.info "*** connected to QC ***"
//Catch the testSet campain in the Test Lab
oTestSetFolder = tdc.TestSetTreeManager.NodeByPath(chemin_dans_qc)
list_TestSetList = oTestSetFolder.FindTestSets(testSet_name_qc)
oTestSet = list_TestSetList.Item(1)
//catch the test list in the Test Lab
oTestSetFactory = oTestSet.TSTestFactory
testList = oTestSetFactory.NewList("")
def nb_test = testList.Count()
// select first test (item(1) -- Current status test Run - should be "No Run"
selected_test = testList.Item(1)
log.info("OnGoing test : " + "ID="+ selected_test.ID +" - "+ selected_test.name + " - status= "+selected_test.Status)
// Create a new Test Run and modified final status for try
OnGoing_RunTest= selected_test.RunFactory.AddItem('Comment 1')
OnGoing_RunTest.Status = 'Blocked'
def b=OnGoing_RunTest.ID
OnGoing_RunTest.Post()
OnGoing_RunTest.CopyDesignSteps()
OnGoing_RunTest.Post()
Stepslist_of_OnGoing_RunTest = OnGoing_RunTest.StepFactory.NewList("")
//def nbsteps= Stepslist_of_OnGoing_RunTest.count()
def c=1
for(designStep in Stepslist_of_OnGoing_RunTest)
{
// lecture designStep
def a=designStep.ID
// checking previous information : ok
//log.info("DesignStep_ID="+designStep.ID)
//log.info("ST_STEP_NAME = "+ designStep.field("ST_STEP_NAME"))
//log.info("ST_STATUS = "+ designStep.field("ST_STATUS"))
//log.info("ST_DESCRIPTION = "+ designStep.field("ST_DESCRIPTION"))
//log.info("ST_EXPECTED = "+ designStep.field("ST_EXPECTED"))
// updating Status and ST_ACTUAL field
designStep.Status="Not Completed" // : OK
// Updating ST_ACTUAL field
// designStep.Field("ST_ACTUAL")="123" // => KO
//designStep.item(c).Field("ST_ACTUAL")="123" // ==> KO
// designStep.item(designStep.ID).Field("ST_ACTUAL")="123" // ==> KO
// designStep.item(designStep.ID).Field("ST_ACTUAL")="123" // ==> KO
c++
log.info("ST_ACTUAL = "+ designStep.field("ST_ACTUAL"))
designStep.post()
}
//Updating Run QC
selected_test.Post()
log.info("*** ---- END Test --- ***")
//######### déconnection de QC ############
tdc.Disconnect()
//On écrit dans le log
log.info("### -- QC disconnect -- ### -- END -- ###")
I never tried in Groovy but in Ruby I had to use something like this (untested for this exemplary code):
designStep["ST_ACTUAL"]="123"

Odd behaviour of insertNewObjectForEntityForName leading to NSInternalInconsistencyException

I have a rather odd case of getting a core data error whilst experimenting with Swift. I am not sure whether it comes from Swift (beta error?) or whether it is me. However, here is the setup for my test cases (in VTModelTests.swift).
var bundle = NSBundle(forClass: VTModelTests.self)
var url = bundle.URLForResource("VTDocument", withExtension:"momd")
appleModel = NSManagedObjectModel(contentsOfURL: url)
assert (appleModel != nil)
var coord = NSPersistentStoreCoordinator(managedObjectModel: appleModel);
var store = coord.addPersistentStoreWithType(NSInMemoryStoreType,configuration:nil,URL:nil,options:nil,error:nil);
assert (store != nil)
ctx = NSManagedObjectContext();
ctx!.persistentStoreCoordinator=coord
ctx!.retainsRegisteredObjects=true;
var drwName = "Drawing"
var descs = ctx!.persistentStoreCoordinator.managedObjectModel.entitiesByName
for e : AnyObject in descs.allKeys{
assert (descs.objectForKey(e).name == e as String )
if (e as String == drwName) {
NSLog("yeah")
}
}
model = NSEntityDescription.insertNewObjectForEntityForName(drwName,inManagedObjectContext: ctx) as Drawing
My error message looks like this:
2014-06-22 22:12:25.584 xctest[63792:303] yeah
<unknown>:0: error: -[_TtC12VTModelTests12BaseTypeTest testTreeStructure] : failed: caught "NSInternalInconsistencyException", "+entityForName: could not locate an entity named 'Drawing' in this model."
In short, I can "prove" that the entity name is there (the 'yeah' in the log), but core data is showing the issue that the name would not be in the model. Previous versions of the loop printed out the entities and that looked good. I don't have any second versions, and a new changed name ('Model' is now called 'Drawing') is correctly shown in the model data when all entities are printed. The compiled model is in the resulting bundle.
Can anybody explain? Or do I have to wait for the next beta release of Xcode 6? What else did I overlook? Many thanks in advance!
I can confirm the issue. Not an answer but the way around I use is to split insertNewObjectForEntityForName into:
let entity = NSEntityDescription.entityForName("Photo", inManagedObjectContext:context)
let photo = Photo(entity:entity, insertIntoManagedObjectContext:context)

Resources