Using Alias to model bidirectional constraints in GAMS - optimization

I'm working on a big optimization problem on GAMS so it's impossible for me to put the entire code here but I hope you could help me with where I am stuck at. I have 4 power nodes in my model that are connected by 2 bidirectional transmission lines (r) like this.
where r_a, r_b are the current transmission line capacities. Power can flow both directions and I'm tracking power going from A to A' and B to B' as well as from A' to A and B' to B. So there are 4 power flows (f) in 2 transmission lines (r). My decision variables are how much capacity upgrade (c(f)) I need to build in each of these lines to satisfy more power flow needs. So in GAMS, I minimized the cost of upgrading as:
investment_cost.. cap_cost =e= sum(f,c(f)*capCost(f));
here capCost(f) is the capital cost of upgrading the transmission line capacity to be able to flow 1 extra GW her hour.
My constraint: In each time period (t), the total power flow p(f,t) must be less than or equal to the existing line capacity + newly upgraded capacity:
line_cap(f,t).. old_line_cap(l)+c(f) =g= p(f,t);
However, my solution looks something like this:
fAA': 6.7 (built 6.7 GW more of capacity in line from A to A')
fA'A: 5.0 (built 5.0 GW more of capacity in line from A' to A)
fBB': 5.5 (built 5.5 GW more of capacity in line from B to B')
fB'B: 8.1 (built 8.1 GW more of capacity in line from B' to B)
But this is not right because if I upgrade line AA' by 6.7 GW, I don't need to upgrade line A'A, since they are the same line. Basically, I pay twice to upgrade the same line.
So I fix this, I'm trying to use Alias such as this:
Alias(f,ff)
line_cap(f,t).. old_line_cap(f)+c(f)+ sum((f,ff)$[line_source(f)=line_sink(ff) and line_source(ff)=line_sink(f)],c(ff)) =g= p(f,t);
But that still does not fix my problem.
I'd appreciate any help! Thank you!

If you want to stick with your 4 fs, let's call them your virtual lines (since a pair of two of these virtual lines actually form one physical lines). Now, let's introduce a new set of physical lines (fPhys) and a mapping between the virtual and the physical lines (fMap):
Set fPhys / fAA, fBB /
fMap(f, fPhys) / ("fA'A", "fAA'").fAA
("fB'B", "fBB'").fBB /;
Now, you can stick with using the set f for your flows, and use fPhys for the investment decision, like this:
investment_cost.. cap_cost =e= sum(fPhys,c(fPhys)*capCost(fPhys));
line_cap(f,t).. sum(fMap(f,fPhys), old_line_cap(fPhys)+c(fPhys)) =g= p(f,t);

Related

How to build Yocto hddimg on i.MX7 to boot from usb stick

I have an i.mx7 som. I want to build a Yocto image which I can dd onto a usb stick to boot from. I believe that I want an hddimg image but cannot see how to create one (I have sdimg which works prefectly).
I would appreciate advice.
I have set IMAGE_FSTYPES to "hddimg" but get "ERROR: Nothing PROVIDES 'syslinux'"
The SOM is the Technexion i.MX7. Layers are:
layer path priority
=======================================================
meta sources/poky/meta 5
meta-poky sources/poky/meta-poky 5
meta-oe sources/meta-openembedded/meta-oe 6
meta-multimedia sources/meta-openembedded/meta-multimedia 6
meta-freescale sources/meta-freescale 5
meta-freescale-3rdparty sources/meta-freescale-3rdparty 4
meta-freescale-distro sources/meta-freescale-distro 4
meta-powervault sources/meta-powervault 6
meta-python sources/meta-openembedded/meta-python 7
meta-networking sources/meta-openembedded/meta-networking 5
meta-virtualization sources/meta-virtualization 8
meta-filesystems sources/meta-openembedded/meta-filesystems 6
meta-cpan sources/meta-cpan 10
meta-mender-core sources/meta-mender/meta-mender-core 6
meta-mender-freescale sources/meta-mender/meta-mender-freescale 10
Nope, you certainly do not want an hddimg, as this is a mostly deprecated format for x86 systems. On ARM, you almost never want syslinux :-)
Usually your SOM comes with a Board Support Package in the form of a layer, which includes the MACHINE definition which in turn defines the IMAGE_FSTYPE that this machine likes for booting. If in doubt, consult the manual or ask your vendor.
Having said that, if you specify SOM and layers in use we can have a look if publicly accessible, but without those details it is impossible to give a proper answer.

LabVIEW driver - Bertan 225 - HV won't turn on

I'm trying to use the Bertan 225 driver. However, using the driver I cannot turn on the voltage (it does not produce any errors and the code it puts out seems to match the user manual).
Does anyone have any experience with this? Or any ideas?
I can put the codes in
L00.500K
L1.0000M
OC1OE1OE2
SE1SC1
P0.05000K
And I can turn the instrument to local and it goes to 50 V (0.05 kV). Then I can put in
L00.500K
L1.0000M
OC1OE1OE2
SE1SC1
P0.10000K
And I can turn the instrument to local and it goes to 100 V (0.1 kV).

Addressing ECUs directly using ELM 327 dongle and ISO 9141

I have a VW Golf 4, which is quite old and talks KWP 2000 (ISO 9141) on its CAN bus. I use a dongle powered by ELM 327, connected to the OBD-2 port of the car.
I am trying to send messages individually to each ECU. I tried to change the header of the messages:
AT SH 48 XX F1 (I hoped XX would be the ECU ID; 48 is the flag for "use physical addressing"). Any command I issue (e.g. tried 3E for "tester present") returns NO DATA (I disabled automatic timeouts and set the timeout to maximum value).
Is there a way to send messages directly to the ECU? I am not interested in the set of data provided via OBD-2, neither do I want to re-flash the ECUs. At the moment I just try to find out which ECUs are available on the bus.
Thanks!
VW works on Transport Protocol TP 2.0, hence you need to initialize with 0x200 header.
https://jazdw.net/tp20
See above link for more info.

Expert advisor in different trader platform

I would like to know, if I code an EA in a normal metatrader4 platform, can I reuse the .ex4 in other trading platform for example InstaTrader?
The reason is that, when I have created a new EA in InstaTrader, the EA code generated from InstaTrader is different from the one generated from metatrader4. And I couldn't find any documentation regarding to InstaTrader's EA.
Not sure anyone has encountered this before?
No. MQL is the language specifically for meta-editor which is a member of meta-trader platform.
Other trading languages may have their own scripting languages.
Metatrader4
In principle Metatrader4 uses a Metalang.exe that compiles the MQL4-source-code files into an "internally"-executable format EX4
As defined, EX4 is binary-executable on all Metatrader4 terminals.
.
WhiteLabel-ed Terminals
InstaTrader(TM) and many other *-Trader(TM)-s are so called White-Label modifications of the same MetaQuotes, Inc., software product, the [Metatrader 4 Terminal], that are just individually "skinned" in a name of the respective Broker, who has bought from the MetaQuotes, Inc. the license for a suite of [Metatrader 4 Server + Metatrader 4 Risk Management + Metatrader 4 Dealer Desk + ... ], inclusive, but not limited to, the right to re-label the client Terminal program.
Thus under most of the situations your EX4 code shall run on any other re-labeled Terminal
But...
Restrictions on binary-compatibility apply, as Metatrader4 terminals gets released in so called Builds, ( Build 432 -> Build 468 -> Build 509 -> ... -> Build 600 -> Build 624 ) and some of these have also modified the binary-code format.
Thus the EX4 code shall be hosted on a "similar" generation of the Terminal Build
Finally...
The ultimate show-stopper is the MetaQuotes, Inc., licensing policy, which makes a server-side locking to take place [Metatrader 4 Server] has a setting to reject connection requests from client Terminals in case their Build # is lesser than a treshold set on Server side.
There the SLM story ends. Forever.

Embedded - DM3730 processor

I am referring the TRM of DM3730 and modifying the pad configurations on an EVM 3530 accordingly. I couldn't understand the following properly.
1) What are CORE power domain and WKUP power domain?
2) What is core control module and Wake-Up control module?
3) The above two questions may be completely hardware-oriented. But the reason I'm asking is, in EVM 3530 source code, in pad configurations, certain pins are defined as PAD_ENTRY and certain others as WKUP_PAD_ENTRY. What makes the difference?
#define PAD_ENTRY(x,y) {PAD_ID(x),y,0},
#define WKUP_PAD_ENTRY(x,y) {WKUP_PAD_ID(x),y,0},
#define I2C3_PADS \
PAD_ENTRY(I2C3_SCL, INPUT_ENABLED | PULL_RESISTOR_DISABLED | MUXMODE(0)) \
PAD_ENTRY(I2C3_SDA, INPUT_ENABLED | PULL_RESISTOR_DISABLED | MUXMODE(0))
#define I2C4_PADS \
WKUP_PAD_ENTRY(I2C4_SCL, INPUT_ENABLED | PULL_RESISTOR_DISABLED | MUXMODE(0)) \
WKUP_PAD_ENTRY(I2C4_SDA, INPUT_ENABLED | PULL_RESISTOR_DISABLED | MUXMODE(0))
Any kind of guidance is welcome.
WKUP provides functions for sections of the OMAP SoC to come out of power-saving mode.
A power domain can be turned on/off without affecting others (4.1.3.2). WKUP power domain is continously active, it allows for switching others. CORE power domain comprises interconnect / memory / peripheral core functions.
Wake-up control module and core control module provide for save and restore of pad configurations (7.3) when switched off.
It looks like the pads which can be configured as I2C4 SCL/SDA can also be configured with wakeup capabilities. Then in your code base (Windows CE 6 BSP?) a different macro from generic PAD_ENTRY is appropriate, probably there is an error check of (x) to confirm pad ID is valid. The non-wakeup-related macro parameters should work the same for you, there won't be a difference.
Section references are to OMAP35x-TRM.